summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-11-03 20:38:39 -0400
committerGravatar Zach Hilman2018-11-03 20:38:39 -0400
commit52e7e8eed3daee0de13f7ab114c87cedd3e2a46b (patch)
tree9d42f7ddf9a22651d280c63a9cad4a4a3e3f2801
parentMerge pull request #1636 from ogniK5377/hwopus-bad-assert (diff)
downloadyuzu-52e7e8eed3daee0de13f7ab114c87cedd3e2a46b.tar.gz
yuzu-52e7e8eed3daee0de13f7ab114c87cedd3e2a46b.tar.xz
yuzu-52e7e8eed3daee0de13f7ab114c87cedd3e2a46b.zip
game_list: Only reload game list after relevant settings changed
Prevents unnecessary reloads on every configuration operation.
-rw-r--r--src/yuzu/configuration/configure_gamelist.cpp14
-rw-r--r--src/yuzu/configuration/configure_gamelist.h2
-rw-r--r--src/yuzu/configuration/configure_general.cpp3
-rw-r--r--src/yuzu/main.cpp8
-rw-r--r--src/yuzu/ui_settings.h2
5 files changed, 28 insertions, 1 deletions
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp
index 8743ce982..0112bd950 100644
--- a/src/yuzu/configuration/configure_gamelist.cpp
+++ b/src/yuzu/configuration/configure_gamelist.cpp
@@ -36,6 +36,16 @@ ConfigureGameList::ConfigureGameList(QWidget* parent)
36 InitializeRowComboBoxes(); 36 InitializeRowComboBoxes();
37 37
38 this->setConfiguration(); 38 this->setConfiguration();
39
40 // Force game list reload if any of the relevant settings are changed.
41 connect(ui->show_unknown, &QCheckBox::stateChanged, this,
42 &ConfigureGameList::RequestGameListUpdate);
43 connect(ui->icon_size_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
44 &ConfigureGameList::RequestGameListUpdate);
45 connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
46 &ConfigureGameList::RequestGameListUpdate);
47 connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
48 &ConfigureGameList::RequestGameListUpdate);
39} 49}
40 50
41ConfigureGameList::~ConfigureGameList() = default; 51ConfigureGameList::~ConfigureGameList() = default;
@@ -48,6 +58,10 @@ void ConfigureGameList::applyConfiguration() {
48 Settings::Apply(); 58 Settings::Apply();
49} 59}
50 60
61void ConfigureGameList::RequestGameListUpdate() {
62 UISettings::values.is_game_list_reload_pending.exchange(true);
63}
64
51void ConfigureGameList::setConfiguration() { 65void ConfigureGameList::setConfiguration() {
52 ui->show_unknown->setChecked(UISettings::values.show_unknown); 66 ui->show_unknown->setChecked(UISettings::values.show_unknown);
53 ui->icon_size_combobox->setCurrentIndex( 67 ui->icon_size_combobox->setCurrentIndex(
diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_gamelist.h
index ff7406c60..bbf7e25f1 100644
--- a/src/yuzu/configuration/configure_gamelist.h
+++ b/src/yuzu/configuration/configure_gamelist.h
@@ -21,6 +21,8 @@ public:
21 void applyConfiguration(); 21 void applyConfiguration();
22 22
23private: 23private:
24 void RequestGameListUpdate();
25
24 void setConfiguration(); 26 void setConfiguration();
25 27
26 void changeEvent(QEvent*) override; 28 void changeEvent(QEvent*) override;
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index 537d6e576..8e77558fa 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -19,6 +19,9 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
19 19
20 this->setConfiguration(); 20 this->setConfiguration();
21 21
22 connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this,
23 [] { UISettings::values.is_game_list_reload_pending.exchange(true); });
24
22 ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); 25 ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
23 ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn()); 26 ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn());
24} 27}
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c5a56cbfd..e9253493b 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1328,7 +1328,13 @@ void GMainWindow::OnConfigure() {
1328 UpdateUITheme(); 1328 UpdateUITheme();
1329 if (UISettings::values.enable_discord_presence != old_discord_presence) 1329 if (UISettings::values.enable_discord_presence != old_discord_presence)
1330 SetDiscordEnabled(UISettings::values.enable_discord_presence); 1330 SetDiscordEnabled(UISettings::values.enable_discord_presence);
1331 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); 1331
1332 const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
1333 if (reload) {
1334 game_list->PopulateAsync(UISettings::values.gamedir,
1335 UISettings::values.gamedir_deepscan);
1336 }
1337
1332 config->Save(); 1338 config->Save();
1333 } 1339 }
1334} 1340}
diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h
index 2e617d52a..af1c9432f 100644
--- a/src/yuzu/ui_settings.h
+++ b/src/yuzu/ui_settings.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <array> 7#include <array>
8#include <atomic>
8#include <vector> 9#include <vector>
9#include <QByteArray> 10#include <QByteArray>
10#include <QString> 11#include <QString>
@@ -62,6 +63,7 @@ struct Values {
62 uint32_t icon_size; 63 uint32_t icon_size;
63 uint8_t row_1_text_id; 64 uint8_t row_1_text_id;
64 uint8_t row_2_text_id; 65 uint8_t row_2_text_id;
66 std::atomic_bool is_game_list_reload_pending{false};
65}; 67};
66 68
67extern Values values; 69extern Values values;