[vlc-commits] macosx/CoreInteraction: modernize getters and setters API

Felix Paul Kühne git at videolan.org
Fri Aug 24 12:49:11 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri Aug 24 12:48:49 2012 +0200| [0d05deabebec3c56b7026a2d332168eb14cbf695] | committer: Felix Paul Kühne

macosx/CoreInteraction: modernize getters and setters API

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d05deabebec3c56b7026a2d332168eb14cbf695
---

 modules/gui/macosx/CoreInteraction.h |   18 +++++++-----------
 modules/gui/macosx/CoreInteraction.m |    8 ++++----
 modules/gui/macosx/MainMenu.m        |    2 +-
 modules/gui/macosx/MainWindow.m      |    6 +++---
 modules/gui/macosx/applescript.m     |    4 ++--
 modules/gui/macosx/controls.m        |    4 ++--
 6 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/modules/gui/macosx/CoreInteraction.h b/modules/gui/macosx/CoreInteraction.h
index 2865e55..0f237f0 100644
--- a/modules/gui/macosx/CoreInteraction.h
+++ b/modules/gui/macosx/CoreInteraction.h
@@ -29,6 +29,13 @@
     int i_currentPlaybackRate;
 }
 + (VLCCoreInteraction *)sharedInstance;
+ at property (readwrite) int volume;
+ at property (readwrite) int playbackRate;
+ at property (nonatomic, readwrite) BOOL aspectRatioIsLocked;
+ at property (readonly) int durationOfCurrentPlaylistItem;
+ at property (readonly) NSURL * URLOfCurrentPlaylistItem;
+ at property (readonly) NSString * nameOfCurrentPlaylistItem;
+ at property (nonatomic, readwrite) BOOL mute;
 
 - (void)play;
 - (void)pause;
@@ -37,13 +44,8 @@
 - (void)slower;
 - (void)normalSpeed;
 - (void)toggleRecord;
-- (void)setPlaybackRate:(int)i_value;
-- (int)playbackRate;
 - (void)next;
 - (void)previous;
-- (int)durationOfCurrentPlaylistItem;
-- (NSURL*)URLOfCurrentPlaylistItem;
-- (NSString*)nameOfCurrentPlaylistItem;
 - (void)forward;        //LEGACY SUPPORT
 - (void)backward;       //LEGACY SUPPORT
 - (void)forwardExtraShort;
@@ -62,15 +64,9 @@
 
 - (void)volumeUp;
 - (void)volumeDown;
-- (void)mute;
-- (BOOL)isMuted;
-- (int)volume;
-- (void)setVolume:(int)i_value;
 
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
 
-- (void)setAspectRatioLocked:(BOOL)b_value;
-- (BOOL)aspectRatioIsLocked;
 - (void)toggleFullscreen;
 
 - (BOOL)fixPreferences;
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 8d778fd..cb79dbf 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -446,16 +446,16 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
     aout_VolumeDown( pl_Get( p_intf ), 1, NULL );
 }
 
-- (void)mute
+- (void)setMute:(BOOL)b_value
 {
     intf_thread_t *p_intf = VLCIntf;
     if( !p_intf )
         return;
 
-    aout_MuteToggle( pl_Get( p_intf ) );
+    aout_MuteSet( pl_Get( p_intf ), b_value );
 }
 
-- (BOOL)isMuted
+- (BOOL)mute
 {
     intf_thread_t *p_intf = VLCIntf;
     if( !p_intf )
@@ -544,7 +544,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
 #pragma mark -
 #pragma mark video output stuff
 
-- (void)setAspectRatioLocked:(BOOL)b_value
+- (void)setAspectRatioIsLocked:(BOOL)b_value
 {
     config_PutInt( VLCIntf, "macosx-lock-aspect-ratio", b_value );
 }
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index aa31ca9..bbb9855 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -1293,7 +1293,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
     }
     else if( [o_title isEqualToString: _NS("Mute")] )
     {
-        [o_mi setState: [[VLCCoreInteraction sharedInstance] isMuted] ? NSOnState : NSOffState];
+        [o_mi setState: [[VLCCoreInteraction sharedInstance] mute] ? NSOnState : NSOffState];
         [self setupMenus]; /* Make sure audio menu is up to date */
     }
     else if( [o_title isEqualToString: _NS("Half Size")] ||
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
index c9204da..5b75916 100644
--- a/modules/gui/macosx/MainWindow.m
+++ b/modules/gui/macosx/MainWindow.m
@@ -329,7 +329,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [o_play_btn setAlternateImage: o_play_pressed_img];
     [o_detached_play_btn setImage: o_play_img];
     [o_detached_play_btn setAlternateImage: o_play_pressed_img];
-    BOOL b_mute = ![[VLCCoreInteraction sharedInstance] isMuted];
+    BOOL b_mute = ![[VLCCoreInteraction sharedInstance] mute];
     [o_volume_sld setEnabled: b_mute];
     [o_volume_up_btn setEnabled: b_mute];
 
@@ -1207,7 +1207,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
         [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
     else if (sender == o_volume_down_btn)
     {
-        [[VLCCoreInteraction sharedInstance] mute];
+        [[VLCCoreInteraction sharedInstance] setMute: YES];
     }
     else
         [[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
@@ -1593,7 +1593,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
 {
     playlist_t * p_playlist = pl_Get( VLCIntf );
     int i_volume = lroundf(aout_VolumeGet( p_playlist ) * AOUT_VOLUME_DEFAULT);
-    BOOL b_muted = [[VLCCoreInteraction sharedInstance] isMuted];
+    BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
 
     if( !b_muted )
     {
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index e9f4b6e..d178346 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -118,7 +118,7 @@
     }
     else if ( [o_command isEqualToString:@"mute"] )
     {
-        [[VLCCoreInteraction sharedInstance] mute];
+        [[VLCCoreInteraction sharedInstance] setMute: YES];
     }
     else if ( [o_command isEqualToString:@"volumeUp"] )
     {
@@ -220,7 +220,7 @@
 }
 
 - (BOOL) muted {
-    return [[VLCCoreInteraction sharedInstance] isMuted];
+    return [[VLCCoreInteraction sharedInstance] mute];
 }
 
 - (BOOL) playing {
diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m
index a2b5a93..a66178a 100644
--- a/modules/gui/macosx/controls.m
+++ b/modules/gui/macosx/controls.m
@@ -146,7 +146,7 @@
 
 - (IBAction)mute:(id)sender
 {
-    [[VLCCoreInteraction sharedInstance] mute];
+    [[VLCCoreInteraction sharedInstance] setMute: YES];
 }
 
 - (IBAction)volumeSliderUpdated:(id)sender
@@ -209,7 +209,7 @@
 
 - (IBAction)lockVideosAspectRatio:(id)sender
 {
-    [[VLCCoreInteraction sharedInstance] setAspectRatioLocked: ![sender state]];
+    [[VLCCoreInteraction sharedInstance] setAspectRatioIsLocked: ![sender state]];
     [sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
 }
 



More information about the vlc-commits mailing list