diff options
| -rw-r--r-- | src/yuzu/configuration/configure_dialog.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_hotkeys.cpp | 19 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_hotkeys.h | 3 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 51bd1f121..a5218b051 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "yuzu/hotkeys.h" | 12 | #include "yuzu/hotkeys.h" |
| 13 | 13 | ||
| 14 | ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry) | 14 | ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry) |
| 15 | : QDialog(parent), registry(registry), ui(new Ui::ConfigureDialog) { | 15 | : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { |
| 16 | ui->setupUi(this); | 16 | ui->setupUi(this); |
| 17 | ui->hotkeysTab->Populate(registry); | 17 | ui->hotkeysTab->Populate(registry); |
| 18 | this->setConfiguration(); | 18 | this->setConfiguration(); |
diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index bfb562535..a7a8752e5 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp | |||
| @@ -66,20 +66,21 @@ void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) { | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void ConfigureHotkeys::Configure(QModelIndex index) { | 68 | void ConfigureHotkeys::Configure(QModelIndex index) { |
| 69 | if (index.parent() == QModelIndex()) | 69 | if (!index.parent().isValid()) { |
| 70 | return; | 70 | return; |
| 71 | } | ||
| 71 | 72 | ||
| 72 | index = index.sibling(index.row(), 1); | 73 | index = index.sibling(index.row(), 1); |
| 73 | auto* model = ui->hotkey_list->model(); | 74 | auto* const model = ui->hotkey_list->model(); |
| 74 | auto previous_key = model->data(index); | 75 | const auto previous_key = model->data(index); |
| 75 | |||
| 76 | auto* hotkey_dialog = new SequenceDialog; | ||
| 77 | int return_code = hotkey_dialog->exec(); | ||
| 78 | 76 | ||
| 79 | auto key_sequence = hotkey_dialog->GetSequence(); | 77 | SequenceDialog hotkey_dialog{this}; |
| 80 | 78 | ||
| 81 | if (return_code == QDialog::Rejected || key_sequence.isEmpty()) | 79 | const int return_code = hotkey_dialog.exec(); |
| 80 | const auto key_sequence = hotkey_dialog.GetSequence(); | ||
| 81 | if (return_code == QDialog::Rejected || key_sequence.isEmpty()) { | ||
| 82 | return; | 82 | return; |
| 83 | } | ||
| 83 | 84 | ||
| 84 | if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) { | 85 | if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) { |
| 85 | QMessageBox::critical(this, tr("Error in inputted key"), | 86 | QMessageBox::critical(this, tr("Error in inputted key"), |
| @@ -90,7 +91,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) { | |||
| 90 | } | 91 | } |
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) { | 94 | bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { |
| 94 | return GetUsedKeyList().contains(key_sequence); | 95 | return GetUsedKeyList().contains(key_sequence); |
| 95 | } | 96 | } |
| 96 | 97 | ||
diff --git a/src/yuzu/configuration/configure_hotkeys.h b/src/yuzu/configuration/configure_hotkeys.h index cd203aad6..73fb8a175 100644 --- a/src/yuzu/configuration/configure_hotkeys.h +++ b/src/yuzu/configuration/configure_hotkeys.h | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <QWidget> | 8 | #include <QWidget> |
| 9 | #include "core/settings.h" | ||
| 10 | 9 | ||
| 11 | namespace Ui { | 10 | namespace Ui { |
| 12 | class ConfigureHotkeys; | 11 | class ConfigureHotkeys; |
| @@ -39,7 +38,7 @@ signals: | |||
| 39 | 38 | ||
| 40 | private: | 39 | private: |
| 41 | void Configure(QModelIndex index); | 40 | void Configure(QModelIndex index); |
| 42 | bool IsUsedKey(QKeySequence key_sequence); | 41 | bool IsUsedKey(QKeySequence key_sequence) const; |
| 43 | QList<QKeySequence> GetUsedKeyList() const; | 42 | QList<QKeySequence> GetUsedKeyList() const; |
| 44 | 43 | ||
| 45 | std::unique_ptr<Ui::ConfigureHotkeys> ui; | 44 | std::unique_ptr<Ui::ConfigureHotkeys> ui; |