]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/simple_prefs.m
macosx: make sure that all the tooltips in the sprefs panel are actually displayed...
[vlc] / modules / gui / macosx / simple_prefs.m
index 445d4c7ccbbbcb5fbba646f77e9c97202f586475..78d816eb23e84f289c70f1ea7cdad6c457e0d36c 100644 (file)
@@ -29,6 +29,7 @@
 #import "prefs.h"
 #import <vlc_keys.h>
 #import <vlc_interface.h>
+#import <vlc_aout_intf.h>
 #import <vlc_dialog.h>
 #import <vlc_modules.h>
 #import <vlc_config_cat.h>
@@ -231,7 +232,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [o_audio_lastuser_txt setStringValue: _NS("User name")];
     [o_audio_spdif_ckb setTitle: _NS("Use S/PDIF when available")];
     [o_audio_visual_txt setStringValue: _NS("Visualization")];
-    [o_audio_vol_txt setStringValue: _NS("Default Volume")];
+    [o_audio_autosavevol_yes_bcell setTitle: _NS("Keep audio level between sessions")];
+    [o_audio_autosavevol_no_bcell setTitle: _NS("Always reset audio start level to:")];
 
     /* hotkeys */
     [o_hotkeys_change_btn setTitle: _NS("Change")];
@@ -275,6 +277,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [o_intf_update_ckb setTitle: _NS("Automatically check for updates")];
     [o_intf_last_update_lbl setStringValue: @""];
     [o_intf_enableGrowl_ckb setTitle: _NS("Enable Growl notifications (on playlist item change)")];
+    [o_intf_autoresize_ckb setTitle: _NS("Resize interface to the native video size")];
+    [o_intf_pauseminimized_ckb setTitle: _NS("Pause the video playback when minimized")];
 
     /* Subtitles and OSD */
     [o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
@@ -434,14 +438,14 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
 - (void)setupButton: (NSButton *)object forBoolValue: (const char *)name
 {
     [object setState: config_GetInt( p_intf, name )];
-    [object setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, name )]];
+    [object setToolTip: _NS(config_GetLabel( p_intf, name ) ?: "")];
 }
 
 - (void)setupField:(NSTextField *)o_object forOption:(const char *)psz_option
 {
     char *psz_tmp = config_GetPsz( p_intf, psz_option );
     [o_object setStringValue: [NSString stringWithUTF8String: psz_tmp ?: ""]];
-    [o_object setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, psz_option )]];
+    [o_object setToolTip: _NS(config_GetLabel( p_intf, psz_option ))];
     free( psz_tmp );
 }
 
@@ -483,16 +487,36 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
         [o_intf_style_dark_bcell setState: NO];
         [o_intf_style_bright_bcell setState: YES];
     }
+    [self setupButton: o_intf_autoresize_ckb forBoolValue: "macosx-video-autoresize"];
+    [self setupButton: o_intf_pauseminimized_ckb forBoolValue: "macosx-pause-minimized"];
 
     /******************
      * audio settings *
      ******************/
     [self setupButton: o_audio_enable_ckb forBoolValue: "audio"];
-    i = config_GetInt( p_intf, "volume" );
-    [o_audio_vol_fld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "volume")]];
-    [o_audio_vol_fld setIntValue: i];
-    [o_audio_vol_sld setToolTip: [o_audio_vol_fld toolTip]];
-    [o_audio_vol_sld setIntValue: i];
+
+    if ( config_GetInt( p_intf, "macosx-autosave-volume" ))
+    {
+        [o_audio_autosavevol_yes_bcell setState: NSOnState];
+        [o_audio_autosavevol_no_bcell setState: NSOffState];
+        [o_audio_vol_fld setEnabled: NO];
+        [o_audio_vol_sld setEnabled: NO];
+
+        [o_audio_vol_sld setIntValue: 100];
+        [o_audio_vol_fld setIntValue: 100];
+    }
+    else
+    {
+        [o_audio_autosavevol_yes_bcell setState: NSOffState];
+        [o_audio_autosavevol_no_bcell setState: NSOnState];
+        [o_audio_vol_fld setEnabled: YES];
+        [o_audio_vol_sld setEnabled: YES];
+
+        i = config_GetInt( p_intf, "volume" );
+        i = i * 200 / AOUT_VOLUME_MAX;
+        [o_audio_vol_sld setIntValue: i];
+        [o_audio_vol_fld setIntValue: i];
+    }
 
     [self setupButton: o_audio_spdif_ckb forBoolValue: "spdif"];
 
