diff options
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 5b344cdbd..0072dfe7f 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -15,23 +15,24 @@ constexpr int USE_GLOBAL_INDEX = 0; | |||
| 15 | constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; | 15 | constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; |
| 16 | constexpr int USE_GLOBAL_OFFSET = 2; | 16 | constexpr int USE_GLOBAL_OFFSET = 2; |
| 17 | 17 | ||
| 18 | // CheckBoxes require a tracker for their state since we emulate a tristate CheckBox | ||
| 18 | enum class CheckState { | 19 | enum class CheckState { |
| 19 | Off, | 20 | Off, // Checkbox overrides to off/false |
| 20 | On, | 21 | On, // Checkbox overrides to on/true |
| 21 | Global, | 22 | Global, // Checkbox defers to the global state |
| 22 | Count, | 23 | Count, // Simply the number of states, not a valid checkbox state |
| 23 | }; | 24 | }; |
| 24 | 25 | ||
| 25 | // Global-aware apply and set functions | 26 | // Global-aware apply and set functions |
| 26 | 27 | ||
| 28 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting | ||
| 27 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 29 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, |
| 28 | const CheckState& tracker); | 30 | const CheckState& tracker); |
| 29 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); | 31 | void ApplyPerGameSetting(Settings::Setting<int>* setting, const QComboBox* combobox); |
| 30 | void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting, | 32 | void ApplyPerGameSetting(Settings::Setting<Settings::RendererBackend>* setting, |
| 31 | const QComboBox* combobox); | 33 | const QComboBox* combobox); |
| 32 | void ApplyPerGameSetting(Settings::Setting<Settings::GPUAccuracy>* setting, | ||
| 33 | const QComboBox* combobox); | ||
| 34 | 34 | ||
| 35 | // Sets a Qt UI element given a Settings::Setting | ||
| 35 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 36 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); |
| 36 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting); | 37 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<int>* setting); |
| 37 | void SetPerGameSetting(QComboBox* combobox, | 38 | void SetPerGameSetting(QComboBox* combobox, |
| @@ -39,13 +40,20 @@ void SetPerGameSetting(QComboBox* combobox, | |||
| 39 | void SetPerGameSetting(QComboBox* combobox, | 40 | void SetPerGameSetting(QComboBox* combobox, |
| 40 | const Settings::Setting<Settings::GPUAccuracy>* setting); | 41 | const Settings::Setting<Settings::GPUAccuracy>* setting); |
| 41 | 42 | ||
| 43 | // (Un)highlights a Qt UI element | ||
| 42 | void SetHighlight(QWidget* widget, bool highlighted); | 44 | void SetHighlight(QWidget* widget, bool highlighted); |
| 45 | |||
| 46 | // Sets up a QCheckBox like a tristate one, given a Setting | ||
| 43 | void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting, | 47 | void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting, |
| 44 | CheckState& tracker); | 48 | CheckState& tracker); |
| 45 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, | 49 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, |
| 46 | CheckState& tracker); | 50 | CheckState& tracker); |
| 51 | |||
| 52 | // Sets up coloring of a QWidget `target` based on the state of a QComboBox, and calls | ||
| 53 | // InsertGlobalItem | ||
| 47 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); | 54 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, int global); |
| 48 | 55 | ||
| 56 | // Adds the "Use Global Configuration" selection and separator to the beginning of a QComboBox | ||
| 49 | void InsertGlobalItem(QComboBox* combobox, int global_index); | 57 | void InsertGlobalItem(QComboBox* combobox, int global_index); |
| 50 | 58 | ||
| 51 | } // namespace ConfigurationShared | 59 | } // namespace ConfigurationShared |