Commit 0b300bd1 authored by Faustino Osuna's avatar Faustino Osuna

MacOSX/Framework/Examples/test/Controller.m: Updated example to comply with...

MacOSX/Framework/Examples/test/Controller.m: Updated example to comply with latest framework improvements.
parent 45400df9
...@@ -22,7 +22,7 @@ static void *sleepForMe(void) ...@@ -22,7 +22,7 @@ static void *sleepForMe(void)
[videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable]; [videoView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
playlist = [[VLCMediaList alloc] init]; playlist = [[VLCMediaList alloc] init];
[playlist setDelegate:self]; [playlist addObserver:self forKeyPath:@"media" options:NSKeyValueObservingOptionNew context:nil];
player = [[VLCMediaPlayer alloc] initWithVideoView:videoView]; player = [[VLCMediaPlayer alloc] initWithVideoView:videoView];
mediaIndex = -1; mediaIndex = -1;
...@@ -37,6 +37,8 @@ static void *sleepForMe(void) ...@@ -37,6 +37,8 @@ static void *sleepForMe(void)
- (void)applicationWillTerminate:(NSNotification *)aNotification - (void)applicationWillTerminate:(NSNotification *)aNotification
{ {
[playlist removeObserver:self forKeyPath:@"media"];
[player pause]; [player pause];
[player setMedia:nil]; [player setMedia:nil];
[player release]; [player release];
...@@ -44,7 +46,6 @@ static void *sleepForMe(void) ...@@ -44,7 +46,6 @@ static void *sleepForMe(void)
[videoView release]; [videoView release];
} }
- (void)changeAndPlay:(id)sender - (void)changeAndPlay:(id)sender
{ {
if ([playlistOutline selectedRow] != mediaIndex) if ([playlistOutline selectedRow] != mediaIndex)
...@@ -82,15 +83,11 @@ static void *sleepForMe(void) ...@@ -82,15 +83,11 @@ static void *sleepForMe(void)
[player pause]; [player pause];
} }
// - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
- (void)mediaList:(VLCMediaList *)mediaList mediaAdded:(VLCMedia *)media atIndex:(int)index
{
[playlistOutline reloadData];
}
- (void)mediaList:(VLCMediaList *)mediaList mediaRemoved:(VLCMedia *)media atIndex:(int)index
{ {
if ([keyPath isEqualToString:@"media"] && object == playlist) {
[playlistOutline reloadData]; [playlistOutline reloadData];
}
} }
// NSTableView Implementation // NSTableView Implementation
...@@ -102,7 +99,7 @@ static void *sleepForMe(void) ...@@ -102,7 +99,7 @@ static void *sleepForMe(void)
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row row:(int)row
{ {
return [[playlist mediaAtIndex:row] description]; return [(VLCMedia *)[playlist mediaAtIndex:row].metaDictionary valueForKey:VLCMetaInformationTitle];
} }
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info - (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info
......
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