[vlc-devel] commit: macosx: implemented tooltip help and fixed a connection error (last .fm-password vs snapshot-folder) ( Felix Paul Kühne )

git version control git at videolan.org
Sat Jul 25 14:43:19 CEST 2009


vlc | branch: 1.0-bugfix | Felix Paul Kühne <fkuehne at videolan.org> | Fri Jul 24 20:58:05 2009 +0200| [fb5108db888105b7fd07f89aaee5eb979ec8be15] | committer: Felix Paul Kühne 

macosx: implemented tooltip help and fixed a connection error (last.fm-password vs snapshot-folder)

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

 .../English.lproj/Preferences.nib/info.nib         |    9 ++-
 .../English.lproj/Preferences.nib/keyedobjects.nib |  Bin 94466 -> 94466 bytes
 modules/gui/macosx/simple_prefs.m                  |   81 ++++++++++++++-----
 3 files changed, 66 insertions(+), 24 deletions(-)

diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib b/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
index 1176377..e79a4ca 100644
--- a/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
+++ b/extras/package/macosx/Resources/English.lproj/Preferences.nib/info.nib
@@ -8,8 +8,12 @@
 	<dict>
 		<key>2311</key>
 		<string>345 378 590 293 0 0 1280 778 </string>
+		<key>2330</key>
+		<string>345 222 590 502 0 0 1280 778 </string>
+		<key>2440</key>
+		<string>345 306 590 389 0 0 1280 778 </string>
 		<key>2562</key>
-		<string>151 240 590 453 0 0 1280 778 </string>
+		<string>345 258 590 453 0 0 1280 778 </string>
 	</dict>
 	<key>IBFramework Version</key>
 	<string>489.0</string>
@@ -19,8 +23,9 @@
 	<integer>5</integer>
 	<key>IBOpenObjects</key>
 	<array>
-		<integer>2562</integer>
+		<integer>2440</integer>
 		<integer>2311</integer>
+		<integer>2562</integer>
 	</array>
 	<key>IBSystem Version</key>
 	<string>9L27</string>
diff --git a/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib b/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib
index 56879b4..a9250e0 100644
Binary files a/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib and b/extras/package/macosx/Resources/English.lproj/Preferences.nib/keyedobjects.nib differ
diff --git a/modules/gui/macosx/simple_prefs.m b/modules/gui/macosx/simple_prefs.m
index 2f1ac24..eb7e990 100644
--- a/modules/gui/macosx/simple_prefs.m
+++ b/modules/gui/macosx/simple_prefs.m
@@ -303,6 +303,31 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [o_sprefs_win setTitle: _NS("Preferences")];
 }
 
+/* TODO: move this part to core */
+#define config_GetLabel(a,b) __config_GetLabel(VLC_OBJECT(a),b)
+static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_name )
+{
+    module_config_t *p_config;
+
+    p_config = config_FindConfig( p_this, psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        msg_Err( p_this, "option %s does not exist", psz_name );
+        return NULL;
+    }
+
+    if ( p_config->psz_longtext )
+        return p_config->psz_longtext;
+    else if( p_config->psz_text )
+        return p_config->psz_text;
+    else
+        msg_Warn( p_this, "option %s does not include any help" );
+
+    return NULL;
+}
+
 - (void)setupButton: (NSPopUpButton *)object forStringList: (const char *)name
 {
     module_config_t *p_item;
@@ -393,10 +418,17 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [object setToolTip: _NS(p_item->psz_longtext)];
 }
 
+- (void)setupButton: (NSButton *)object forBoolValue: (const char *)name
+{
+    [object setState: config_GetInt( p_intf, name )];
+    [object setToolTip: [NSString stringWithUTF8String: 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 )]];
     free( psz_tmp );
 }
 
@@ -415,26 +447,28 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [self setupButton: o_intf_lang_pop forStringList: "language"];
     [self setupButton: o_intf_art_pop forIntList: "album-art"];
 
-    [o_intf_fspanel_ckb setState: config_GetInt( p_intf, "macosx-fspanel" )];
-    [o_intf_embedded_ckb setState: config_GetInt( p_intf, "embedded-video" )];
-	[o_intf_appleremote_ckb setState: config_GetInt( p_intf, "macosx-appleremote" )];
-	[o_intf_mediakeys_ckb setState: config_GetInt( p_intf, "macosx-mediakeys" )];
+    [self setupButton: o_intf_fspanel_ckb forBoolValue: "macosx-fspanel"];
+    [self setupButton: o_intf_embedded_ckb forBoolValue: "embedded-video"];
+	[self setupButton: o_intf_appleremote_ckb forBoolValue: "macosx-appleremote"];
+	[self setupButton: o_intf_mediakeys_ckb forBoolValue: "macosx-mediakeys"];
 
     /******************
      * audio settings *
      ******************/
