feat(hotkeys): Add controller overlay hotkey and fix saving bug #14

Merged
Collecting merged 5 commits from fix/hotkey-memory into main 2025-11-01 21:11:20 +00:00
Owner

This commit addresses a critical bug in the hotkey system that prevented unassigned hotkeys from being saved, and also introduces a new hotkey for the controller overlay.

- Fix: Unassigned Hotkeys Not Saving

  1. Hotkeys assigned to actions that were blank by default (e.g., "Toggle Performance Overlay") would not persist after restarting the application.

  2. The root cause was flawed logic in SaveHotkeys and qt_config.cpp which only considered actions that had a pre-existing default value. The system was blind to any action that started as unassigned.

  3. The SaveHotkeys logic has been rewritten to iterate over all known actions and compare their current state against their default. Only hotkeys that differ from the default are written to the configuration, correctly capturing newly assigned keys.

  4. The LoadHotkeys logic has been improved to first populate the registry with all defaults before applying the user's saved settings.

  5. qt_config.cpp's shortcut functions were simplified to perform straightforward serialization, making the HotkeyRegistry the single source of truth.

- Feature: Add Controller Overlay Hotkey

  1. A new, configurable hotkey for "Toggle Controller Overlay" has been added. I overlooked this during the process of creating the Overlay itself, my mistake.

  2. The action was registered in the default hotkeys list (uisettings.h) and linked to its QAction in main.cpp.

Thanks to user @choyz for letting us know about this issue.

This commit addresses a critical bug in the hotkey system that prevented unassigned hotkeys from being saved, and also introduces a new hotkey for the controller overlay. **- Fix: Unassigned Hotkeys Not Saving** 1. Hotkeys assigned to actions that were blank by default (e.g., "Toggle Performance Overlay") would not persist after restarting the application. 2. The root cause was flawed logic in SaveHotkeys and qt_config.cpp which only considered actions that had a pre-existing default value. The system was blind to any action that started as unassigned. 3. The SaveHotkeys logic has been rewritten to iterate over all known actions and compare their current state against their default. Only hotkeys that differ from the default are written to the configuration, correctly capturing newly assigned keys. 4. The LoadHotkeys logic has been improved to first populate the registry with all defaults before applying the user's saved settings. 5. qt_config.cpp's shortcut functions were simplified to perform straightforward serialization, making the HotkeyRegistry the single source of truth. **- Feature: Add Controller Overlay Hotkey** 1. A new, configurable hotkey for "Toggle Controller Overlay" has been added. I overlooked this during the process of creating the Overlay itself, my mistake. 2. The action was registered in the default hotkeys list (uisettings.h) and linked to its QAction in main.cpp. Thanks to user [@choyz](https://git.citron-emu.org/choyz) for letting us know about this [issue.](https://git.citron-emu.org/Citron/Emulator/issues/13)
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Signed-off-by: Collecting <collecting@noreply.localhost>
Collecting deleted branch fix/hotkey-memory 2025-11-01 21:15:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Citron/Emulator!14
No description provided.