summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2021-05-19 16:00:48 -0400
committerGravatar lat9nq2021-05-19 16:00:48 -0400
commit12ef74456c466163345a0d800ba11c5d408993e4 (patch)
tree69512a77b738321ee52766deadd42dd9847af05b
parentgeneral: Demote custom_rtc to regular setting (diff)
downloadyuzu-12ef74456c466163345a0d800ba11c5d408993e4.tar.gz
yuzu-12ef74456c466163345a0d800ba11c5d408993e4.tar.xz
yuzu-12ef74456c466163345a0d800ba11c5d408993e4.zip
configuration_shared: Drop unused function and template another
Drops an unused variant of ApplyPerGameSetting, and turns the QComboBox variants of SetPerGameSetting into a template. Co-authored-by: Ameer J <52414509+ameerj@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r--src/yuzu/configuration/configuration_shared.cpp43
-rw-r--r--src/yuzu/configuration/configuration_shared.h16
2 files changed, 7 insertions, 52 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp
index 83ec83745..096e42e94 100644
--- a/src/yuzu/configuration/configuration_shared.cpp
+++ b/src/yuzu/configuration/configuration_shared.cpp
@@ -39,21 +39,6 @@ void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<int>* setting,
39 } 39 }
40} 40}
41 41
42void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
43 const QComboBox* combobox) {
44 if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) {
45 setting->SetValue(static_cast<Settings::RendererBackend>(combobox->currentIndex()));
46 } else if (!Settings::IsConfiguringGlobal()) {
47 if (combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
48 setting->SetGlobal(true);
49 } else {
50 setting->SetGlobal(false);
51 setting->SetValue(static_cast<Settings::RendererBackend>(
52 combobox->currentIndex() - ConfigurationShared::USE_GLOBAL_OFFSET));
53 }
54 }
55}
56
57void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, 42void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox,
58 const Settings::Setting<bool>* setting) { 43 const Settings::Setting<bool>* setting) {
59 if (setting->UsingGlobal()) { 44 if (setting->UsingGlobal()) {
@@ -63,34 +48,6 @@ void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox,
63 } 48 }
64} 49}
65 50
66void ConfigurationShared::SetPerGameSetting(QComboBox* combobox,
67 const Settings::Setting<int>* setting) {
68 combobox->setCurrentIndex(setting->UsingGlobal()
69 ? ConfigurationShared::USE_GLOBAL_INDEX
70 : setting->GetValue() + ConfigurationShared::USE_GLOBAL_OFFSET);
71}
72
73void ConfigurationShared::SetPerGameSetting(
74 QComboBox* combobox, const Settings::Setting<Settings::RendererBackend>* setting) {
75 combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
76 : static_cast<int>(setting->GetValue()) +
77 ConfigurationShared::USE_GLOBAL_OFFSET);
78}
79
80void ConfigurationShared::SetPerGameSetting(
81 QComboBox* combobox, const Settings::Setting<Settings::GPUAccuracy>* setting) {
82 combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
83 : static_cast<int>(setting->GetValue()) +
84 ConfigurationShared::USE_GLOBAL_OFFSET);
85}
86
87void ConfigurationShared::SetPerGameSetting(
88 QComboBox* combobox, const Settings::Setting<Settings::CPUAccuracy>* setting) {
89 combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
90 : static_cast<int>(setting->GetValue()) +
91 ConfigurationShared::USE_GLOBAL_OFFSET);
92}
93
94void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { 51void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) {
95 if (highlighted) { 52 if (highlighted) {
96 widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") 53 widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }")
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h
index 13f313a93..1e0ef01ca 100644
--- a/src/yuzu/configuration/configuration_shared.h
+++ b/src/yuzu/configuration/configuration_shared.h
@@ -29,18 +29,16 @@ enum class CheckState {
29void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, 29void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox,
30 const CheckState& tracker); 30 const CheckState& tracker);
31void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); 31void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox);
32void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting,
33 const QComboBox* combobox);
34 32
35// Sets a Qt UI element given a Settings::Setting 33// Sets a Qt UI element given a Settings::Setting
36void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); 34void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting);
37void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting); 35
38void SetPerGameSetting(QComboBox* combobox, 36template <typename Type>
39 const Settings::Setting<Settings::RendererBackend>* setting); 37void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setting) {
40void SetPerGameSetting(QComboBox* combobox, 38 combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX
41 const Settings::Setting<Settings::GPUAccuracy>* setting); 39 : static_cast<int>(setting->GetValue()) +
42void SetPerGameSetting(QComboBox* combobox, 40 ConfigurationShared::USE_GLOBAL_OFFSET);
43 const Settings::Setting<Settings::CPUAccuracy>* setting); 41}
44 42
45// (Un)highlights a Qt UI element 43// (Un)highlights a Qt UI element
46void SetHighlight(QWidget* widget, bool highlighted); 44void SetHighlight(QWidget* widget, bool highlighted);