-    [o_audio_enable_ckb setState: config_GetInt( p_intf, "audio" )];
+    [self setupButton: o_audio_enable_ckb forBoolValue: "audio"];
     i = (config_GetInt( p_intf, "volume" ) * 0.390625);
+    [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];
 
-    [o_audio_spdif_ckb setState: config_GetInt( p_intf, "spdif" )];
+    [self setupButton: o_audio_spdif_ckb forBoolValue: "spdif"];
 
     [self setupButton: o_audio_dolby_pop forIntList: "force-dolby-surround"];
     [self setupField: o_audio_lang_fld forOption: "audio-language"];
 
-    [o_audio_headphone_ckb setState: config_GetInt( p_intf, "headphone-dolby" )];
-    
+    [self setupButton: o_audio_headphone_ckb forBoolValue: "headphone-dolby"];
+
     psz_tmp = config_GetPsz( p_intf, "audio-filter" );
     if( psz_tmp )
     {
@@ -444,6 +478,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
         free( psz_tmp );
     }
     [o_audio_norm_fld setFloatValue: config_GetFloat( p_intf, "norm-max-level" )];
+    [o_audio_norm_fld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "norm-max-level")]];
 
     [self setupButton: o_audio_visual_pop forModuleList: "audio-visual"];
 
@@ -472,11 +507,11 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     /******************
      * video settings *
      ******************/
-    [o_video_enable_ckb setState: config_GetInt( p_intf, "video" )];
-    [o_video_fullscreen_ckb setState: config_GetInt( p_intf, "fullscreen" )];
-    [o_video_onTop_ckb setState: config_GetInt( p_intf, "video-on-top" )];
-    [o_video_skipFrames_ckb setState: config_GetInt( p_intf, "skip-frames" )];
-    [o_video_black_ckb setState: config_GetInt( p_intf, "macosx-black" )];
+    [self setupButton: o_video_enable_ckb forBoolValue: "video"];
+    [self setupButton: o_video_fullscreen_ckb forBoolValue: "fullscreen"];
+    [self setupButton: o_video_onTop_ckb forBoolValue: "video-on-top"];
+    [self setupButton: o_video_skipFrames_ckb forBoolValue: "skip-frames"];
+    [self setupButton: o_video_black_ckb forBoolValue: "macosx-black"];
 
     [self setupButton: o_video_output_pop forModuleList: "vout"];
 
@@ -497,22 +532,24 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     [o_video_device_pop selectItemAtIndex: 0];
     [o_video_device_pop selectItemWithTag: config_GetInt( p_intf, "macosx-vdev" )];
 
-    [self setupField:o_video_snap_folder_fld forOption:"snapshot-path"];
-    [self setupField:o_video_snap_prefix_fld forOption:"snapshot-prefix"];
-    [o_video_snap_seqnum_ckb setState: config_GetInt( p_intf, "snapshot-sequential" )];
+    [self setupField: o_video_snap_folder_fld forOption:"snapshot-path"];
+    [self setupField: o_video_snap_prefix_fld forOption:"snapshot-prefix"];
+    [self setupButton: o_video_snap_seqnum_ckb forBoolValue: "snapshot-sequential"];
     [self setupButton: o_video_snap_format_pop forStringList: "snapshot-format"];
 
     /***************************
      * input & codecs settings *
      ***************************/
-    [o_input_serverport_fld setIntValue: config_GetInt( p_intf, "server-port" )];
-    [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_serverport_fld setIntValue: config_GetInt( p_intf, "server-port")];
+    [o_input_serverport_fld setToolTip: [NSString stringWithUTF8String: config_GetLabel( p_intf, "server-port")]];
+    [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")]];
 
     [self setupButton: o_input_avi_pop forIntList: "avi-index"];
 
-    [o_input_rtsp_ckb setState: config_GetInt( p_intf, "rtsp-tcp" )];
+    [self setupButton: o_input_rtsp_ckb forBoolValue: "rtsp-tcp"];
     [self setupButton: o_input_skipLoop_pop forIntList: "ffmpeg-skiploopfilter"];
 
     [o_input_cachelevel_pop removeAllItems];
@@ -568,7 +605,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
     /*********************
      * subtitle settings *
      *********************/
-    [o_osd_osd_ckb setState: config_GetInt( p_intf, "osd" )];
+    [self setupButton: o_osd_osd_ckb forBoolValue: "osd"];
     
     [self setupButton: o_osd_encoding_pop forStringList: "subsdec-encoding"];
     [self setupField: o_osd_lang_fld forOption: "sub-language" ];




More information about the vlc-devel mailing list