game_list: Avoid refreshing game list if settings aren't changed
This commit is contained in:
@@ -36,6 +36,16 @@ ConfigureGameList::ConfigureGameList(QWidget* parent)
|
|||||||
InitializeRowComboBoxes();
|
InitializeRowComboBoxes();
|
||||||
|
|
||||||
this->setConfiguration();
|
this->setConfiguration();
|
||||||
|
|
||||||
|
// Force game list reload if any of the relevant settings are changed.
|
||||||
|
connect(ui->show_unknown, &QCheckBox::stateChanged, this,
|
||||||
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
|
connect(ui->icon_size_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
|
connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
|
connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGameList::~ConfigureGameList() = default;
|
ConfigureGameList::~ConfigureGameList() = default;
|
||||||
@@ -48,6 +58,10 @@ void ConfigureGameList::applyConfiguration() {
|
|||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigureGameList::RequestGameListUpdate() {
|
||||||
|
UISettings::values.is_game_list_reload_pending.exchange(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigureGameList::setConfiguration() {
|
void ConfigureGameList::setConfiguration() {
|
||||||
ui->show_unknown->setChecked(UISettings::values.show_unknown);
|
ui->show_unknown->setChecked(UISettings::values.show_unknown);
|
||||||
ui->icon_size_combobox->setCurrentIndex(
|
ui->icon_size_combobox->setCurrentIndex(
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public:
|
|||||||
|
|
||||||
void applyConfiguration();
|
void applyConfiguration();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void RequestGameListUpdate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
|
|||||||
|
|
||||||
ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->use_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
|
|
||||||
|
connect(ui->toggle_deepscan, &QCheckBox::stateChanged, this,
|
||||||
|
[]() { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGeneral::~ConfigureGeneral() = default;
|
ConfigureGeneral::~ConfigureGeneral() = default;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "yuzu/configuration/config.h"
|
#include "yuzu/configuration/config.h"
|
||||||
#include "yuzu/configuration/configure_input.h"
|
#include "yuzu/configuration/configure_input.h"
|
||||||
#include "yuzu/configuration/configure_per_general.h"
|
#include "yuzu/configuration/configure_per_general.h"
|
||||||
|
#include "yuzu/ui_settings.h"
|
||||||
|
|
||||||
ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent)
|
ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent)
|
||||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigurePerGameGeneral>()) {
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigurePerGameGeneral>()) {
|
||||||
@@ -59,6 +60,9 @@ ConfigurePerGameGeneral::ConfigurePerGameGeneral(QWidget* parent)
|
|||||||
ui->icon_view->setScene(scene);
|
ui->icon_view->setScene(scene);
|
||||||
|
|
||||||
this->loadConfiguration();
|
this->loadConfiguration();
|
||||||
|
|
||||||
|
connect(item_model, &QStandardItemModel::itemChanged, this,
|
||||||
|
[]() { UISettings::values.is_game_list_reload_pending.exchange(true); });
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default;
|
ConfigurePerGameGeneral::~ConfigurePerGameGeneral() = default;
|
||||||
|
|||||||
@@ -984,7 +984,9 @@ void GMainWindow::OnGameListOpenProperties(FileSys::VirtualFile file) {
|
|||||||
|
|
||||||
config->SetPerGameSettingsDelta(title_id, dialog.applyConfiguration());
|
config->SetPerGameSettingsDelta(title_id, dialog.applyConfiguration());
|
||||||
config->Save();
|
config->Save();
|
||||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
||||||
|
if (reload)
|
||||||
|
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadFile() {
|
void GMainWindow::OnMenuLoadFile() {
|
||||||
@@ -1355,7 +1357,11 @@ void GMainWindow::OnConfigure() {
|
|||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
if (UISettings::values.enable_discord_presence != old_discord_presence)
|
if (UISettings::values.enable_discord_presence != old_discord_presence)
|
||||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
||||||
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
|
const auto reload = UISettings::values.is_game_list_reload_pending.exchange(false);
|
||||||
|
if (reload) {
|
||||||
|
game_list->PopulateAsync(UISettings::values.gamedir,
|
||||||
|
UISettings::values.gamedir_deepscan);
|
||||||
|
}
|
||||||
config->Save();
|
config->Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <atomic>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -62,6 +63,7 @@ struct Values {
|
|||||||
uint32_t icon_size;
|
uint32_t icon_size;
|
||||||
uint8_t row_1_text_id;
|
uint8_t row_1_text_id;
|
||||||
uint8_t row_2_text_id;
|
uint8_t row_2_text_id;
|
||||||
|
std::atomic_bool is_game_list_reload_pending{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Values values;
|
extern Values values;
|
||||||
|
|||||||
Reference in New Issue
Block a user