@@ -563,7 +587,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
     [self setupField: o_input_httpproxy_fld forOption:"http-proxy"];
     [self setupField: o_input_httpproxypwd_sfld forOption:"http-proxy-pwd"];
     [o_input_postproc_fld setIntValue: config_GetInt( p_intf, "postproc-q")];
-    [o_input_postproc_fld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "postproc-q")]];
+    [o_input_postproc_fld setToolTip: _NS(config_GetLabel( p_intf, "postproc-q"))];
 
     [self setupButton: o_input_avi_pop forIntList: "avi-index"];
 
@@ -623,7 +647,7 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
     i = config_GetInt( p_intf, "freetype-opacity" );
     [o_osd_opacity_fld setIntValue: i];
     [o_osd_opacity_sld setIntValue: i];
-    [o_osd_opacity_sld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "freetype-opacity")]];
+    [o_osd_opacity_sld setToolTip: _NS(config_GetLabel( p_intf, "freetype-opacity"))];
     [o_osd_opacity_fld setToolTip: [o_osd_opacity_sld toolTip]];
     [self setupButton: o_osd_forcebold_ckb forBoolValue: "freetype-bold"];
 
@@ -798,6 +822,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] );
         config_PutInt( p_intf, "macosx-interfacestyle", [o_intf_style_dark_bcell state] );
         config_PutInt( p_intf, "macosx-nativefullscreenmode", [o_intf_nativefullscreen_ckb state] );
+        config_PutInt( p_intf, "macosx-pause-minimized", [o_intf_pauseminimized_ckb state] );
+        config_PutInt( p_intf, "macosx-video-autoresize", [o_intf_autoresize_ckb state] );
         if( [o_intf_enableGrowl_ckb state] == NSOnState )
         {
             tmpString = getString( "control" );
@@ -836,7 +862,9 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
     if( b_audioSettingChanged )
     {
         config_PutInt( p_intf, "audio", [o_audio_enable_ckb state] );
-        config_PutInt( p_intf, "volume", [o_audio_vol_sld intValue]);
+        if( [o_audio_vol_fld isEnabled] )
+            config_PutInt( p_intf, "volume", [o_audio_vol_fld intValue] * AOUT_VOLUME_MAX / 200 );
+        config_PutInt( p_intf, "macosx-autosave-volume", [o_audio_autosavevol_yes_bcell state] );
         config_PutInt( p_intf, "spdif", [o_audio_spdif_ckb state] );
 
         SaveIntList( o_audio_dolby_pop, "force-dolby-surround" );
@@ -1028,6 +1056,13 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         }
     }
 
+    if( sender == o_audio_autosavevol_matrix )
+    {
+        BOOL enableVolumeSlider = [o_audio_autosavevol_matrix selectedTag] == 1;
+        [o_audio_vol_fld setEnabled: enableVolumeSlider];
+        [o_audio_vol_sld setEnabled: enableVolumeSlider];
+    }
+
     b_audioSettingChanged = YES;
 }
 
@@ -1097,6 +1132,28 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
     [self showSettingsForCategory: o_osd_view];
 }
 
+- (void)controlTextDidChange:(NSNotification *)o_notification
+{
+    id notificationObject = [o_notification object];
+    if( notificationObject == o_audio_lang_fld ||
+       notificationObject ==  o_audio_lastpwd_sfld ||
+       notificationObject ==  o_audio_lastuser_fld ||
+       notificationObject == o_audio_vol_fld )
+        b_audioSettingChanged = YES;
+    else if( notificationObject == o_input_record_fld ||
+             notificationObject == o_input_httpproxy_fld ||
+            notificationObject == o_input_httpproxypwd_sfld ||
+            notificationObject == o_input_postproc_fld )
+        b_inputSettingChanged = YES;
+    else if( notificationObject == o_osd_font_fld ||
+            notificationObject == o_osd_lang_fld ||
+            notificationObject == o_osd_opacity_fld)
+        b_osdSettingChanged = YES;
+    else if( notificationObject == o_video_snap_folder_fld ||
+            notificationObject == o_video_snap_prefix_fld )
+        b_videoSettingChanged = YES;
+}
+
 - (IBAction)showFontPicker:(id)sender
 {
     char * font = config_GetPsz( p_intf, "freetype-font" );