diff options
author | bunnei <bunneidev@gmail.com> | 2019-04-17 04:13:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 04:13:12 +0200 |
commit | 2654eb659e24d2d29df83516a98600f3277d2dad (patch) | |
tree | d2866cd4ed84e7ae1b51548d6787fc0f3cf23b7e | |
parent | Merge pull request #2401 from lioncash/guard (diff) | |
parent | configure_hotkeys: Pass the dialog as a parent to SequenceDialog() (diff) | |
download | yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar.gz yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar.bz2 yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar.lz yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar.xz yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.tar.zst yuzu-2654eb659e24d2d29df83516a98600f3277d2dad.zip |
-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 @@ #include "yuzu/hotkeys.h" ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry) - : QDialog(parent), registry(registry), ui(new Ui::ConfigureDialog) { + : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { ui->setupUi(this); ui->hotkeysTab->Populate(registry); 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) { } void ConfigureHotkeys::Configure(QModelIndex index) { - if (index.parent() == QModelIndex()) + if (!index.parent().isValid()) { return; + } index = index.sibling(index.row(), 1); - auto* model = ui->hotkey_list->model(); - auto previous_key = model->data(index); - - auto* hotkey_dialog = new SequenceDialog; - int return_code = hotkey_dialog->exec(); + auto* const model = ui->hotkey_list->model(); + const auto previous_key = model->data(index); - auto key_sequence = hotkey_dialog->GetSequence(); + SequenceDialog hotkey_dialog{this}; - if (return_code == QDialog::Rejected || key_sequence.isEmpty()) + const int return_code = hotkey_dialog.exec(); + const auto key_sequence = hotkey_dialog.GetSequence(); + if (return_code == QDialog::Rejected || key_sequence.isEmpty()) { return; + } if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) { QMessageBox::critical(this, tr("Error in inputted key"), @@ -90,7 +91,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) { } } -bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) { +bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { return GetUsedKeyList().contains(key_sequence); } 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 @@ #include <memory> #include <QWidget> -#include "core/settings.h" namespace Ui { class ConfigureHotkeys; @@ -39,7 +38,7 @@ signals: private: void Configure(QModelIndex index); - bool IsUsedKey(QKeySequence key_sequence); + bool IsUsedKey(QKeySequence key_sequence) const; QList<QKeySequence> GetUsedKeyList() const; std::unique_ptr<Ui::ConfigureHotkeys> ui; |