citra_qt: Improvements to hotkeys and ui state management (#6224)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user