Commit 5472238d authored by David Fuhrmann's avatar David Fuhrmann

macosx: playlist: catch update events for metadata and info

Playlist view gets updated to display new information.
Info dialog gets updates (shows only information about currently
played input at the moment).

close #13729
parent 029607c3
......@@ -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;
......
......@@ -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;
{
......@@ -147,6 +149,8 @@
return nil;
}
#pragma mark -
#pragma mark Core events
- (void)addItem:(int)i_item withParentNode:(int)i_node
{
......@@ -201,6 +205,29 @@
[_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;
......@@ -213,6 +240,9 @@
return item;
}
#pragma mark -
#pragma mark Sorting / Searching
- (void)sortForColumn:(NSString *)o_column withMode:(int)i_mode
{
int i_column = 0;
......
......@@ -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;
......
......@@ -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
......
......@@ -346,8 +346,6 @@
if (!item)
return;
[[[VLCMain sharedInstance] info] updatePanelWithItem: [item input]];
// select item
NSInteger itemIndex = [o_outline_view rowForItem:item];
if (itemIndex < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment