+ /* audio */
+ [o_audio_dolby_txt setStringValue: _NS("Force detection of Dolby Surround")];
+ [o_audio_effects_box setTitle: _NS("Effects")];
+ [o_audio_enable_ckb setTitle: _NS("Enable Audio")];
+ [o_audio_general_box setTitle: _NS("General Audio")];
+ [o_audio_headphone_ckb setTitle: _NS("Headphone surround effect")];
+ [o_audio_lang_txt setStringValue: _NS("Preferred Audio language")];
+ [o_audio_last_ckb setTitle: _NS("Enable Last.fm submissions")];
+ [o_audio_lastpwd_txt setStringValue: _NS("Password")];
+ [o_audio_lastuser_txt setStringValue: _NS("User name")];
+ [o_audio_norm_ckb setTitle: _NS("Volume normalizer")];
+ [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")];
+
+ /* hotkeys */
+ [o_hotkeys_change_btn setTitle: _NS("Change")];
+ [o_hotkeys_change_win setTitle: _NS("Change Hotkey")];
+ [o_hotkeys_change_cancel_btn setTitle: _NS("Cancel")];
+ [o_hotkeys_change_ok_btn setTitle: _NS("OK")];
+ [o_hotkeys_clear_btn setTitle: _NS("Clear")];
+ [o_hotkeys_lbl setStringValue: _NS("Select an action to change the associated hotkey:")];
+ [[[o_hotkeys_listbox tableColumnWithIdentifier: @"action"] headerCell] setStringValue: _NS("Action")];
+ [[[o_hotkeys_listbox tableColumnWithIdentifier: @"shortcut"] headerCell] setStringValue: _NS("Shortcut")];
+
+ /* input */
+ [o_input_avi_txt setStringValue: _NS("Repair AVI Files")];
+ [o_input_cachelevel_txt setStringValue: _NS("Default Caching Level")];
+ [o_input_caching_box setTitle: _NS("Caching")];
+ [o_input_cachelevel_custom_txt setStringValue: _NS("Use the complete preferences to configure custom caching values for each access module.")];
+ [o_input_httpproxy_txt setStringValue: _NS("HTTP Proxy")];
+ [o_input_httpproxypwd_txt setStringValue: _NS("Password for HTTP Proxy")];
+ [o_input_mux_box setTitle: _NS("Codecs / Muxers")];
+ [o_input_net_box setTitle: _NS("Network")];
+ [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_serverport_txt setStringValue: _NS("Default Server Port")];
+
+ /* interface */
+ [o_intf_art_txt setStringValue: _NS("Album art download policy")];
+ [o_intf_embedded_ckb setTitle: _NS("Add controls to the video window")];
+ [o_intf_fspanel_ckb setTitle: _NS("Show Fullscreen Controller")];
+ [o_intf_lang_txt setStringValue: _NS("Language")];
+ [o_intf_network_box setTitle: _NS("Privacy / Network Interaction")];
+ [o_intf_appleremote_ckb setTitle: _NS("Control playback with the Apple Remote")];
+ [o_intf_mediakeys_ckb setTitle: _NS("Control playback with media keys")];
+ [o_intf_mediakeys_bg_ckb setTitle: _NS("...when VLC is in background")];
+ [o_intf_update_ckb setTitle: _NS("Automatically check for updates")];
+ [o_intf_last_update_lbl setStringValue: @""];
+
+ /* Subtitles and OSD */
+ [o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
+ [o_osd_font_box setTitle: _NS("Display Settings")];
+ [o_osd_font_btn setTitle: _NS("Choose...")];
+ [o_osd_font_color_txt setStringValue: _NS("Font Color")];
+ [o_osd_font_size_txt setStringValue: _NS("Font Size")];
+ [o_osd_font_txt setStringValue: _NS("Font")];
+ [o_osd_lang_box setTitle: _NS("Subtitle Languages")];
+ [o_osd_lang_txt setStringValue: _NS("Preferred Subtitle Language")];
+ [o_osd_osd_box setTitle: _NS("On Screen Display")];
+ [o_osd_osd_ckb setTitle: _NS("Enable OSD")];
+
+ /* video */
+ [o_video_black_ckb setTitle: _NS("Black screens in Fullscreen mode")];
+ [o_video_device_txt setStringValue: _NS("Fullscreen Video Device")];
+ [o_video_display_box setTitle: _NS("Display")];
+ [o_video_enable_ckb setTitle: _NS("Enable Video")];
+ [o_video_fullscreen_ckb setTitle: _NS("Fullscreen")];
+ [o_video_onTop_ckb setTitle: _NS("Always on top")];
+ [o_video_output_txt setStringValue: _NS("Output module")];
+ [o_video_skipFrames_ckb setTitle: _NS("Skip frames")];
+ [o_video_snap_box setTitle: _NS("Video snapshots")];
+ [o_video_snap_folder_btn setTitle: _NS("Browse...")];
+ [o_video_snap_folder_txt setStringValue: _NS("Folder")];
+ [o_video_snap_format_txt setStringValue: _NS("Format")];
+ [o_video_snap_prefix_txt setStringValue: _NS("Prefix")];
+ [o_video_snap_seqnum_ckb setTitle: _NS("Sequential numbering")];
+
+ /* generic stuff */
+ [[o_sprefs_basicFull_matrix cellAtRow: 0 column: 0] setStringValue: _NS("Basic")];
+ [[o_sprefs_basicFull_matrix cellAtRow: 0 column: 1] setStringValue: _NS("All")];
+ [o_sprefs_cancel_btn setTitle: _NS("Cancel")];
+ [o_sprefs_reset_btn setTitle: _NS("Reset All")];
+ [o_sprefs_save_btn setTitle: _NS("Save")];
+ [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", psz_name );
+
+ return NULL;
+}
+
+- (void)setupButton: (NSPopUpButton *)object forStringList: (const char *)name
+{
+ module_config_t *p_item;
+
+ [object removeAllItems];
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+
+ /* serious problem, if no item found */
+ assert( p_item );
+
+ for( int i = 0; i < p_item->i_list; i++ )
+ {
+ NSMenuItem *mi;
+ if( p_item->ppsz_list_text != NULL )
+ mi = [[NSMenuItem alloc] initWithTitle: _NS( p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""];
+ else if( p_item->ppsz_list[i] && strcmp(p_item->ppsz_list[i],"") == 0 )
+ {
+ [[object menu] addItem: [NSMenuItem separatorItem]];
+ continue;
+ }
+ else if( p_item->ppsz_list[i] )
+ mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithUTF8String: p_item->ppsz_list[i]] action:NULL keyEquivalent: @""];
+ else NSLog( @"item %d of pref %s failed to be created", i, name);
+ [mi setRepresentedObject:[NSString stringWithUTF8String: p_item->ppsz_list[i]]];
+ [[object menu] addItem: [mi autorelease]];
+ if( p_item->value.psz && !strcmp( p_item->value.psz, p_item->ppsz_list[i] ) )
+ [object selectItem:[object lastItem]];
+ }
+ [object setToolTip: _NS( p_item->psz_longtext )];
+}
+
+- (void)setupButton: (NSPopUpButton *)object forIntList: (const char *)name
+{
+ module_config_t *p_item;
+
+ [object removeAllItems];
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+
+ /* serious problem, if no item found */
+ assert( p_item );
+
+ for( int i = 0; i < p_item->i_list; i++ )
+ {
+ NSMenuItem *mi;
+ if( p_item->ppsz_list_text != NULL)
+ mi = [[NSMenuItem alloc] initWithTitle: _NS( p_item->ppsz_list_text[i] ) action:NULL keyEquivalent: @""];
+ else if( p_item->pi_list[i] )
+ mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->pi_list[i]] action:NULL keyEquivalent: @""];
+ else NSLog( @"item %d of pref %s failed to be created", i, name);
+ [mi setRepresentedObject:[NSNumber numberWithInt: p_item->pi_list[i]]];
+ [[object menu] addItem: [mi autorelease]];
+ if( p_item->value.i == p_item->pi_list[i] )
+ [object selectItem:[object lastItem]];
+ }
+ [object setToolTip: _NS( p_item->psz_longtext )];
+}
+
+- (void)setupButton: (NSPopUpButton *)object forModuleList: (const char *)name
+{
+ module_config_t *p_item;
+ module_t *p_parser, **p_list;
+ int y = 0;
+
+ [object removeAllItems];
+
+ p_item = config_FindConfig( VLC_OBJECT(p_intf), name );
+ p_list = module_list_get( NULL );
+ if( !p_item ||!p_list )
+ {
+ if( p_list ) module_list_free(p_list);
+ NSLog( @"serious problem, item or list not found" );
+ return;
+ }
+
+ [object addItemWithTitle: _NS("Default")];
+ for( size_t i_index = 0; p_list[i_index]; i_index++ )
+ {
+ p_parser = p_list[i_index];
+ if( module_provides( p_parser, p_item->psz_type ) )
+ {
+ [object addItemWithTitle: [NSString stringWithUTF8String: module_GetLongName( p_parser ) ?: ""]];
+ if( p_item->value.psz && !strcmp( p_item->value.psz, module_get_object( p_parser ) ) )
+ [object selectItem: [object lastItem]];
+ }
+ }
+ module_list_free( p_list );
+ [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 );