Commit c2e39623 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx: implements user choice to autosave volume on exit and changes volume...

macosx: implements user choice to autosave volume on exit and changes volume slider range to 0 ... 200%

this adds the configuration variable and also the respective gui modifications for
simple prefs dialog. Also, this commit changes some spacing in gui to be consistent
between the different tabs.
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 52541312
......@@ -895,7 +895,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)applicationWillTerminate:(NSNotification *)notification
{
if( config_GetInt( VLCIntf, "macosx-autosave-volume" ))
config_PutInt( VLCIntf->p_libvlc, "volume", i_lastShownVolume );
[self saveFrameUsingName: [self frameAutosaveName]];
}
......
......@@ -90,6 +90,8 @@ void WindowClose ( vout_window_t * );
#define NATIVE_FULLSCREEN_MODE_ON_LION_TEXT N_("Use the native fullscreen mode on OS X Lion")
#define NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT N_("By default, VLC uses the native fullscreen mode on Mac OS X 10.7 and later. It can also use the custom mode known from previous Mac OS X releases.")
#define SAVEVOL_TEXT N_( "Automatically save the volume on exit" )
vlc_module_begin ()
set_description( N_("Mac OS X interface") )
set_capability( "interface", 200 )
......@@ -104,6 +106,7 @@ vlc_module_begin ()
add_bool( "macosx-mediakeys", true, USE_MEDIAKEYS_TEXT, USE_MEDIAKEYS_LONGTEXT, false )
add_bool( "macosx-interfacestyle", true, INTERFACE_STYLE_TEXT, INTERFACE_STYLE_LONGTEXT, false )
add_bool( "macosx-nativefullscreenmode", true, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false )
add_bool( "macosx-autosave-volume", true, SAVEVOL_TEXT, SAVEVOL_TEXT, true )
add_obsolete_bool( "macosx-stretch" ) /* since 1.2.0 */
add_obsolete_bool( "macosx-background" ) /* since 1.2.0 */
add_obsolete_bool( "macosx-eq-keep" ) /* since 1.2.0 */
......
......@@ -46,7 +46,9 @@
IBOutlet id o_audio_visual_txt;
IBOutlet id o_audio_vol_fld;
IBOutlet id o_audio_vol_sld;
IBOutlet id o_audio_vol_txt;
IBOutlet id o_audio_autosavevol_matrix;
IBOutlet id o_audio_autosavevol_yes_bcell;
IBOutlet id o_audio_autosavevol_no_bcell;
IBOutlet id o_hotkeys_change_btn;
IBOutlet id o_hotkeys_change_lbl;
......
......@@ -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")];
......@@ -488,11 +490,29 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
* audio settings *
******************/
[self setupButton: o_audio_enable_ckb forBoolValue: "audio"];
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" );
[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]];
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"];
......@@ -836,7 +856,8 @@ 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]);
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 +1049,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment