-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Shortcut Categories #12752
base: master
Are you sure you want to change the base?
Shortcut Categories #12752
Conversation
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.
Works pretty well with the mouse, although it breaks accessibility with the keyboard. Try navigating the Preferences > Shortcuts page with the Tab key and arrow keys on your keyboard and you'll see what I mean (compare the behaviour of your PR to the latest nightly builds on master). Ideally the Spacebar and Return keys would be used to expand categories like in the Palettes.
There's no stuttering for me when expanding/collapsing the categories, though the text seems to remain visible for a few milliseconds longer than I would expect. The text should needs to disappear before the rectangles are fully collapsed. Perhaps the should lose opacity gradually rather than instantly disappearing? Or maybe the text could be gradually covered by the rectangle below?
Category names should be in bold according to the design. I would also suggest using separate columns for icons and action names to avoid the left edge of action names being staggered like this...
Icons should be centred in the first column and action names left-aligned in the next column.
40834af
to
b5ff8d2
Compare
This is coming along really nicely @VanSHOE! |
@bkunda I see, I will remove the animation |
{ | ||
if ((int)category + 1 >= 0 && (int)category + 1 < categories.size()) { | ||
return categories[(int)category + 1].qTranslated(); | ||
} |
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.
It might be better to get rid of the vector and do this method as a switch statement:
switch (category) {
case ...: return ...;
...
}
// Unreachable
return {};
This way, you don't need to worry about syncing the order in the enum and in this method, and you'll get a compiler warning here if you forget to handle new cases here.
Also, maybe better rename the method to categoryName(...)
(we tend not to use get
prefixes).
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.
@cbjeukendrup I can do this however, the categories vector is required to send all sections to QML as well. It is in ShortcutsPage.qml
Component.onCompleted: {
shortcutsModel.load()
shortcutsView.allSections = shortcutsModel.sections() // <-- Here
topPanel.setSearchText(root.shortcutCodeKey)
}
So I thought maybe the get category could just use this list itself to preserve Lines of Code. Please let me know if I should still go with the switch case approach in section name
Edit: Also in QML, these names are directly used to check whether they are collapsed or not, so using the list itself would ensure that there is no mis-match among the names (because same source)
But if I use switch, then if any typo happens in naming and it does not match what it says in the list, it would cause bugs
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 think you can actually get rid of getCategory
and just do the stuff in ShortcutsModel::sectionName(...)
.
src/framework/shortcuts/qml/MuseScore/Shortcuts/ShortcutsPage.qml
Outdated
Show resolved
Hide resolved
TranslatableString("framework/actioncategory", "Dialogs & Panels"), | ||
TranslatableString("framework/actioncategory", "Note Input"), | ||
TranslatableString("framework/actioncategory", "Workspace"), | ||
TranslatableString("framework/actioncategory", "Plugins") }; |
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.
Not sure if this is the best translation context. @shoogle What do you think? Maybe "action/category"
, to keep it consistent with "action"
which is the context of UIActions?
(probably "framework/" is not right anyway because it's not part of the framework module anymore)
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.
Please let me know if this is supposed to be done. Till then I'll push some of the other changes
src/framework/uicomponents/qml/MuseScore/UiComponents/internal/ValueListSection.qml
Outdated
Show resolved
Hide resolved
src/framework/uicomponents/qml/MuseScore/UiComponents/ValueList.qml
Outdated
Show resolved
Hide resolved
src/framework/shortcuts/qml/MuseScore/Shortcuts/internal/ShortcutsBottomPanel.qml
Outdated
Show resolved
Hide resolved
I have a feeling that we should think a little bit about how the tree view is implemented in QML. Currently, we're basically abusing a ListView and setting the height of invisible items to zero. This has bad implications for keyboard navigation (it will treat the "hidden" rows as visible, because technically they are). You could try to use QML's TreeView component (rather than ListView). TreeView is from It would be quite a big operation, because it would mean that the ShortcutsModel will also need to become a QAbstractItemModel rather than a QAbstractListModel. I'm not sure whether this is worthwhile. I can't predict whether this will give better performance or not at all. On the other hand, one could argue that it is a lot cleaner. Maybe @shoogle and other developers could advise about this? (One other note about this: Qt 6.0-6.2 did not contain a TreeView component at all, but since Qt 6.3 there's a new one, which is more in ListView style, and works completely different from the |
@cbjeukendrup Keyboard navigation with respect to the list items was fixed, i.e. if you collapse them they wont be selectable with keyboard anymore. Please let me know in case its not working. The issue however is that sections themselves can't be selected with a keyboard |
Ah, missed that, my fault. So that's one less problem to worry about... |
If the Qt 5 TreeView is implemented very differently to the Qt 6 TreeView then I think it would be better to stick with the current approach (i.e. the hacked ListView) for as long as we use Qt 5, and only think about using a proper TreeView after we have switched to Qt 6.
Of course if this is not solvable then that might be an argument for using a proper TreeView now, but hopefully it will be solvable one way or another. |
7c578a8
to
c650cd0
Compare
Hi @VanSHOE! We would like to revisit this PR, and we are planning to include it in MuseScore 4.1. The first thing that's necessary for that is a rebase, both to fix the conflicts and to get new artifacts so that we can test it again (the old builds have expired). It would be great if you could do that! |
Undefined = -1, | ||
Internal, |
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.
It looks like the Internal
category is not really used; its role already seems to be fulfilled by Undefined
. Do we need 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.
@cbjeukendrup
Back then, I believe I set Undefined for those shortcuts that I did not really know the category of while Internal meant confirmed private actions. We can remove them but I thought it might be nice to keep them separate in case the Undefined ones do end up getting a category at some point
Sure Im on it! |
…llapsed manually the button changes to expand all
1e0c153
to
22537cc
Compare
Unfortunately we're going to have to bump this to 4.2 for now because we are out of time for introducing new features in 4.1, and this one still needs some consideration by @RomanPudashkin and @cbjeukendrup. |
fa1f8d3
to
525a11a
Compare
This adds shortcut categories as defined here
The shortcut categories are currently draft categories and may change later on.
A known issue is that the opening and closing of categories can be a bit stuttery when opening/ closing categories but it mostly happens when they are just about to be opened/ closed