Commit a8a2a275 authored by David Fuhrmann's avatar David Fuhrmann

macosx: Cleanup code, use var_InheritBool for controls bar config

Use var_InheritBool for all appearance settings affecting the
controls bar. Cleanup code and remove unnecessary variables.
parent fa94ead8
......@@ -366,13 +366,13 @@
[_viewMenu setTitle: _NS("View")];
[_toggleJumpButtons setTitle: _NS("Show Previous & Next Buttons")];
[_toggleJumpButtons setState: config_GetInt(getIntf(), "macosx-show-playback-buttons")];
[_toggleJumpButtons setState: var_InheritBool(getIntf(), "macosx-show-playback-buttons")];
[_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")];
[_togglePlaymodeButtons setState: config_GetInt(getIntf(), "macosx-show-playmode-buttons")];
[_togglePlaymodeButtons setState: var_InheritBool(getIntf(), "macosx-show-playmode-buttons")];
[_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
[_toggleEffectsButton setState: config_GetInt(getIntf(), "macosx-show-effects-button")];
[_toggleEffectsButton setState: var_InheritBool(getIntf(), "macosx-show-effects-button")];
[_toggleSidebar setTitle: _NS("Show Sidebar")];
[_toggleSidebar setState: config_GetInt(getIntf(), "macosx-show-sidebar")];
[_toggleSidebar setState: var_InheritBool(getIntf(), "macosx-show-sidebar")];
[_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[_controlsMenu setTitle: _NS("Playback")];
......@@ -659,7 +659,7 @@
- (IBAction)toggleEffectsButton:(id)sender
{
BOOL b_value = !config_GetInt(getIntf(), "macosx-show-effects-button");
BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-effects-button");
config_PutInt(getIntf(), "macosx-show-effects-button", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleEffectsButton];
[_toggleEffectsButton setState: b_value];
......@@ -667,7 +667,7 @@
- (IBAction)toggleJumpButtons:(id)sender
{
BOOL b_value = !config_GetInt(getIntf(), "macosx-show-playback-buttons");
BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-playback-buttons");
config_PutInt(getIntf(), "macosx-show-playback-buttons", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
......@@ -680,7 +680,7 @@
- (IBAction)togglePlaymodeButtons:(id)sender
{
BOOL b_value = !config_GetInt(getIntf(), "macosx-show-playmode-buttons");
BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-playmode-buttons");
config_PutInt(getIntf(), "macosx-show-playmode-buttons", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] togglePlaymodeButtons];
[_togglePlaymodeButtons setState: b_value];
......@@ -693,7 +693,7 @@
- (void)updateSidebarMenuItem
{
[_toggleSidebar setState: config_GetInt(getIntf(), "macosx-show-sidebar")];
[_toggleSidebar setState: var_InheritBool(getIntf(), "macosx-show-sidebar")];
}
#pragma mark - Playback
......
......@@ -284,7 +284,7 @@ static const float f_min_window_height = 307.;
/* restore split view */
f_lastLeftSplitViewWidth = 200;
/* trick NSSplitView implementation, which pretends to know better than us */
if (!config_GetInt(getIntf(), "macosx-show-sidebar"))
if (!var_InheritBool(getIntf(), "macosx-show-sidebar"))
[self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
}
......
......@@ -68,7 +68,6 @@
- (IBAction)repeat:(id)sender;
- (void)setShuffle;
- (IBAction)shuffle:(id)sender;
- (IBAction)togglePlaylist:(id)sender;
......
......@@ -48,17 +48,8 @@
NSImage * _pressedShuffleImage;
NSImage * _shuffleOnImage;
NSImage * _pressedShuffleOnImage;
BOOL b_show_jump_buttons;
BOOL b_show_playmode_buttons;
NSLayoutConstraint *_hidePrevButtonConstraint;
NSLayoutConstraint *_hideNextButtonConstraint;
}
- (void)addPlaymodeButtons:(BOOL)withAnimation;
- (void)removePlaymodeButtons:(BOOL)withAnimation;
@end
@implementation VLCMainWindowControlsBar
......@@ -194,12 +185,10 @@
if (!var_InheritBool(getIntf(), "macosx-show-effects-button"))
[self removeEffectsButton:NO];
b_show_playmode_buttons = var_InheritBool(getIntf(), "macosx-show-playmode-buttons");
if (!b_show_playmode_buttons)
if (!var_InheritBool(getIntf(), "macosx-show-playmode-buttons"))
[self removePlaymodeButtons:NO];
b_show_jump_buttons = var_InheritBool(getIntf(), "macosx-show-playback-buttons");
if (!b_show_jump_buttons)
if (!var_InheritBool(getIntf(), "macosx-show-playback-buttons"))
[self removeJumpButtons:NO];
[[[VLCMain sharedInstance] playlist] playbackModeUpdated];
......@@ -228,7 +217,7 @@
- (void)toggleEffectsButton
{
if (config_GetInt(getIntf(), "macosx-show-effects-button"))
if (var_InheritBool(getIntf(), "macosx-show-effects-button"))
[self addEffectsButton:YES];
else
[self removeEffectsButton:YES];
......@@ -272,9 +261,7 @@
- (void)toggleJumpButtons
{
b_show_jump_buttons = config_GetInt(getIntf(), "macosx-show-playback-buttons");
if (b_show_jump_buttons)
if (var_InheritBool(getIntf(), "macosx-show-playback-buttons"))
[self addJumpButtons:YES];
else
[self removeJumpButtons:YES];
......@@ -330,9 +317,7 @@
- (void)togglePlaymodeButtons
{
b_show_playmode_buttons = config_GetInt(getIntf(), "macosx-show-playmode-buttons");
if (b_show_playmode_buttons)
if (var_InheritBool(getIntf(), "macosx-show-playmode-buttons"))
[self addPlaymodeButtons:YES];
else
[self removePlaymodeButtons:YES];
......@@ -528,11 +513,8 @@
}
[self.stopButton setEnabled: b_input];
if (b_show_jump_buttons) {
[self.prevButton setEnabled: (b_seekable || b_plmul || b_chapters)];
[self.nextButton setEnabled: (b_seekable || b_plmul || b_chapters)];
}
[self.prevButton setEnabled: (b_seekable || b_plmul || b_chapters)];
[self.nextButton setEnabled: (b_seekable || b_plmul || b_chapters)];
[[[VLCMain sharedInstance] mainMenu] setRateControlsEnabled: b_control];
}
......
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