]> git.sesse.net Git - vlc/commitdiff
macosx: playlist: catch update events for metadata and info
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 8 Mar 2015 16:14:53 +0000 (17:14 +0100)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 8 Mar 2015 16:28:49 +0000 (17:28 +0100)
Playlist view gets updated to display new information.
Info dialog gets updates (shows only information about currently
played input at the moment).

close #13729

modules/gui/macosx/PLModel.h
modules/gui/macosx/PLModel.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.m

index d6584ae7ceb62f00f425201e1b3f8ed798ab8e66..d4b1a7ef11d6be8ef7e395f094ad3cbcfb22067f 100644 (file)
@@ -76,12 +76,15 @@ typedef enum {
 - (PLRootType)currentRootType;
 
 - (BOOL)editAllowed;
-
+// updates from core
 - (void)addItem:(int)i_item withParentNode:(int)i_node;
 - (void)removeItem:(int)i_item;
 
+- (void)updateItem:(input_item_t *)p_input_item;
+
 - (PLItem *)currentlyPlayingItem;
 
+// sorting / searching
 - (void)sortForColumn:(NSString *)o_column withMode:(int)i_mode;
 
 - (void)searchUpdate:(NSString *)o_search;
index 9503e7053aaa40657cf7c6505e42def5b0126171..7aa803674f88fcf1056742e6524c37b32a4f9932 100644 (file)
@@ -43,6 +43,8 @@
 @synthesize rootItem=_rootItem;
 @synthesize draggedItems=_draggedItems;
 
+#pragma mark -
+#pragma mark Init and Stuff
 
 - (id)initWithOutlineView:(NSOutlineView *)outlineView playlist:(playlist_t *)pl rootItem:(playlist_item_t *)root playlistObject:(id)plObj;
 {
     return nil;
 }
 
+#pragma mark -
+#pragma mark Core events
 
 - (void)addItem:(int)i_item withParentNode:(int)i_node
 {
         [_outlineView reloadItem:o_parent reloadChildren:YES];
 }
 
+- (void)updateItem:(input_item_t *)p_input_item
+{
+    PL_LOCK;
+    playlist_item_t *pl_item = playlist_ItemGetByInput(p_playlist, p_input_item);
+    if (!pl_item) {
+        PL_UNLOCK;
+        return;
+    }
+    PLItem *item = [self findItemByPlaylistId:pl_item->i_id];
+    PL_UNLOCK;
+
+    if (!item)
+        return;
+
+    NSInteger row = [_outlineView rowForItem:item];
+    if (row == -1)
+        return;
+
+    [_outlineView reloadDataForRowIndexes:[NSIndexSet indexSetWithIndex:row]
+                            columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[_outlineView tableColumns] count])]];
+
+}
+
 - (PLItem *)currentlyPlayingItem
 {
     PLItem *item = nil;
     return item;
 }
 
+#pragma mark -
+#pragma mark Sorting / Searching
+
 - (void)sortForColumn:(NSString *)o_column withMode:(int)i_mode
 {
     int i_column = 0;
index 4109e62bfde44b9c71f45dea077b07fd056ddc35..bbb52835b51fe8e73624d4aa6e6294ea6b93aa09 100644 (file)
@@ -159,7 +159,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 - (void)updatePlaybackPosition;
 - (void)updateName;
 - (void)updateRecordState: (BOOL)b_value;
-- (void)updateInfoandMetaPanel;
+- (void)updateMetaAndInfo;
 - (void)updateMainMenu;
 - (void)updateMainWindow;
 - (void)showMainWindow;
index 49f32bf64a766849dc5a037e243f6cb27c75e4f9..851f2298484b1ff3c7ed0abd5d6b920e92b5f90f 100644 (file)
@@ -344,7 +344,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
         case INPUT_EVENT_ITEM_INFO:
             [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMainMenu) withObject: nil waitUntilDone:NO];
             [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
-            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateInfoandMetaPanel) withObject: nil waitUntilDone:NO];
+            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateMetaAndInfo) withObject: nil waitUntilDone:NO];
             break;
         case INPUT_EVENT_BOOKMARK:
             break;
@@ -361,8 +361,6 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
 
         case INPUT_EVENT_ITEM_NAME:
             [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateName) withObject: nil waitUntilDone:NO];
-            // TODO update playlist item with new name
-//            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(playlistUpdated) withObject: nil waitUntilDone:NO];
             break;
 
         case INPUT_EVENT_AUDIO_DELAY:
@@ -1355,6 +1353,8 @@ static bool f_appExit = false;
         }
     }
 
+    [self updateMetaAndInfo];
+
     [o_mainwindow updateWindow];
     [self updateDelays];
     [self updateMainMenu];
@@ -1429,9 +1429,17 @@ static bool f_appExit = false;
     [o_mainmenu updateRecordState:b_value];
 }
 
-- (void)updateInfoandMetaPanel
+- (void)updateMetaAndInfo
 {
-    [o_playlist outlineViewSelectionDidChange:nil];
+    if (!p_current_input) {
+        [[self info] updatePanelWithItem:nil];
+        return;
+    }
+
+    input_item_t *p_input_item = input_GetItem(p_current_input);
+
+    [[[self playlist] model] updateItem:p_input_item];
+    [[self info] updatePanelWithItem:p_input_item];
 }
 
 - (void)resumeItunesPlayback:(id)sender
index ddd1d68b2b860a275f5255cd7296e98fad55353a..825f1c298ecf5e97bebb63b75a59364ef21d16ef 100644 (file)
     if (!item)
         return;
 
-    [[[VLCMain sharedInstance] info] updatePanelWithItem: [item input]];
-
     // select item
     NSInteger itemIndex = [o_outline_view rowForItem:item];
     if (itemIndex < 0) {