diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp index 0c9e34d05d..961280430f 100644 --- a/src/citra_qt/configuration/configure_dialog.cpp +++ b/src/citra_qt/configuration/configure_dialog.cpp @@ -11,7 +11,7 @@ #include "ui_configure.h" ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool enable_web_config) - : QDialog(parent), registry(registry), ui(new Ui::ConfigureDialog) { + : QDialog(parent), ui(new Ui::ConfigureDialog), registry(registry) { ui->setupUi(this); ui->hotkeysTab->Populate(registry); ui->webTab->SetWebServiceConfigEnabled(enable_web_config); diff --git a/src/citra_qt/configuration/configure_hotkeys.cpp b/src/citra_qt/configuration/configure_hotkeys.cpp index aae212b5da..fb4b7455ab 100644 --- a/src/citra_qt/configuration/configure_hotkeys.cpp +++ b/src/citra_qt/configuration/configure_hotkeys.cpp @@ -35,7 +35,7 @@ void ConfigureHotkeys::EmitHotkeysChanged() { emit HotkeysChanged(GetUsedKeyList()); } -QList ConfigureHotkeys::GetUsedKeyList() { +QList ConfigureHotkeys::GetUsedKeyList() const { QList list; for (int r = 0; r < model->rowCount(); r++) { QStandardItem* parent = model->item(r, 0); @@ -70,20 +70,21 @@ void ConfigureHotkeys::OnInputKeysChanged(QList new_key_list) { } 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* const model = ui->hotkey_list->model(); + const auto previous_key = model->data(index); - auto* hotkey_dialog = new SequenceDialog; - int return_code = hotkey_dialog->exec(); + SequenceDialog hotkey_dialog{this}; - auto key_sequence = hotkey_dialog->GetSequence(); - - 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"), @@ -94,7 +95,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) { } } -bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) { +bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { return input_keys_list.contains(key_sequence) || GetUsedKeyList().contains(key_sequence); } diff --git a/src/citra_qt/configuration/configure_hotkeys.h b/src/citra_qt/configuration/configure_hotkeys.h index bd2c1542ca..30b6784eff 100644 --- a/src/citra_qt/configuration/configure_hotkeys.h +++ b/src/citra_qt/configuration/configure_hotkeys.h @@ -6,7 +6,6 @@ #include #include -#include "core/settings.h" namespace Ui { class ConfigureHotkeys; @@ -42,8 +41,8 @@ signals: private: void Configure(QModelIndex index); - bool IsUsedKey(QKeySequence key_sequence); - QList GetUsedKeyList(); + bool IsUsedKey(QKeySequence key_sequence) const; + QList GetUsedKeyList() const; std::unique_ptr ui;