diff options
| author | 2021-05-19 16:00:48 -0400 | |
|---|---|---|
| committer | 2021-05-19 16:00:48 -0400 | |
| commit | 12ef74456c466163345a0d800ba11c5d408993e4 (patch) | |
| tree | 69512a77b738321ee52766deadd42dd9847af05b | |
| parent | general: Demote custom_rtc to regular setting (diff) | |
| download | yuzu-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.cpp | 43 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 16 |
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 | ||
| 42 | void 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 | |||
| 57 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, | 42 | void 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 | ||
| 66 | void 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 | |||
| 73 | void 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 | |||
| 80 | void 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 | |||
| 87 | void 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 | |||
| 94 | void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { | 51 | void 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 { | |||
| 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, |
| 30 | const CheckState& tracker); | 30 | const CheckState& tracker); |
| 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); | 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); |
| 32 | void 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 |
| 36 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 34 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); |
| 37 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting); | 35 | |
| 38 | void SetPerGameSetting(QComboBox* combobox, | 36 | template <typename Type> |
| 39 | const Settings::Setting<Settings::RendererBackend>* setting); | 37 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setting) { |
| 40 | void 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()) + |
| 42 | void 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 |
| 46 | void SetHighlight(QWidget* widget, bool highlighted); | 44 | void SetHighlight(QWidget* widget, bool highlighted); |