Skip to content

Clean up shortcuts without actions and load all shortcuts as late as possible #29388

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

krasko78
Copy link
Contributor

Resolves: #29054

A couple of commits in the PR:

  1. Renames one shortcut's action and deletes the rest of the shortcuts for which no corresponding actions exists. This removes all warnings about invalid actions except for the ones related to plugins.

  2. The second group of warnings about invalid actions in the form action://extensions/... is dealt with in the second commit. Those actions are added when ExtensionsModule's onDelayedInit() executes which currently happens after the ShortcutsModule has loaded all the shortcuts. As a result, the loading of the shortcuts does not find the actions for the extensions. The solution I see and that I've implemented here is to move the ShortcutsModule at the end of the modules list and the loading of the shortcuts in a new onDelayedInit() method of the ShortcutsModule. Although the order of the modules should not matter, this is not really the case and has produced various issues, so moving the ShortcutsModule further down the list is a bit of a risky change and needs to be tested well. In my testing I looked at the uses of shortcutsRegister()->shortcut and shortcutsRegister()->shortcuts() by any code that executes before ShortcutsModule::onDelayedInit() and here's what I found:

  • UiActionsRegister::updateShortcuts and UiActionsRegister::updateShortcutsAll()
  • TextInputModel::loadShortcuts()
  • LayoutPanelTreeModel::addInstrumentsKeyboardShortcut()
  • ShortcutsInstanceModel::doLoadShortcuts()

and then ShortcutsModule::onDelayedInit() executes. It calls ShortcutsRegister::reload which loads all shortcuts and at the end emits m_shortcutsChanged. Luckily, all classes above - UiActionsRegister, TextInputModel, LayoutPanelTreeModel and ShortcutsInstanceModel- have subscribed to this signal and reload their shortcuts when they are notified about it. So theoretically all shortcuts should continue to work. I didn't find issues in my testing but again we need to test this well. Whoever reviews this PR (I suppose Igor) - let me know what you think.

I spotted a small issue in TextInputModel::loadShortcuts() which is fixed in the second commit as well.

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@krasko78 krasko78 force-pushed the 29054-CleanUpShortcutsWithoutActions branch from a2a4403 to b213f61 Compare August 20, 2025 20:57
@krasko78
Copy link
Contributor Author

@DmitryArefiev @zacjansheski In addition to verifying the warnings are gone, can you please do some shortcuts testing to ensure shortcuts work as before? Any shortcuts you can think of - menus, toolbars, percussion panel, plugins, etc. Many thanks!

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

Successfully merging this pull request may close these issues.

A bunch of "ignoring shortcut for invalid action" warnings in the logs
2 participants