diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 40 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 7 |
2 files changed, 23 insertions, 24 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index e6141e6a9..30b6f7b28 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -95,42 +95,42 @@ void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, | |||
| 95 | 95 | ||
| 96 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, | 96 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, |
| 97 | const Settings::Setting<bool>& setting, | 97 | const Settings::Setting<bool>& setting, |
| 98 | ConfigurationShared::CheckState& tracker) { | 98 | CheckState& tracker) { |
| 99 | if (setting.UsingGlobal()) { | 99 | if (setting.UsingGlobal()) { |
| 100 | tracker = CheckState::Global; | 100 | tracker = CheckState::Global; |
| 101 | } else { | 101 | } else { |
| 102 | tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; | 102 | tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; |
| 103 | } | 103 | } |
| 104 | SetHighlight(checkbox, name, tracker != CheckState::Global); | 104 | SetHighlight(checkbox, name, tracker != CheckState::Global); |
| 105 | QObject::connect( | 105 | QObject::connect(checkbox, &QCheckBox::clicked, checkbox, |
| 106 | checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() { | 106 | [checkbox, name, setting, &tracker]() { |
| 107 | tracker = | 107 | tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) % |
| 108 | static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); | 108 | static_cast<int>(CheckState::Count)); |
| 109 | if (tracker == CheckState::Global) { | 109 | if (tracker == CheckState::Global) { |
| 110 | checkbox->setChecked(setting.GetValue(true)); | 110 | checkbox->setChecked(setting.GetValue(true)); |
| 111 | } | 111 | } |
| 112 | SetHighlight(checkbox, name, tracker != CheckState::Global); | 112 | SetHighlight(checkbox, name, tracker != CheckState::Global); |
| 113 | }); | 113 | }); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, | 116 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, |
| 117 | bool global, bool state, bool global_state, | 117 | bool global, bool state, bool global_state, |
| 118 | ConfigurationShared::CheckState& tracker) { | 118 | CheckState& tracker) { |
| 119 | if (global) { | 119 | if (global) { |
| 120 | tracker = CheckState::Global; | 120 | tracker = CheckState::Global; |
| 121 | } else { | 121 | } else { |
| 122 | tracker = (state == global_state) ? CheckState::On : CheckState::Off; | 122 | tracker = (state == global_state) ? CheckState::On : CheckState::Off; |
| 123 | } | 123 | } |
| 124 | SetHighlight(checkbox, name, tracker != CheckState::Global); | 124 | SetHighlight(checkbox, name, tracker != CheckState::Global); |
| 125 | QObject::connect( | 125 | QObject::connect(checkbox, &QCheckBox::clicked, checkbox, |
| 126 | checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, global_state, &tracker]() { | 126 | [checkbox, name, global_state, &tracker]() { |
| 127 | tracker = | 127 | tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) % |
| 128 | static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); | 128 | static_cast<int>(CheckState::Count)); |
| 129 | if (tracker == CheckState::Global) { | 129 | if (tracker == CheckState::Global) { |
| 130 | checkbox->setChecked(global_state); | 130 | checkbox->setChecked(global_state); |
| 131 | } | 131 | } |
| 132 | SetHighlight(checkbox, name, tracker != CheckState::Global); | 132 | SetHighlight(checkbox, name, tracker != CheckState::Global); |
| 133 | }); | 133 | }); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, | 136 | void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4cea7406f..e9d765b94 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -15,7 +15,7 @@ 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 | enum CheckState { | 18 | enum class CheckState { |
| 19 | Off, | 19 | Off, |
| 20 | On, | 20 | On, |
| 21 | Global, | 21 | Global, |
| @@ -42,10 +42,9 @@ void SetPerGameSetting(QComboBox* combobox, | |||
| 42 | 42 | ||
| 43 | void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); | 43 | void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); |
| 44 | void SetColoredTristate(QCheckBox* checkbox, const std::string& name, | 44 | void SetColoredTristate(QCheckBox* checkbox, const std::string& name, |
| 45 | const Settings::Setting<bool>& setting, | 45 | const Settings::Setting<bool>& setting, CheckState& tracker); |
| 46 | ConfigurationShared::CheckState& tracker); | ||
| 47 | void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, | 46 | void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, |
| 48 | bool global_state, ConfigurationShared::CheckState& tracker); | 47 | bool global_state, CheckState& tracker); |
| 49 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, | 48 | void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, |
| 50 | int global); | 49 | int global); |
| 51 | 50 | ||