]> 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 02af0a034b7e73a3b08e5257603e8297e5f3ff0c..78d816eb23e84f289c70f1ea7cdad6c457e0d36c 100644 (file)
 #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>
 #import "misc.h"
 #import "intf.h"
 #import "AppleRemote.h"
@@ -133,6 +135,8 @@ static VLCSimplePrefs *_o_sharedInstance = nil;
 
     if (OSX_LION)
         [o_sprefs_win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
+    else
+        [o_intf_nativefullscreen_ckb setEnabled:NO];
 #ifndef MAC_OS_X_VERSION_10_7
     [o_intf_nativefullscreen_ckb setEnabled:NO];
 #endif
@@ -183,11 +187,11 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     }
     else if( [o_itemIdent isEqual: VLCOSDSettingToolbarIdentifier] )
     {
-        CreateToolbarItem( _NS("Subtitles & OSD"), _NS("Subtitles & On Screen Display Settings"), @"spref_cone_Subtitles_64", showOSDSettings );
+        CreateToolbarItem( _NS(SUBPIC_TITLE), _NS("Subtitles & On Screen Display Settings"), @"spref_cone_Subtitles_64", showOSDSettings );
     }
     else if( [o_itemIdent isEqual: VLCInputSettingToolbarIdentifier] )
     {
-        CreateToolbarItem( _NS("Input & Codecs"), _NS("Input & Codec settings"), @"spref_cone_Input_64", showInputSettings );
+        CreateToolbarItem( _NS(INPUT_TITLE), _NS("Input & Codec settings"), @"spref_cone_Input_64", showInputSettings );
     }
     else if( [o_itemIdent isEqual: VLCHotkeysSettingToolbarIdentifier] )
     {
@@ -228,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")];
@@ -255,6 +260,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [o_input_postproc_txt setStringValue: _NS("Post-Processing Quality")];
     [o_input_rtsp_ckb setTitle: _NS("Use RTP over RTSP (TCP)")];
     [o_input_skipLoop_txt setStringValue: _NS("Skip the loop filter for H.264 decoding")];
+    [o_input_mkv_preload_dir_ckb setTitle: _NS("Preload MKV files in the same directory")];
 
     /* interface */
     [o_intf_style_txt setStringValue: _NS("Interface style")];
@@ -271,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")];
@@ -430,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 );
 }
 
@@ -479,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"];
 
@@ -559,13 +587,15 @@ 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"];
 
     [self setupButton: o_input_rtsp_ckb forBoolValue: "rtsp-tcp"];
     [self setupButton: o_input_skipLoop_pop forIntList: "ffmpeg-skiploopfilter"];
 
+    [self setupButton: o_input_mkv_preload_dir_ckb forBoolValue: "mkv-preload-local-dir"];
+
     [o_input_cachelevel_pop removeAllItems];
     [o_input_cachelevel_pop addItemsWithTitles:
         [NSArray arrayWithObjects: _NS("Custom"), _NS("Lowest latency"), _NS("Low latency"), _NS("Normal"),
@@ -617,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"];
 
@@ -792,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" );
@@ -830,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" );
@@ -892,12 +926,22 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
         config_PutInt( p_intf, "rtsp-tcp", [o_input_rtsp_ckb state] );
         SaveIntList( o_input_skipLoop_pop, "ffmpeg-skiploopfilter" );
 
+        config_PutInt( p_intf, "mkv-preload-local-dir", [o_input_mkv_preload_dir_ckb state] );
+
         #define CaCi( name, int ) config_PutInt( p_intf, name, int * [[o_input_cachelevel_pop selectedItem] tag] )
         #define CaC( name ) CaCi( name, 1 )
-        msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] );
-        CaC( "network-caching" );
-        CaC( "disc-caching" );
-        CaC( "live-caching" );
+        if ( [[o_input_cachelevel_pop selectedItem] tag] == 0 )
+        {
+            msg_Dbg( p_intf, "Custom chosen, not adjusting cache values" );
+        }
+        else
+        {
+            msg_Dbg( p_intf, "Adjusting all cache values to: %i", (int)[[o_input_cachelevel_pop selectedItem] tag] );
+            CaC( "file-caching" );
+            CaC( "network-caching" );
+            CaC( "disc-caching" );
+            CaC( "live-caching" );
+        }
         b_inputSettingChanged = NO;
     }
 
@@ -1012,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;
 }
 
@@ -1081,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" );