]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/controls.m
Qt: don't check if a variable is a command. This will show radio buttons for zzom...
[vlc] / modules / gui / macosx / controls.m
index b58006642ca96c0ced391a53c24123958a9576a4..826d89a852a5dad3329a409d7f7a79e0a7123a22 100644 (file)
 
 - (IBAction)play:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
     playlist_t * p_playlist = pl_Yield( p_intf );
 
         vlc_object_release( p_playlist );
     }
 
-    val.i_int = config_GetInt( p_intf, "key-play-pause" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
 }
 
 /* Small helper method */
 
 - (IBAction)stop:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-stop" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_STOP );
     /* Close the window directly, because we do know that there
      * won't be anymore video. It's currently waiting a bit. */
     [[[self getVoutView] window] orderOut:self];
 
 - (IBAction)faster:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-faster" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_FASTER );
 }
 
 - (IBAction)slower:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-slower" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_SLOWER );
 }
 
 - (IBAction)prev:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-prev" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PREV );
 }
 
 - (IBAction)next:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-next" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_NEXT );
 }
 
 - (IBAction)random:(id)sender
 
 - (IBAction)forward:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-jump+short" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT );
 }
 
 - (IBAction)backward:(id)sender
 {
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-jump-short" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT );
 }
 
 
 - (IBAction)volumeUp:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-vol-up" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
     /* Manage volume status */
     [o_main manageVolumeSlider];
 }
 
 - (IBAction)volumeDown:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-vol-down" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
     /* Manage volume status */
     [o_main manageVolumeSlider];
 }
 
 - (IBAction)mute:(id)sender
 {
-    vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
-    val.i_int = config_GetInt( p_intf, "key-vol-mute" );
-    var_Set( p_intf->p_libvlc, "key-pressed", val );
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_MUTE );
     /* Manage volume status */
     [o_main manageVolumeSlider];
 }
                                              FIND_ANYWHERE );
     if( p_vout != NULL )
     {
-        vlc_value_t val;
         intf_thread_t * p_intf = VLCIntf;
-        val.i_int = config_GetInt( p_intf, "key-position" );
-        var_Set( p_intf, "key-pressed", val );
+        var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_POSITION );
         vlc_object_release( (vlc_object_t *)p_vout );
     }
 }
             }
             else
             {
+                /* Fullscreen state for next time will be saved here too */
                 [o_vout_view toggleFullscreen];
             }
         }
             var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
         }
 
-        vlc_object_release( p_playlist );
+        pl_Release( VLCIntf );
     }
 
 }
     }
     else if( sender == o_specificTime_ok_btn )
     {
-        input_thread_t * p_input = (input_thread_t *)vlc_object_find( VLCIntf, \
-            VLC_OBJECT_INPUT, FIND_ANYWHERE );
+        input_thread_t * p_input = pl_CurrentInput( VLCIntf );
         if( p_input )
         {
             unsigned int timeInSec = 0;
             input_Control( p_input, INPUT_SET_TIME, (int64_t)(timeInSec * 1000000));
             vlc_object_release( p_input );
         }
+
         [NSApp endSheet: o_specificTime_win];
         [o_specificTime_win close];
     }
     else
     {
-        input_thread_t * p_input = (input_thread_t *)vlc_object_find( VLCIntf, \
-            VLC_OBJECT_INPUT, FIND_ANYWHERE );
+        input_thread_t * p_input = pl_CurrentInput( VLCIntf );
         if( p_input )
         {
             /* we can obviously only do that if an input is available */
     vlc_value_t val;
     intf_thread_t * p_intf = VLCIntf;
     playlist_t * p_playlist = pl_Yield( p_intf );
-
-    vlc_object_lock( p_playlist );
-
-#define p_input p_playlist->p_input
+    input_thread_t * p_input = playlist_CurrentInput( p_playlist );
 
     if( [[o_mi title] isEqualToString: _NS("Faster")] ||
         [[o_mi title] isEqualToString: _NS("Slower")] )
              [[o_mi title] isEqualToString: _NS("Next")] )
     {
         /** \todo fix i_size use */
+        PL_LOCK;
         bEnabled = p_playlist->items.i_size > 1;
+        PL_UNLOCK;
     }
     else if( [[o_mi title] isEqualToString: _NS("Random")] )
     {
                     break;
                 }
             }
+
             vlc_object_release( (vlc_object_t *)p_vout );
         }
-        else if( [[o_mi title] isEqualToString: _NS("Fullscreen")] )
+        if( [[o_mi title] isEqualToString: _NS("Fullscreen")] )
         {
             var_Get( p_playlist, "fullscreen", &val );
             [o_mi setState: val.b_bool];
         [o_main setupMenus]; /* Make sure video menu is up to date */
     }
 
-    vlc_object_unlock( p_playlist );
+    if( p_input ) vlc_object_release( p_input );
     vlc_object_release( p_playlist );
 
     return( bEnabled );