Skip to content
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

Improve library sidebar UX (right-click and selection after add, rename, delete, duplicate etc.) #11208

Merged
merged 45 commits into from
May 21, 2023

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Jan 16, 2023

I'd like to fix the last annoyance with the current selection/activation behaviour.

  • if you right-click an unselected item it is visually selected but not activated (i.e. not loaded to the tracks table). So the first inconsistency is that the item of the actually loaded content is not selected anymore.
  • the right-clicked item is the new starting point for navigation, very annoying if you were in "Tracks" and just want to clean up playlists or the history at the bottom of the sidebar)
  • any newly created (or duplicated) playlist or crate is selected. What for? Why should I look at an empty tracks table with no option to add tracks, this is only possible from within other track views (ignoring drag'n'drop from decks here).

My proposal:

  • show a focus border on right-clicked items (as long as sidebar has focus, i.e. until menu receives focus when using the keyboard/controller to navigate)
  • only select items after the track menu actions if they were previously selected, else refocus the previously selected item
    This is now ready for testing!
    I'll double-check the implementation and maybe rebase if needed, so please don't spend time on the diff until I give 👍

New features:

  • on right-click, sidebar items will be focused¹ (not selected) as long as the sidebar has focus -- on next focusInEvent the selection is refocused = selected item is always the starting point for navigation
    ¹highlight border like in tracks view, currently only styled in LateNight PaleMoon
  • in History, clicking one of the YEAR nodes now clears the tracks view
  • right-click a YEAR node now opens a context menu with "Delete all child playlists", which requires to be confirmed twice

TODO

  • enable item focus indicator in all skins

Test cases for selection:

Playlists / Crates / History
selection in sidebar and tracks view should not change when you

  • select an item in one of the other sidebar features
  • right-click a crate or playlist
    a) delete, rename, duplicate or lock it
    b) import a playlist file (= append it to the selected playlist / crate) or
    c) simply close the context menu without clicking an action

Playlists / Crates / History

  • select a crate or playlist
  • right-click, select Remove
    ⇒ item below or above should be selected and loaded to the tracks view

Playlists / Crates

  • right-click the respective root item while any other item is selected
  • choose "Create new ..."
    ⇒ sidebar should scroll to new item
    ⇒ new empty item should not be selected
    ⇒ tracks view should not change

Playlists / Crates

  • right-click root, select "Import ..."
  • the (last) imported playlist / crate should be selected and loaded to the tracks view

History

  • select root item (loads current setlog to tracks view)
  • right-click the actual 'current' playlist (must have at least one track)
  • choose "Finish current and start new"
    ⇒ new setlog will be created and marked with →
    ⇒ root item remains selected
    ⇒ current tracks view should be cleared (new setlog)
  • some small fixes

I hope this can also serve as base for any QML implementation of a sidebar/topbar/whatever feature view we come up with.

@daschuer
Copy link
Member

Is this intended to go to 2.4?

@ronso0
Copy link
Member Author

ronso0 commented Jan 26, 2023

Yup, for 2.4

I already rebased locally and will update this soon.
I had to start over (after I considered it 80% done) because of some silent assumptions / dependencies on the current way of right-click/select and some specialialities of SetlogFeature, and that required more lke a round-house kick than the rather cosmetic fixes I pushed first.

@ronso0 ronso0 changed the base branch from main to 2.4 January 29, 2023 00:11
@ronso0 ronso0 force-pushed the lib-sidebar-right-click-selection branch from 6fac6a5 to cb02631 Compare January 29, 2023 00:12
@ronso0
Copy link
Member Author

ronso0 commented Jan 29, 2023

This is now ready for testing!
I updated the PR description with new features and some test cases
I'll still double-check the implementation and maybe rebase if needed, so please don't spend time on the diff until I give 👍

@ronso0 ronso0 force-pushed the lib-sidebar-right-click-selection branch 4 times, most recently from b607fb8 to 11a3f5e Compare January 30, 2023 02:39
@daschuer
Copy link
Member

