diff options
author | lat9nq <lat9nq@virginia.edu> | 2020-07-14 21:40:02 +0200 |
---|---|---|
committer | lat9nq <lat9nq@virginia.edu> | 2020-07-19 19:26:55 +0200 |
commit | 335aef78c43ec5b488575b5eb790ae6e32ec7b63 (patch) | |
tree | 1cbceacb97deb6125564a99ced9e662edf3bcad8 | |
parent | clang-format (diff) | |
download | yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar.gz yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar.bz2 yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar.lz yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar.xz yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.tar.zst yuzu-335aef78c43ec5b488575b5eb790ae6e32ec7b63.zip |
-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, void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting<bool>& setting, - ConfigurationShared::CheckState& tracker) { + CheckState& tracker) { if (setting.UsingGlobal()) { tracker = CheckState::Global; } else { tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; } SetHighlight(checkbox, name, tracker != CheckState::Global); - QObject::connect( - checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() { - tracker = - static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(setting.GetValue(true)); - } - SetHighlight(checkbox, name, tracker != CheckState::Global); - }); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, setting, &tracker]() { + tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) % + static_cast<int>(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, bool global_state, - ConfigurationShared::CheckState& tracker) { + CheckState& tracker) { if (global) { tracker = CheckState::Global; } else { tracker = (state == global_state) ? CheckState::On : CheckState::Off; } SetHighlight(checkbox, name, tracker != CheckState::Global); - QObject::connect( - checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, global_state, &tracker]() { - tracker = - static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(global_state); - } - SetHighlight(checkbox, name, tracker != CheckState::Global); - }); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, global_state, &tracker]() { + tracker = static_cast<CheckState>((static_cast<int>(tracker) + 1) % + static_cast<int>(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(global_state); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } 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; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_OFFSET = 2; -enum CheckState { +enum class CheckState { Off, On, Global, @@ -42,10 +42,9 @@ void SetPerGameSetting(QComboBox* combobox, void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); void SetColoredTristate(QCheckBox* checkbox, const std::string& name, - const Settings::Setting<bool>& setting, - ConfigurationShared::CheckState& tracker); + const Settings::Setting<bool>& setting, CheckState& tracker); void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, - bool global_state, ConfigurationShared::CheckState& tracker); + bool global_state, CheckState& tracker); void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, int global); |