/*****************************************************************************
* simple_prefs.m: Simple Preferences for Mac OS X
*****************************************************************************
-* Copyright (C) 2008-2011 the VideoLAN team
+* Copyright (C) 2008-2011 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#import "CompatibilityFixes.h"
#import "simple_prefs.h"
#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"
+
#import <Sparkle/Sparkle.h> //for o_intf_last_update_lbl
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
[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
/* setup useful stuff */
o_hotkeysNonUseableKeys = [[NSArray arrayWithObjects: @"Command-c", @"Command-x", @"Command-v", @"Command-a", @"Command-," , @"Command-h", @"Command-Alt-h", @"Command-Shift-o", @"Command-o", @"Command-d", @"Command-n", @"Command-s", @"Command-z", @"Command-l", @"Command-r", @"Command-3", @"Command-m", @"Command-w", @"Command-Shift-w", @"Command-Shift-c", @"Command-Shift-p", @"Command-i", @"Command-e", @"Command-Shift-e", @"Command-b", @"Command-Shift-m", @"Command-Ctrl-m", @"Command-?", @"Command-Alt-?", nil] retain];
}
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] )
{
[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")];
[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")];
[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")];
- (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 );
}
[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" ) * 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];
+
+ 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"];
[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"),
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"];
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" );
if( b_audioSettingChanged )
{
config_PutInt( p_intf, "audio", [o_audio_enable_ckb state] );
- config_PutInt( p_intf, "volume", ([o_audio_vol_sld intValue] * 2.56));
+ 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" );
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;
}
}
}
+ 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;
}
[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" );