summaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configuration_shared.cpp
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2021-05-15 22:59:38 -0400
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2021-05-15 22:59:38 -0400
commit4aac1ae4b1c39a8341cad7134c4bd356aeb83a3f (patch)
tree84b211c9f51182b892935ddd06f55e6e6b35c444 /src/yuzu/configuration/configuration_shared.cpp
parent59236b7d0f46e7486bcac0ef884fff424fa603df (diff)
configuration: Simplify applying per-game settings
Originally, every time we add a per-game setting, we'd have to guard for it when setting it on the global config, and use a specific function to do it for the per-game config. This moves the global check into the ApplyPerGameSetting function so that we can use it for changing both the global and per-game states. Less work for the programmer.
Diffstat (limited to 'src/yuzu/configuration/configuration_shared.cpp')
-rw-r--r--src/yuzu/configuration/configuration_shared.cpp42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp
index 89be4a62d..be6e0b668 100644
--- a/src/yuzu/configuration/configuration_shared.cpp
+++ b/src/yuzu/configuration/configuration_shared.cpp
@@ -13,32 +13,44 @@
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting,
const QCheckBox* checkbox,
const CheckState& tracker) {
- if (tracker == CheckState::Global) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
+ if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
setting->SetValue(checkbox->checkState());
+ } else if (!Settings::IsConfiguringGlobal()) {
+ if (tracker == CheckState::Global) {
+ setting->SetGlobal(true);
+ } else {
+ setting->SetGlobal(false);
+ setting->SetValue(checkbox->checkState());
+ }
}
}
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting,
const QComboBox* combobox) {
- if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
- setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET);
+ if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
+ setting->SetValue(combobox->currentIndex());
+ } else if (!Settings::IsConfiguringGlobal()) {
+ if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
+ setting->SetGlobal(true);
+ } else {
+ setting->SetGlobal(false);
+ setting->SetValue(combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET);
+ }
}
}
void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
const QComboBox* combobox) {
- if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
- setting->SetGlobal(true);
- } else {
- setting->SetGlobal(false);
- setting->SetValue(static_cast<Settings::RendererBackend>(
- combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET));
+ if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
+ setting->SetValue(static_cast<Settings::RendererBackend>(combobox->currentIndex()));
+ } else if (!Settings::IsConfiguringGlobal()) {
+ if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
+ setting->SetGlobal(true);
+ } else {
+ setting->SetGlobal(false);
+ setting->SetValue(static_cast<Settings::RendererBackend>(
+ combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET));
+ }
}
}