Fix thumbnail bar in View resetting to OFF when quitting in fullscreen
ClosedPublic

Authored by huoni on Feb 24 2018, 5:04 AM.

Details

Summary

Quitting Gwenview was saving the current state of the Thumbnail Bar, which is always
hidden in fullscreen, and therefore was always saving an OFF state to the config.
This patch saves the state of the Thumbnail Bar before going to fullscreen.

Test Plan

Go to View, toggle Thumbnail Bar on, go to fullscreen, press Ctrl+Q to quit.
After launching Gwenview again, View Thumbnail Bar should be visible.

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.
huoni requested review of this revision.Feb 24 2018, 5:04 AM
huoni created this revision.
huoni edited the summary of this revision. (Show Details)Feb 24 2018, 5:09 AM
huoni edited the test plan for this revision. (Show Details)
rkflx requested changes to this revision.Feb 25 2018, 11:57 PM

I guess your patch did no lack proper testing and you just uploaded the wrong revision :D

Even when your test plan contains a weird case, the most basic function should work too: Open Gwenview, toggle Thumbnail Bar, quit.

I wonder if we can get rid of mThumbnailBarVisibleBeforeFullScreen? In fullscreen mode we always hide the thumbnailbar, and in normal mode it could just directly read the config value (see also a similar refactoring Peter did recently in c2e8c8923841). Not sure if it will work, though, because the menubar checkbox has to be in sync.

app/viewmainpage.cpp
460

As far as I can see this is only called on startup and when you close the config dialog, i.e. too seldom ;)

This revision now requires changes to proceed.Feb 25 2018, 11:57 PM
huoni updated this revision to Diff 28077.Feb 26 2018, 1:02 AM
  • Revamp how we track and save the visibility of the thumbnail bar
huoni added a comment.Feb 26 2018, 1:10 AM

I guess your patch did no lack proper testing and you just uploaded the wrong revision :D

Even when your test plan contains a weird case, the most basic function should work too: Open Gwenview, toggle Thumbnail Bar, quit.

Apologies, I was too hasty in submitting this patch. I swear I tested the above though...

I wonder if we can get rid of mThumbnailBarVisibleBeforeFullScreen? In fullscreen mode we always hide the thumbnailbar, and in normal mode it could just directly read the config value (see also a similar refactoring Peter did recently in c2e8c8923841). Not sure if it will work, though, because the menubar checkbox has to be in sync.

I've updated it (and hopefully tested thoroughly enough!), to work like this:

  • The checked state of the thumbnail bar action is used to track what the user wants
  • Fullscreen sets the visibility of the bar directly, without toggling the action
  • When saving the config, we use the checked state of the action

What this means is that if the thumbnail bar is visible in normal mode, going to fullscreen will hide it but the button/action will remain checked to indicate the state the user wants it in (which fullscreen overrides). In Normal mode, they should stay in sync.
Therefore in a way, the checked state of the action is replacing mThumbnailBarVisibleBeforeFullScreen.

Not sure whether this is a 'good' way of doing it.

rkflx requested changes to this revision.Feb 26 2018, 10:27 PM

Works great now, thanks. Removing yet another bool sometimes getting out of sync is just what I had in mind. Makes the code easier to understand, too.

Some small cleanup left, then we should be good to go.

Apologies, I was too hasty in submitting this patch. I swear I tested the above though...

No problem, that's what reviews are for.

app/viewmainpage.cpp
164–165

Still there ;)

460–462

I would just repeat the call to the static, I don't think the temporary bool gains us anything in terms of performance or readability.

This revision now requires changes to proceed.Feb 26 2018, 10:27 PM
huoni updated this revision to Diff 28150.Feb 26 2018, 10:57 PM
  • Code cleanup
rkflx accepted this revision.Feb 26 2018, 11:03 PM
This revision is now accepted and ready to land.Feb 26 2018, 11:03 PM
This revision was automatically updated to reflect the committed changes.