mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-10 21:00:06 +00:00
citra_qt: Improvements to hotkeys and ui state management (#6224)
This commit is contained in:
parent
9b49d94644
commit
f66d03dd48
12 changed files with 383 additions and 292 deletions
|
@ -17,8 +17,8 @@ void HotkeyRegistry::SaveHotkeys() {
|
|||
for (const auto& hotkey : group.second) {
|
||||
UISettings::values.shortcuts.push_back(
|
||||
{hotkey.first, group.first,
|
||||
UISettings::ContextualShortcut(hotkey.second.keyseq.toString(),
|
||||
hotkey.second.context)});
|
||||
UISettings::ContextualShortcut(
|
||||
{hotkey.second.keyseq.toString(), hotkey.second.context})});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,9 +28,10 @@ void HotkeyRegistry::LoadHotkeys() {
|
|||
// beginGroup()
|
||||
for (auto shortcut : UISettings::values.shortcuts) {
|
||||
Hotkey& hk = hotkey_groups[shortcut.group][shortcut.name];
|
||||
if (!shortcut.shortcut.first.isEmpty()) {
|
||||
hk.keyseq = QKeySequence::fromString(shortcut.shortcut.first, QKeySequence::NativeText);
|
||||
hk.context = static_cast<Qt::ShortcutContext>(shortcut.shortcut.second);
|
||||
if (!shortcut.shortcut.keyseq.isEmpty()) {
|
||||
hk.keyseq =
|
||||
QKeySequence::fromString(shortcut.shortcut.keyseq, QKeySequence::NativeText);
|
||||
hk.context = static_cast<Qt::ShortcutContext>(shortcut.shortcut.context);
|
||||
}
|
||||
if (hk.shortcut) {
|
||||
hk.shortcut->disconnect();
|
||||
|
@ -42,8 +43,9 @@ void HotkeyRegistry::LoadHotkeys() {
|
|||
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QWidget* widget) {
|
||||
Hotkey& hk = hotkey_groups[group][action];
|
||||
|
||||
if (!hk.shortcut)
|
||||
if (!hk.shortcut) {
|
||||
hk.shortcut = new QShortcut(hk.keyseq, widget, nullptr, nullptr, hk.context);
|
||||
}
|
||||
|
||||
return hk.shortcut;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue