Commit e88bc95f authored by David Fuhrmann's avatar David Fuhrmann

macosx: Correctly save and restore collapsed state of split view

This state is saved already with the automatic macOS mechanisms
using the assigned autosave name. Therefore, remove the additional
setting which was interfering with the already correct state.

fixes #19649

(cherry picked from commit b62b868c)
Signed-off-by: default avatarDavid Fuhrmann <dfuhrmann@videolan.org>
parent 2cfb50de
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
- (void)setupMenus; - (void)setupMenus;
- (void)setSubmenusEnabled:(BOOL)b_enabled; - (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)setRateControlsEnabled:(BOOL)b_enabled; - (void)setRateControlsEnabled:(BOOL)b_enabled;
- (void)updateSidebarMenuItem; - (void)updateSidebarMenuItem:(BOOL)show;
- (IBAction)openAddonManager:(id)sender; - (IBAction)openAddonManager:(id)sender;
......
...@@ -379,7 +379,6 @@ ...@@ -379,7 +379,6 @@
[_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")]; [_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
[_toggleEffectsButton setState: var_InheritBool(getIntf(), "macosx-show-effects-button")]; [_toggleEffectsButton setState: var_InheritBool(getIntf(), "macosx-show-effects-button")];
[_toggleSidebar setTitle: _NS("Show Sidebar")]; [_toggleSidebar setTitle: _NS("Show Sidebar")];
[_toggleSidebar setState: var_InheritBool(getIntf(), "macosx-show-sidebar")];
[_playlistTableColumns setTitle: _NS("Playlist Table Columns")]; [_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[_controlsMenu setTitle: _NS("Playback")]; [_controlsMenu setTitle: _NS("Playback")];
...@@ -704,9 +703,9 @@ ...@@ -704,9 +703,9 @@
[[[VLCMain sharedInstance] mainWindow] toggleLeftSubSplitView]; [[[VLCMain sharedInstance] mainWindow] toggleLeftSubSplitView];
} }
- (void)updateSidebarMenuItem - (void)updateSidebarMenuItem:(BOOL)show;
{ {
[_toggleSidebar setState: var_InheritBool(getIntf(), "macosx-show-sidebar")]; [_toggleSidebar setState:show];
} }
#pragma mark - Playback #pragma mark - Playback
......
...@@ -277,9 +277,7 @@ static const float f_min_window_height = 307.; ...@@ -277,9 +277,7 @@ static const float f_min_window_height = 307.;
/* restore split view */ /* restore split view */
f_lastLeftSplitViewWidth = 200; f_lastLeftSplitViewWidth = 200;
/* trick NSSplitView implementation, which pretends to know better than us */ [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView isSubviewCollapsed:_splitViewLeft]];
if (!var_InheritBool(getIntf(), "macosx-show-sidebar"))
[self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
} }
#pragma mark - #pragma mark -
...@@ -516,7 +514,6 @@ static const float f_min_window_height = 307.; ...@@ -516,7 +514,6 @@ static const float f_min_window_height = 307.;
- (void)applicationWillTerminate:(NSNotification *)notification - (void)applicationWillTerminate:(NSNotification *)notification
{ {
config_PutInt(getIntf(), "macosx-show-sidebar", ![_splitView isSubviewCollapsed:_splitViewLeft]);
[self saveFrameUsingName:[self frameAutosaveName]]; [self saveFrameUsingName:[self frameAutosaveName]];
} }
...@@ -833,8 +830,7 @@ static const float f_min_window_height = 307.; ...@@ -833,8 +830,7 @@ static const float f_min_window_height = 307.;
- (void)mainSplitViewDidResizeSubviews:(id)object - (void)mainSplitViewDidResizeSubviews:(id)object
{ {
f_lastLeftSplitViewWidth = [_splitViewLeft frame].size.width; f_lastLeftSplitViewWidth = [_splitViewLeft frame].size.width;
config_PutInt(getIntf(), "macosx-show-sidebar", ![_splitView isSubviewCollapsed:_splitViewLeft]); [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView isSubviewCollapsed:_splitViewLeft]];
[[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
} }
- (void)toggleLeftSubSplitView - (void)toggleLeftSubSplitView
...@@ -844,7 +840,8 @@ static const float f_min_window_height = 307.; ...@@ -844,7 +840,8 @@ static const float f_min_window_height = 307.;
[_splitView setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0]; [_splitView setPosition:f_lastLeftSplitViewWidth ofDividerAtIndex:0];
else else
[_splitView setPosition:[_splitView minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0]; [_splitView setPosition:[_splitView minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
[[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
[[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem: ![_splitView isSubviewCollapsed:_splitViewLeft]];
} }
#pragma mark - #pragma mark -
......
...@@ -122,9 +122,6 @@ void WindowClose (vout_window_t *); ...@@ -122,9 +122,6 @@ void WindowClose (vout_window_t *);
#define EFFECTSBUTTON_TEXT N_("Show Audio Effects Button") #define EFFECTSBUTTON_TEXT N_("Show Audio Effects Button")
#define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main window.") #define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main window.")
#define SIDEBAR_TEXT N_("Show Sidebar")
#define SIDEBAR_LONGTEXT N_("Shows a sidebar in the main window listing media sources.")
#define ITUNES_TEXT N_("Control external music players") #define ITUNES_TEXT N_("Control external music players")
#define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players on playback.") #define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players on playback.")
...@@ -164,7 +161,6 @@ vlc_module_begin() ...@@ -164,7 +161,6 @@ vlc_module_begin()
add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false) add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false)
add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false) add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false)
add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false) add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false)
add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, false)
add_integer_with_range("macosx-max-volume", 125, 60, 200, VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true) add_integer_with_range("macosx-max-volume", 125, 60, 200, VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true)
add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, LARGE_LISTFONT_TEXT, false) add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, LARGE_LISTFONT_TEXT, false)
...@@ -190,6 +186,7 @@ vlc_module_begin() ...@@ -190,6 +186,7 @@ vlc_module_begin()
add_obsolete_bool("macosx-stretch") /* since 2.0.0 */ add_obsolete_bool("macosx-stretch") /* since 2.0.0 */
add_obsolete_bool("macosx-eq-keep") /* since 2.0.0 */ add_obsolete_bool("macosx-eq-keep") /* since 2.0.0 */
add_obsolete_bool("macosx-autosave-volume") /* since 2.1.0 */ add_obsolete_bool("macosx-autosave-volume") /* since 2.1.0 */
add_obsolete_bool("macosx-show-sidebar") /* since 3.0.1 */
add_submodule() add_submodule()
set_description("Mac OS X Video Output Provider") set_description("Mac OS X Video Output Provider")
......
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