summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-05-25 10:03:15 +0200
committerLioncash <mathew1800@gmail.com>2019-05-25 10:08:13 +0200
commitef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df (patch)
treec6bc28e832786ccfc026fd131eadcade8ab1797f
parentconfigure_hotkeys: Remove unused EmitHotkeysChanged() (diff)
downloadyuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar.gz
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar.bz2
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar.lz
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar.xz
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.tar.zst
yuzu-ef3c0f54d0cdfc3a4a24daac93ecc65a4359b0df.zip
-rw-r--r--src/yuzu/configuration/configure_hotkeys.cpp28
-rw-r--r--src/yuzu/configuration/configure_hotkeys.h1
2 files changed, 15 insertions, 14 deletions
diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp
index 9155da4e8..02f2daabc 100644
--- a/src/yuzu/configuration/configure_hotkeys.cpp
+++ b/src/yuzu/configuration/configure_hotkeys.cpp
@@ -31,18 +31,6 @@ ConfigureHotkeys::ConfigureHotkeys(QWidget* parent)
ConfigureHotkeys::~ConfigureHotkeys() = default;
-QList<QKeySequence> ConfigureHotkeys::GetUsedKeyList() const {
- QList<QKeySequence> list;
- for (int r = 0; r < model->rowCount(); r++) {
- const QStandardItem* parent = model->item(r, 0);
- for (int r2 = 0; r2 < parent->rowCount(); r2++) {
- const QStandardItem* keyseq = parent->child(r2, 1);
- list << QKeySequence::fromString(keyseq->text(), QKeySequence::NativeText);
- }
- }
- return list;
-}
-
void ConfigureHotkeys::Populate(const HotkeyRegistry& registry) {
for (const auto& group : registry.hotkey_groups) {
auto* parent_item = new QStandardItem(group.first);
@@ -87,7 +75,21 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
}
bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
- return GetUsedKeyList().contains(key_sequence);
+ for (int r = 0; r < model->rowCount(); r++) {
+ const QStandardItem* const parent = model->item(r, 0);
+
+ for (int r2 = 0; r2 < parent->rowCount(); r2++) {
+ const QStandardItem* const key_seq_item = parent->child(r2, 1);
+ const auto key_seq_str = key_seq_item->text();
+ const auto key_seq = QKeySequence::fromString(key_seq_str, QKeySequence::NativeText);
+
+ if (key_sequence == key_seq) {
+ return true;
+ }
+ }
+ }
+
+ return false;
}
void ConfigureHotkeys::applyConfiguration(HotkeyRegistry& registry) {
diff --git a/src/yuzu/configuration/configure_hotkeys.h b/src/yuzu/configuration/configure_hotkeys.h
index 1bbe64114..e77d73c35 100644
--- a/src/yuzu/configuration/configure_hotkeys.h
+++ b/src/yuzu/configuration/configure_hotkeys.h
@@ -34,7 +34,6 @@ public:
private:
void Configure(QModelIndex index);
bool IsUsedKey(QKeySequence key_sequence) const;
- QList<QKeySequence> GetUsedKeyList() const;
std::unique_ptr<Ui::ConfigureHotkeys> ui;