From ec837cd16c53065bab175cb8d259b236a0e7ca1f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 May 2019 01:08:13 -0400 Subject: [PATCH 1/5] sequence_dialog: Remove unnecessary horizontal specifier QDialogButtonBoxes are horizontal by default. --- src/citra_qt/util/sequence_dialog/sequence_dialog.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp index 8eff35621..9ccc89526 100644 --- a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp +++ b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp @@ -12,8 +12,7 @@ SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) { auto* layout = new QVBoxLayout(this); key_sequence = new QKeySequenceEdit; layout->addWidget(key_sequence); - auto* buttons = - new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal); + auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); buttons->setCenterButtons(true); layout->addWidget(buttons); connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); From 4b5cbcae21bcae9acfc7992dded539e382c755de Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 May 2019 01:11:01 -0400 Subject: [PATCH 2/5] sequence_dialog: Reorganize the constructor The previous code was all "smushed" together wasn't really grouped together that well. This spaces things out and separates them by relation to one another, making it easier to visually parse the individual sections of code that make up the constructor. --- .../util/sequence_dialog/sequence_dialog.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp index 9ccc89526..1cfe3c0bd 100644 --- a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp +++ b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp @@ -9,15 +9,19 @@ SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("Enter a hotkey")); - auto* layout = new QVBoxLayout(this); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); + key_sequence = new QKeySequenceEdit; - layout->addWidget(key_sequence); - auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + + auto* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); buttons->setCenterButtons(true); + + auto* const layout = new QVBoxLayout(this); + layout->addWidget(key_sequence); layout->addWidget(buttons); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); } SequenceDialog::~SequenceDialog() = default; From 640543f8e4db0981910da21ac569f77eba04d4da Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 May 2019 04:06:48 -0400 Subject: [PATCH 3/5] configure_hotkeys: Change critical error dialog into a warning dialog critical() is intended for critical/fatal errors that threaten the overall stability of an application. A user entering a conflicting key sequence is neither of those. --- src/citra_qt/configuration/configure_hotkeys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/configuration/configure_hotkeys.cpp b/src/citra_qt/configuration/configure_hotkeys.cpp index fb4b7455a..bb990b900 100644 --- a/src/citra_qt/configuration/configure_hotkeys.cpp +++ b/src/citra_qt/configuration/configure_hotkeys.cpp @@ -87,8 +87,8 @@ void ConfigureHotkeys::Configure(QModelIndex index) { } if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) { - QMessageBox::critical(this, tr("Error in inputted key"), - tr("You're using a key that's already bound.")); + QMessageBox::warning(this, tr("Error in inputted key"), + tr("You're using a key that's already bound.")); } else { model->setData(index, key_sequence.toString(QKeySequence::NativeText)); EmitHotkeysChanged(); From 0a65f68b4ad100a84459870cc51a004091efc219 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 May 2019 04:19:51 -0400 Subject: [PATCH 4/5] configure_hotkeys: Tidy up key sequence conflict error string Avoids mentioning the user and formalizes the error itself. --- src/citra_qt/configuration/configure_hotkeys.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/configuration/configure_hotkeys.cpp b/src/citra_qt/configuration/configure_hotkeys.cpp index bb990b900..551d36758 100644 --- a/src/citra_qt/configuration/configure_hotkeys.cpp +++ b/src/citra_qt/configuration/configure_hotkeys.cpp @@ -87,8 +87,8 @@ void ConfigureHotkeys::Configure(QModelIndex index) { } if (IsUsedKey(key_sequence) && key_sequence != QKeySequence(previous_key.toString())) { - QMessageBox::warning(this, tr("Error in inputted key"), - tr("You're using a key that's already bound.")); + QMessageBox::warning(this, tr("Conflicting Key Sequence"), + tr("The entered key sequence is already assigned to another hotkey.")); } else { model->setData(index, key_sequence.toString(QKeySequence::NativeText)); EmitHotkeysChanged(); From 9fc3e4576ba10e839a7baa0332d1d0562cd1fec0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 25 May 2019 04:34:51 -0400 Subject: [PATCH 5/5] configure_hotkeys: Remove unnecessary Settings::Apply() call Nothing from the hotkeys dialog relies on this call occurring, and is already called from the dialog that calls applyConfiguration(). --- src/citra_qt/configuration/configure_hotkeys.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/citra_qt/configuration/configure_hotkeys.cpp b/src/citra_qt/configuration/configure_hotkeys.cpp index 551d36758..60c481aaf 100644 --- a/src/citra_qt/configuration/configure_hotkeys.cpp +++ b/src/citra_qt/configuration/configure_hotkeys.cpp @@ -118,7 +118,6 @@ void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) { } registry.SaveHotkeys(); - Settings::Apply(); } void ConfigureHotkeys::retranslateUi() {