I have just tested it and that is an improvement. However, the scrolling is now "broken" when you for instance rename a playlist.
In this case the renamed playlist is scrolled out of sight, when returning from the context menu.

@ronso0 ronso0 force-pushed the lib-sidebar-right-click-selection branch 2 times, most recently from 9b3be3f to 2b46042 Compare February 6, 2023 19:42
@ronso0 ronso0 marked this pull request as ready for review February 6, 2023 23:37
@ronso0
Copy link
Member Author

ronso0 commented Feb 6, 2023

Everything should now work as expected.

TODO:
enable item focus indicator in all skins (currently added to LateNight only)

@ronso0 ronso0 force-pushed the lib-sidebar-right-click-selection branch 2 times, most recently from d9bbee4 to a21dc9b Compare February 10, 2023 10:10
@ronso0
Copy link
Member Author

ronso0 commented Feb 10, 2023

All done!

New features in History:
right-click menu now allows to

  • un/lock all childs of a YEAR folder
  • delete all childs of a YEAR folder (with two confirmation dialogs!)

All skins should now mark the (unselected) right-clicked sidebar item with a border.

@ronso0 ronso0 force-pushed the lib-sidebar-right-click-selection branch from 121a87f to 62a6c03 Compare March 19, 2023 00:00
don't rely on the right-clicked crate being selected in the feature's main table model,
use a fresh temporary model instead
TODO: styled only in LateNight PaleMoon, adjust stylesheets for other skins/themes
@ronso0
Copy link
Member Author

ronso0 commented Mar 23, 2023

Sorry I had to force-push. The code suggestions I commited here changed some variable names which I didn't spot in the diff (or relied on it being correct, i.e. this would built)

return true;
}

bool PlaylistDAO::deleteUnlockedPlaylists(QStringList& idStringList) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idStringList is not const anymore so we can remove the locked playlist ids, without creating another QStringList

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want non const references. I think in this case it would be correct to std::move the idStringList into the function, than it is clear that the caller must not use it afterwards.

Suggested change
bool PlaylistDAO::deleteUnlockedPlaylists(QStringList& idStringList) {
bool PlaylistDAO::deleteUnlockedPlaylists(QStringList&& idStringList) {

@github-actions github-actions bot added the skins label Apr 23, 2023
return true;
}

bool PlaylistDAO::deleteUnlockedPlaylists(QStringList& idStringList) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want non const references. I think in this case it would be correct to std::move the idStringList into the function, than it is clear that the caller must not use it afterwards.

Suggested change
bool PlaylistDAO::deleteUnlockedPlaylists(QStringList& idStringList) {
bool PlaylistDAO::deleteUnlockedPlaylists(QStringList&& idStringList) {

src/library/dao/playlistdao.cpp Outdated Show resolved Hide resolved
src/library/dao/playlistdao.cpp Outdated Show resolved Hide resolved
src/library/trackset/setlogfeature.cpp Outdated Show resolved Hide resolved
src/library/trackset/setlogfeature.cpp Outdated Show resolved Hide resolved
@ronso0
Copy link
Member Author

ronso0 commented Apr 23, 2023

Thanks @daschuer!
It now uses std::move operator (even though I'm not 100% sure I understood all of it) and I tweaked the year delete dialogs.

@ronso0 ronso0 added this to the 2.4.0 milestone May 8, 2023
@ronso0
Copy link
Member Author

ronso0 commented May 20, 2023

I just noticed two regressions:

  • in Playlists the (track count) duration is removed when selecting a playlist (same for Crates, my bad)
  • after playlist rename the items are not resorted

I'll look into it.

@ronso0
Copy link
Member Author

ronso0 commented May 20, 2023

Okay, done. Fortunately that was easy (I'm not very much into the code anymore.. x) )

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works good. Thank you.

@daschuer daschuer merged commit 468ee17 into mixxxdj:2.4 May 21, 2023
@ronso0
Copy link
Member Author

ronso0 commented May 21, 2023

Oh, thanks! I was just doing intense testing and fixed some minor issues.
Follow-up is here #11574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants