-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library list pinning behavior #1079
Conversation
300e761
to
12bb397
Compare
@sgourdas Thank you for you PR, we will review it. |
Beside my comment, it looks good from a user perspective. |
This was a bit more complicated than what I would want it, for code clarity, but it needs to be done and now the behavior should be the one you mentioned. To distinguish between a double click and not handle it as two clicks as well, I had to put a check in place so single clicks check if a double click happened at the near time they were emitted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing revealed the following issues:
- During the very first double click the bookmark is opened both in the current tab and in a new tab.
- Selecting a bookmark with keyboard (Tab keys) and activating it with the "Enter" key opens the bookmark in a new tab. I guess that was intended.
Overall, as you noted, the code lacks clarity. I think that having three functions onItemClicked()
, onItemSingleClicked()
and onItemDoubleClicked()
will make the design more comprehensible. onItemClicked()
will be responsible solely for distinguishing single-clicks from double-clicks and calling the corresponding self-documenting handler.
Regarding the history of this PR - please make sure that it consists of only two commits with accurate titles and useful descriptions.
src/mainwindow.cpp
Outdated
mp_ui->sideBar->hide(); | ||
} | ||
QAction *readingList = KiwixApp::instance()->getAction(KiwixApp::ToggleReadingListAction); | ||
readingList->setChecked(false); // Reading list is always disabled in library view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why the reading list is incompatible with the library view. In a newly started kiwix-desktop
app, why can't I see the list of bookmarks without having to open a content (or settings) tab?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just found another small inconsistency - though the reading list keeps being displayed beside a settings tab it cannot be opened or closed while on a settings tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why the reading list is incompatible with the library view. In a newly started
kiwix-desktop
app, why can't I see the list of bookmarks without having to open a content(or settings)tab?
On top of my comment in the issue, after implementing the single click behavior (open in same tab) in commit 445284a, this would not act correctly with the library view (or settings).
I just found another small inconsistency - though the reading list keeps being displayed beside a settings tab it cannot be opened or closed while on a settings tab.
Can confirm. For me, the reading list should be hidden when viewing the settings as well, but would like feedback on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On top of my comment in the issue, after implementing the single click behavior (open in same tab) in commit 445284a, this would not act correctly with the library view (or settings).
I think that it will work. TabBar::openUrl()
opens a new tab when called while the current tab is not a content tab. Thus on a library or settings tab a single-click will open a new tab, which is logical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, that is perfect if we decide that is what we want to do.
I cannot replicate this. For me it only opens a new tab with the double clicked bookmark.
Yes this is intended and is supported by the previous behavior.
|
The value of a function is not only in its size but also in its name. A good name for an identifier may eliminate the need for a comment. Whenever possible the code must explain itself. In our case "single-click" and "double-click" are easily understandable concepts in the use-model domain and it will be good if they are mirrored in the design of the code. |
@veloman-yunkan ok, just a last comment to clear things up, with naming and amount of functions. We have 2 events:
And we will refactor the logic so they are handled:
Which, after adding identification of each type of click in them, operate as the title explains. |
I am not sure that separating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The set of ReadingListBar::onItem*()
handlers and their relations with each other still looks somewhat messy to me.
4f58db4
to
4b7fd3a
Compare
Squashed and rebased with main to clear up things. Let's recoup on how we will proceed from here. |
fbb70f0
to
76c78df
Compare
344847b
to
0cd23b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. A few final touches and we will merge.
30eeced
to
d5e614f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bearing with me! I don't remember well the original shape of this PR, but I think that you should agree that it got significantly simpler and nicer.
No worries at all. In contrast, I really enjoyed it. Maybe I could have saved us a bit of time if there weren't some IRL distractions, that cut my workflow, but I agree it turned out pretty good. |
d5e614f
to
3b895c6
Compare
This refactors the behavior of tab changes, to make sure the reading list stays pinned until the user closes it (should be hidden in library at all times)
Fixes #1078