When switching to fullscreen view mode the statusbar is hidden but the
KToggleAction is not updated. This leads to unhiding the statusbar
after applying config dialog and forcing the user to press F3
twice to show the statusbar.
This patch keeps visibility and action state in sync by using persistent
GwenviewConfig values for browse mode and normal/fullscreen view
modes like sidebar.
Details
- Reviewers
rkflx - Group Reviewers
Gwenview - Commits
- R260:c2e8c8923841: Keep statusbar visibility in sync with KToggleAction and persist states
Switch browse/view, normal/fullscreen modes.
The statusbar state should always restore to previous setting.
Three different states are (re)stored:
- Browse mode (always equal in normal/fullscreen mode)
- View mode normal (windowed) mode
- View mode fullscreen mode
Diff Detail
- Repository
- R260 Gwenview
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Much better than before, but I wonder if we should go all the way and make the statusbar behave like the sidebar (I'm only talking about View mode here). Currently it works like this:
- Browse mode: State of both sidebar and statusbar remembered globally, i.e. it does not matter whether Fullscreen or not. Perfect!
- View mode: State of sidebar remembered separately for Fullscreen and normal mode. However, currently the statusbar state is only remembered for normal mode, but always set to disabled initially in Fullscreen.
I feel that in general it makes sense that Fullscreen → View mode does neither show statusbar nor sidebar. However, if someone enables the sidebar and the statusbar for whatever reason, it does not make sense to only remember this choice for one element instead of both.
Why not, should be no big deal and getting the same behaviour like the sidebar can't be wrong. ;)
Using the GwenviewConfig we also don't need any new class variables.
ATM the config is saved in a new group with 3 entries, the existing sidebar config uses 3 groups of 1 entry each (and IMHO a complicated implementation to access them):
[StatusBar] IsVisible BrowseMode=true IsVisible ViewMode Normal=true IsVisible ViewMode FullScreen=false [SideBar-BrowseMode] IsVisible=true [SideBar-FullScreenMode] IsVisible=true [SideBar-ViewMode] IsVisible=true
What do you think?
Better adjust the statusbar to sidebar config or vice versa (sometime), keep it mixed or use a completely different syntax?
Works great, almost ready ;)
IsVisible ViewMode Normal=true
If you ever wanted to introduce BrowseMode FullScreen and keep BrowseMode for compatibility, the ViewMode Normal would look odd, while if you wanted to remove ViewMode FullScreen, a simple BrowseMode would still look good. IOW, I would drop the Normal postfix.
Other than that, I vastly prefer your new approach over the old one. Even if it is less generic, the overall idea is expressed better.
What about the sidebar? Cleaner code is good, but I wonder if it is really worth the disruption for the user… We could provide backwards compatibility via kconf_update, but again I'm not sure the (IMO) less important toggling states warrant putting too much work into it. As you are already resetting the statusbar for users, let's either change the sidebar now too (new Diff), or don't change the sidebar at all for the time being.
app/mainwindow.cpp | ||
---|---|---|
729 | statusBarConfig → statusBarVisibility? Your are only returning a single bool, but not the complete internal config state. | |
733–737 | Use the ternary operator? | |
742 | I would keep the order as defined in the enum, but that's just me. | |
750 | setStatusBarConfig → saveStatusBarVisibility? I'd keep it focussed on the visibility for now. When we need to save more, we need a different save/load API design anyway. OTOH, I don't like my names too much either… |
Accepted. :)
We could provide backwards compatibility via kconf_update
Good to know. I ever wondered if there is such a thing but didn't searched for it yet.
I'll take a look at the sidebar config, shouldn't be too much work since it's not that different to the statusbar.
app/mainwindow.cpp | ||
---|---|---|
729 | I wanted to use a different name to not mix it with *MainPage::statusBarVisible() - but statusBarVisibility() is different enough and more to the point. ;) |
Switch order 0, 1, 2 / if -> ternary operator
app/mainwindow.cpp | ||
---|---|---|
755–759 | Oops, never thought about using this without a return value. ;) |