Commit ccaf6ed7 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/VLC_app: Fix the various bindings. And binds the various media control buttons.

parent 096ebc37
...@@ -31,22 +31,14 @@ ...@@ -31,22 +31,14 @@
* VLCMediaDiscoverer (CategoriesListBindings) * VLCMediaDiscoverer (CategoriesListBindings)
*/ */
@implementation VLCMediaDiscoverer (CategoriesListBindings) @implementation VLCMediaDiscoverer (CategoriesListBindings)
+(void)initialize + (NSSet *)keyPathsForValuesAffectingCurrentlyFetchingItems
{ {
[VLCMediaDiscoverer setKeys:[NSArray arrayWithObject:@"running"] triggerChangeNotificationsForDependentKey:@"currentlyFetchingItems"]; return [NSSet setWithObject:@"running"];
} }
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key + (NSSet *)keyPathsForValuesAffectingChildrenInCategoriesListForDetailView
{ {
/* Thanks to Julien Robert, we'll have some nice auto triggered KVO event from here */ return [NSSet setWithObject:@"discoveredMedia.flatAspect"];
static NSDictionary * dict = nil;
if( !dict )
{
dict = [[NSDictionary dictionaryWithObjectsAndKeys:
[NSSet setWithObject:@"discoveredMedia.flatAspect"], @"childrenInCategoriesListForDetailView",
nil] retain];
}
return [dict objectForKey: key];
} }
/* General shortcuts */ /* General shortcuts */
...@@ -106,21 +98,25 @@ ...@@ -106,21 +98,25 @@
*/ */
@implementation VLCMedia (VLCAppBindings) @implementation VLCMedia (VLCAppBindings)
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key + (NSSet *)keyPathsForValuesAffectingChildrenInCategoriesList
{ {
/* Thanks to Julien Robert, we'll have some nice auto triggered KVO event from here */ return [NSSet setWithObject:@"subitems.hierarchicalNodeAspect.media"];
static NSDictionary * dict = nil; }
if( !dict ) + (NSSet *)keyPathsForValuesAffectingDescriptionInCategoriesList
{ {
dict = [[NSDictionary dictionaryWithObjectsAndKeys: return [NSSet setWithObject:@"metaDictionary.title"];
[NSSet setWithObject:@"subitems.hierarchicalNodeAspect.media"], @"childrenInCategoriesList", }
[NSSet setWithObject:@"metaDictionary.title"], @"descriptionInCategoriesList", + (NSSet *)keyPathsForValuesAffectingChildrenInCategoriesListForDetailView
[NSSet setWithObject:@"subitems.flatAspect"], @"childrenInCategoriesListForDetailView", {
[NSSet setWithObject:@"metaDictionary.title"], @"descriptionInVideoView", return [NSSet setWithObject:@"subitems.flatAspect"];
[NSSet setWithObject:@"state"], @"stateAsImage", }
nil] retain]; + (NSSet *)keyPathsForValuesAffectingChildrenInDescriptionInVideoView
} {
return [dict objectForKey: key]; return [NSSet setWithObject:@"metaDictionary.title"];
}
+ (NSSet *)keyPathsForValuesAffectingStateAsImage
{
return [NSSet setWithObject:@"state"];
} }
/* CategoriesList specific bindings */ /* CategoriesList specific bindings */
...@@ -193,9 +189,17 @@ ...@@ -193,9 +189,17 @@
@end @end
@implementation VLCMediaPlayer (VLCAppBindings) @implementation VLCMediaPlayer (VLCAppBindings)
+ (void)initialize + (NSSet *)keyPathsForValuesAffectingDescription
{
return [NSSet setWithObjects:@"playing", @"media", nil];
}
+ (NSSet *)keyPathsForValuesAffectingStateAsButtonImage
{ {
[self setKeys:[NSArray arrayWithObjects:@"playing", @"media", nil] triggerChangeNotificationsForDependentKey:@"description"]; return [NSSet setWithObjects:@"state", @"playing", @"canPause", nil];
}
+ (NSSet *)keyPathsForValuesAffectingStateAsButtonAlternateImage
{
return [NSSet setWithObjects:@"state", @"playing", @"canPause", nil];
} }
- (NSString *)description - (NSString *)description
...@@ -205,4 +209,24 @@ ...@@ -205,4 +209,24 @@
else else
return @"VLC Media Player"; return @"VLC Media Player";
} }
- (NSImage *)stateAsButtonImage
{
if([self state] == VLCMediaPlayerStatePlaying && [self canPause])
return [NSImage imageNamed:@"pause.png"];
else if( [self state] == VLCMediaPlayerStatePlaying )
return [NSImage imageNamed:@"stop.png"];
else
return [NSImage imageNamed:@"play.png"];
}
- (NSImage *)stateAsButtonAlternateImage
{
if([self state] == VLCMediaPlayerStatePlaying && [self canPause])
return [NSImage imageNamed:@"pause_blue.png"];
else if( [self state] == VLCMediaPlayerStatePlaying )
return [NSImage imageNamed:@"stop_blue.png"];
else
return [NSImage imageNamed:@"play_blue.png"];
}
@end @end
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
IBOutlet NSSlider * mediaSoundVolume; IBOutlet NSSlider * mediaSoundVolume;
IBOutlet NSButton * mediaPlayerForwardNextButton;
IBOutlet NSButton * mediaPlayerBackwardPrevButton;
IBOutlet NSButton * mediaPlayerPlayPauseStopButton;
IBOutlet id navigatorViewToggleButton; IBOutlet id navigatorViewToggleButton;
IBOutlet VLCOneSplitView * mainSplitView; IBOutlet VLCOneSplitView * mainSplitView;
IBOutlet NSView * navigatorView; IBOutlet NSView * navigatorView;
......
...@@ -211,8 +211,8 @@ ...@@ -211,8 +211,8 @@
[fillScreenButton bind:@"value" toObject:videoView withKeyPath:@"fillScreen" options: nil]; [fillScreenButton bind:@"value" toObject:videoView withKeyPath:@"fillScreen" options: nil];
[fullScreenButton bind:@"value" toObject:videoView withKeyPath:@"fullScreen" options: nil]; [fullScreenButton bind:@"value" toObject:videoView withKeyPath:@"fullScreen" options: nil];
[fullScreenButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"playing" options: nil]; [fullScreenButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];
[fillScreenButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"playing" options: nil]; [fillScreenButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];
[mediaReadingProgressSlider bind:@"enabled" toObject:mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]]; [mediaReadingProgressSlider bind:@"enabled" toObject:mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];
[mediaReadingProgressSlider bind:@"enabled2" toObject:mediaPlayer withKeyPath:@"seekable" options: nil]; [mediaReadingProgressSlider bind:@"enabled2" toObject:mediaPlayer withKeyPath:@"seekable" options: nil];
...@@ -239,6 +239,20 @@ ...@@ -239,6 +239,20 @@
/* Sound */ /* Sound */
[mediaSoundVolume bind:@"value" toObject:[VLCLibrary sharedLibrary] withKeyPath:@"audio.volume" options: nil]; [mediaSoundVolume bind:@"value" toObject:[VLCLibrary sharedLibrary] withKeyPath:@"audio.volume" options: nil];
/* mediaPlayer */
[mediaPlayerPlayPauseStopButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"media" options: [NSDictionary dictionaryWithObject:@"NonNilAsBoolTransformer" forKey:NSValueTransformerNameBindingOption]];
[mediaPlayerPlayPauseStopButton bind:@"state" toObject:mediaPlayer withKeyPath:@"playing" options: nil];
[mediaPlayerPlayPauseStopButton bind:@"alternateImage" toObject:mediaPlayer withKeyPath:@"stateAsButtonAlternateImage" options: nil];
[mediaPlayerPlayPauseStopButton bind:@"image" toObject:mediaPlayer withKeyPath:@"stateAsButtonImage" options: nil];
[mediaPlayerBackwardPrevButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"playing" options: nil];
[mediaPlayerForwardNextButton bind:@"enabled" toObject:mediaPlayer withKeyPath:@"playing" options: nil];
[mediaPlayerForwardNextButton setTarget:mediaPlayer];
[mediaPlayerForwardNextButton setAction:@selector(fastForward)];
[mediaPlayerBackwardPrevButton setTarget:mediaPlayer];
[mediaPlayerBackwardPrevButton setAction:@selector(rewind)];
[mediaPlayerPlayPauseStopButton setTarget:mediaPlayer];
[mediaPlayerPlayPauseStopButton setAction:@selector(pause)];
/* Last minute setup */ /* Last minute setup */
[categoriesListView expandItem:nil expandChildren:YES]; [categoriesListView expandItem:nil expandChildren:YES];
[categoriesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[categoriesListView numberOfRows] > 0 ? [categoriesListView numberOfRows]-1 : 0] byExtendingSelection:NO]; [categoriesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[categoriesListView numberOfRows] > 0 ? [categoriesListView numberOfRows]-1 : 0] byExtendingSelection:NO];
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
632F3C380D31711C003BBC56 /* VLCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 632F3C230D316F37003BBC56 /* VLCKit.framework */; }; 632F3C380D31711C003BBC56 /* VLCKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 632F3C230D316F37003BBC56 /* VLCKit.framework */; };
632F3E260D326FF0003BBC56 /* pause.png in Resources */ = {isa = PBXBuildFile; fileRef = 632F3E250D326FF0003BBC56 /* pause.png */; };
633BD4BC0D2A90470012A314 /* VLCValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AA0D2A90470012A314 /* VLCValueTransformer.m */; }; 633BD4BC0D2A90470012A314 /* VLCValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AA0D2A90470012A314 /* VLCValueTransformer.m */; };
633BD4BD0D2A90470012A314 /* VLCMediaArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AC0D2A90470012A314 /* VLCMediaArrayController.m */; }; 633BD4BD0D2A90470012A314 /* VLCMediaArrayController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AC0D2A90470012A314 /* VLCMediaArrayController.m */; };
633BD4BE0D2A90470012A314 /* VLCMainWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AD0D2A90470012A314 /* VLCMainWindow.m */; }; 633BD4BE0D2A90470012A314 /* VLCMainWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 633BD4AD0D2A90470012A314 /* VLCMainWindow.m */; };
...@@ -68,28 +69,28 @@ ...@@ -68,28 +69,28 @@
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */; containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */;
proxyType = 2; proxyType = 2;
remoteGlobalIDString = 8DC2EF5B0486A6940098B216 /* VLCKit.framework */; remoteGlobalIDString = 8DC2EF5B0486A6940098B216;
remoteInfo = VLCKit; remoteInfo = VLCKit;
}; };
632F3C250D316FAD003BBC56 /* PBXContainerItemProxy */ = { 632F3C250D316FAD003BBC56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */; containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */;
proxyType = 1; proxyType = 1;
remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* VLCKit */; remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = VLCKit; remoteInfo = VLCKit;
}; };
632F3C270D316FB5003BBC56 /* PBXContainerItemProxy */ = { 632F3C270D316FB5003BBC56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1; proxyType = 1;
remoteGlobalIDString = 8D1107260486CEB800E47090 /* VLC */; remoteGlobalIDString = 8D1107260486CEB800E47090;
remoteInfo = VLC; remoteInfo = VLC;
}; };
632F3CC50D318E3A003BBC56 /* PBXContainerItemProxy */ = { 632F3CC50D318E3A003BBC56 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy; isa = PBXContainerItemProxy;
containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */; containerPortal = 633BD69D0D2ACE520012A314 /* VLCKit.xcodeproj */;
proxyType = 1; proxyType = 1;
remoteGlobalIDString = 633BD6D20D2ADE040012A314 /* vlc-contrib-core-framework */; remoteGlobalIDString = 633BD6D20D2ADE040012A314;
remoteInfo = "vlc-contrib-core-framework"; remoteInfo = "vlc-contrib-core-framework";
}; };
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
...@@ -103,6 +104,7 @@ ...@@ -103,6 +104,7 @@
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* VLC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLC_Prefix.pch; sourceTree = "<group>"; }; 32CA4F630368D1EE00C91783 /* VLC_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLC_Prefix.pch; sourceTree = "<group>"; };
632F3E250D326FF0003BBC56 /* pause.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = pause.png; path = ../Resources/pause.png; sourceTree = SOURCE_ROOT; };
633BD4AA0D2A90470012A314 /* VLCValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCValueTransformer.m; path = Sources/VLCValueTransformer.m; sourceTree = "<group>"; }; 633BD4AA0D2A90470012A314 /* VLCValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCValueTransformer.m; path = Sources/VLCValueTransformer.m; sourceTree = "<group>"; };
633BD4AB0D2A90470012A314 /* VLCValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCValueTransformer.h; path = Sources/VLCValueTransformer.h; sourceTree = "<group>"; }; 633BD4AB0D2A90470012A314 /* VLCValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCValueTransformer.h; path = Sources/VLCValueTransformer.h; sourceTree = "<group>"; };
633BD4AC0D2A90470012A314 /* VLCMediaArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaArrayController.m; path = Sources/VLCMediaArrayController.m; sourceTree = "<group>"; }; 633BD4AC0D2A90470012A314 /* VLCMediaArrayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCMediaArrayController.m; path = Sources/VLCMediaArrayController.m; sourceTree = "<group>"; };
...@@ -317,6 +319,7 @@ ...@@ -317,6 +319,7 @@
63E380A90D1C65A600FD6958 /* volume_low.png */, 63E380A90D1C65A600FD6958 /* volume_low.png */,
63E380AC0D1C65D100FD6958 /* play.png */, 63E380AC0D1C65D100FD6958 /* play.png */,
63E380AD0D1C65D100FD6958 /* play_blue.png */, 63E380AD0D1C65D100FD6958 /* play_blue.png */,
632F3E250D326FF0003BBC56 /* pause.png */,
63E380B00D1C65F200FD6958 /* skip_forward_active.png */, 63E380B00D1C65F200FD6958 /* skip_forward_active.png */,
63E380B10D1C65F200FD6958 /* skip_forward_blue.png */, 63E380B10D1C65F200FD6958 /* skip_forward_blue.png */,
63E380B40D1C65FC00FD6958 /* skip_previous_active.png */, 63E380B40D1C65FC00FD6958 /* skip_previous_active.png */,
...@@ -401,6 +404,7 @@ ...@@ -401,6 +404,7 @@
63874B190D25960600F738AD /* MainWindow.xib in Resources */, 63874B190D25960600F738AD /* MainWindow.xib in Resources */,
633BD4DA0D2A90C80012A314 /* dialog-error.png in Resources */, 633BD4DA0D2A90C80012A314 /* dialog-error.png in Resources */,
633BD4DB0D2A90C80012A314 /* applications-internet.png in Resources */, 633BD4DB0D2A90C80012A314 /* applications-internet.png in Resources */,
632F3E260D326FF0003BBC56 /* pause.png in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 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