Refactor shortcut related code & add shortcut tab to settings#3456
Draft
SunderB wants to merge 3 commits intosonic-pi-net:devfrom
Draft
Refactor shortcut related code & add shortcut tab to settings#3456SunderB wants to merge 3 commits intosonic-pi-net:devfrom
SunderB wants to merge 3 commits intosonic-pi-net:devfrom
Conversation
* All sets of default shortcuts are now defined in one map. Most key bindings are the same, but some have been changed for consistency or to avoid clashes between key bindings. * Default bindings and user-specified bindings are stored in different lists. The user binding will always take priority over the defaults. * When the shortcut mode is set to 'user', a mostly blank shortcut configuration file will now be created when exiting the program. Default base is still 'emacs'. * Functions to update the shortcut key bindings have been added, but not tested. This is to lay the groundwork for a potential shortcut configuration UI in the future.
* Shortcuts prefs tab includes: shortcut mode combo box, and a table showing all the shortcuts & current key bindings. * Some debug shortcuts have now been made configurable. * The list of default shortcuts (defaultBindings) is now set in the sonicpi_shortcuts.cpp, as setting it in the header seemed to cause weird issues with QStringList and segmentation faults. * In SonicPiShortcuts, the shortcut_ids list is now generated at runtime from the keys in defaultBindings. * Added function to SonicPiShortcuts to get all shortcuts & current key bindings. * Fix Windows shortcut for Redo.
Collaborator
|
Interesting. I definitely think there's scope for some nicer UI for working with shortcuts. I wonder what the gold standard is here? One thing that I'm curious about with your design is how it handles really long lists of shortcuts - will that be scrollable content within the prefs? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, it's been a while! I've seen that some work has been done on shortcut configuration, and had some motivation to have a look at it a bit. Hopefully these changes manage to improve/simplify shortcut handling:
Features/bug fixes
WIP: Need to add some text to the shortcut settings tab, test the user shortcut mode, and do a once over of the code.
Screenshots
The current UI is shown below:

Testing
I'm only able to test this on Debian (Trixie) - it'll probably want testing on Windows/Mac as well.
I'm unsure whether the code I've written is Qt5 compatible, but I assume Qt6 is becoming the main option anyways.I just saw the commit deprecating Qt5, so I'm going to assume using Qt6 features is fine.Feedback & suggestions are welcome :)