mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
citra-qt: Use structured bindings where applicable in ConfigureHotkeys::applyConfiguration
. Fix a few minor issues.
* Address https://github.com/citra-emu/citra/pull/4437#discussion_r241380912
This commit is contained in:
parent
dccd1664ad
commit
71f36efd27
@ -17,7 +17,7 @@ class ConfigureDialog : public QDialog {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigureDialog(QWidget* parent, const HotkeyRegistry& registry);
|
explicit ConfigureDialog(QWidget* parent, HotkeyRegistry& registry);
|
||||||
~ConfigureDialog() override;
|
~ConfigureDialog() override;
|
||||||
|
|
||||||
void UpdateVisibleTabs();
|
void UpdateVisibleTabs();
|
||||||
|
@ -107,15 +107,13 @@ void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) {
|
|||||||
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
|
||||||
QStandardItem* action = parent->child(key_column_id, 0);
|
QStandardItem* action = parent->child(key_column_id, 0);
|
||||||
QStandardItem* keyseq = parent->child(key_column_id, 1);
|
QStandardItem* keyseq = parent->child(key_column_id, 1);
|
||||||
for (auto key_iterator = registry.hotkey_groups.begin();
|
for (auto& [group, sub_actions] : registry.hotkey_groups) {
|
||||||
key_iterator != registry.hotkey_groups.end(); ++key_iterator) {
|
if (group != parent->text())
|
||||||
if (key_iterator->first == parent->text()) {
|
continue;
|
||||||
for (auto it2 = key_iterator->second.begin(); it2 != key_iterator->second.end();
|
for (auto& [action_name, hotkey] : sub_actions) {
|
||||||
++it2) {
|
if (action_name != action->text())
|
||||||
if (it2->first == action->text()) {
|
continue;
|
||||||
it2->second.keyseq = QKeySequence(keyseq->text());
|
hotkey.keyseq = QKeySequence(keyseq->text());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,11 @@ void HotkeyRegistry::LoadHotkeys() {
|
|||||||
hk.keyseq = QKeySequence::fromString(shortcut.shortcut.first, QKeySequence::NativeText);
|
hk.keyseq = QKeySequence::fromString(shortcut.shortcut.first, QKeySequence::NativeText);
|
||||||
hk.context = (Qt::ShortcutContext)shortcut.shortcut.second;
|
hk.context = (Qt::ShortcutContext)shortcut.shortcut.second;
|
||||||
}
|
}
|
||||||
if (hk.shortcut)
|
if (hk.shortcut) {
|
||||||
|
hk.shortcut->disconnect();
|
||||||
hk.shortcut->setKey(hk.keyseq);
|
hk.shortcut->setKey(hk.keyseq);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QWidget* widget) {
|
QShortcut* HotkeyRegistry::GetHotkey(const QString& group, const QString& action, QWidget* widget) {
|
||||||
|
Loading…
Reference in New Issue
Block a user