Proper numbering on first image in folder when using Fullscreen mode
Needs ReviewPublic

Authored by aprcela on Oct 13 2019, 10:38 PM.

Details

Reviewers
None
Group Reviewers
VDG
Summary

BUG 406105

Diff Detail

Repository
R260 Gwenview
Branch
B406105
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17746
Build 17764: arc lint + arc unit
aprcela created this revision.Oct 13 2019, 10:38 PM
Restricted Application added a project: Gwenview. · View Herald TranscriptOct 13 2019, 10:38 PM
aprcela requested review of this revision.Oct 13 2019, 10:38 PM
tommo added a subscriber: tommo.Oct 14 2019, 4:31 PM

And if updating the current index takes longer than 250 msec it would fail again, wouldn't it?

Why is this timer even necessary? There already is a connection between the ThumbnailBarView::indexActivated signal and FullScreenContent::updateDocumentCountLabel. Shouldn't this serve this purpose?

aprcela added a comment.EditedOct 15 2019, 8:17 PM

And if updating the current index takes longer than 250 msec it would fail again, wouldn't it?

Probably, I can't get to that case where it's so slow. But I am aware that it can happen.

Why is this timer even necessary? There already is a connection between the ThumbnailBarView::indexActivated signal and FullScreenContent::updateDocumentCountLabel. Shouldn't this serve this purpose?

I've seen this and the problem is that it *somehow* sets const int current to 0 when it gets called for the first time (as in the bug described).
I'll look a bit more into it and see if I can do something else than this delay approach.

Seems that the problem is in the index:
https://cgit.kde.org/gwenview.git/tree/app/viewmainpage.cpp#n369

Index may be invalid when Gwenview is started as
gwenview /foo/image.png because in this situation it loads image.png
// *before* listing /foo (because it matters less to the user)

aprcela updated this revision to Diff 68033.Oct 16 2019, 10:55 AM

Revert timer and add additional updateDocumentCountLabel call

Reverted the timer to 0.
Now it works when switching to fullscreen. Next step: make the counter work properly when -f for fullscreen is used.

Did you mean to remove the timer in this patch?

aprcela updated this revision to Diff 68071.Oct 16 2019, 5:46 PM

Remove timer. Use simple method call instead.

Did you mean to remove the timer in this patch?

Done, tested and working.
Give me a day or two and I hope I'll demystify why the counter is not working when gwenview is launched with -f.

Go ahead, take your time. :)

aprcela updated this revision to Diff 68272.Oct 18 2019, 10:38 PM

Removed comment that was used for the timer

aprcela added a comment.EditedOct 18 2019, 10:44 PM

Searching and debugging and I just can't find the reason why.
So currently the counter works fine when the first image of a folder is opened and THEN one goes into fullscreen. But if one goes directly into fullscreen with the first image loaded, than it sets the counter to 0.

gwenview -f first_image_in_folder.jpg results with counter set to 0 of x
gwenview -f any_other_image_in_folder.jpg results with counter always set to 1 of x

gwenview first_image_in_folder.jpg , then open fullscreen within gwenview - results with a proper counter set to 1 of x
gwenview any_other_image_in_folder.jpg , then open fullscreen within gwenview - results with a proper counter set to n of x (where n is the number of the file in that folder)

The -f launches gwenview into fullscreen with mMainWindow->actionCollection()->action("fullscreen")->trigger(); found here: https://cgit.kde.org/gwenview.git/tree/app/main.cpp#n102
Anyone with an idea/tip where I should look further?