From e26e82d8d5f9a3907b3623bd50dffd1c9b84969e Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:08:24 -0400 Subject: configuration_shared: Initial functions and data for manual tristate Sets up initial support for implementing colored tristate functions. These functions color a QWidget blue when it's overriding a global setting, and discolor it when not. The lack of color indicates it uses the global state, replacing the Qt::CheckState::PartiallyChecked state with the global state. --- src/yuzu/configuration/configuration_shared.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b11b1b950..1163604bf 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -15,8 +15,20 @@ constexpr int USE_GLOBAL_INDEX = 0; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_OFFSET = 2; +enum CheckState { + Off, + On, + Global, + Count, +}; + +struct Trackers { +} extern trackers; + // Global-aware apply and set functions +void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, + const CheckState& tracker); void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting* setting, @@ -31,6 +43,10 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); +void SetBGColor(QWidget* widget, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, + ConfigurationShared::CheckState& tracker); + void InsertGlobalItem(QComboBox* combobox); } // namespace ConfigurationShared -- cgit v1.2.3 From 58672cc7b6ee58209a802e030f2a427e579ca415 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:08:50 -0400 Subject: configure_general: Implement manual tristate buttons --- src/yuzu/configuration/configuration_shared.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 1163604bf..4f0166fae 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -23,6 +23,8 @@ enum CheckState { }; struct Trackers { + CheckState use_frame_limit; + CheckState use_multi_core; } extern trackers; // Global-aware apply and set functions -- cgit v1.2.3 From 5a9dc8f002c68e4af1fab9b7cfbd65e86ee2d110 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 17:42:13 -0400 Subject: configuration_shared: Use a highlight instead of background color Fixes visibility in the built-in dark theme --- src/yuzu/configuration/configuration_shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4f0166fae..88709446c 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -45,7 +45,7 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); -void SetBGColor(QWidget* widget, bool highlighted); +void SetHighlight(QWidget* widget, bool highlighted); void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, ConfigurationShared::CheckState& tracker); -- cgit v1.2.3 From da65b92f9e9992413938bb084949367822b890c8 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 19:22:41 -0400 Subject: configuration_shared: Require name of the widget for highlighting Prevents mass-coloring of elements later on --- src/yuzu/configuration/configuration_shared.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 88709446c..b2bd971c8 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -25,6 +25,8 @@ enum CheckState { struct Trackers { CheckState use_frame_limit; CheckState use_multi_core; + + CheckState enable_audio_stretching; } extern trackers; // Global-aware apply and set functions @@ -45,8 +47,8 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); -void SetHighlight(QWidget* widget, bool highlighted); -void SetColoredTristate(QCheckBox* checkbox, Settings::Setting& setting, +void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting& setting, ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); -- cgit v1.2.3 From 44b3183ec859062238720d4aaa5d9d50b9a947bd Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:35:58 -0400 Subject: configuration_shared: Better use global text Also adds trackers for graphics and advanced graphics --- src/yuzu/configuration/configuration_shared.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b2bd971c8..4b52834c4 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -27,6 +27,14 @@ struct Trackers { CheckState use_multi_core; CheckState enable_audio_stretching; + + CheckState use_disk_shader_cache; + CheckState use_asynchronous_gpu_emulation; + + CheckState use_vsync; + CheckState use_assembly_shaders; + CheckState use_fast_gpu_time; + CheckState force_30fps_mode; } extern trackers; // Global-aware apply and set functions @@ -52,5 +60,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); +void InsertGlobalItem(QComboBox* combobox, const QString& global); } // namespace ConfigurationShared -- cgit v1.2.3 From 38152ab0b9678c16c3aa902ddeaad5d437c24237 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:37:02 -0400 Subject: configure_graphics_advanced: Implement highlighted overrides --- src/yuzu/configuration/configuration_shared.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 4b52834c4..71011fd92 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -33,6 +33,7 @@ struct Trackers { CheckState use_vsync; CheckState use_assembly_shaders; + CheckState use_asynchronous_shaders; CheckState use_fast_gpu_time; CheckState force_30fps_mode; } extern trackers; -- cgit v1.2.3 From 2627241541a2b2bc691c2776f111f95d7bd94c70 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 21:48:56 -0400 Subject: configuration_shared: Use an int instead of a QString I noticed some of the code could be reduced to just passing the function an int, since I was doing the same thing over and over. Also clang-formats configure_graphics --- src/yuzu/configuration/configuration_shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 71011fd92..f3676bd3a 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -61,6 +61,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Sett ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); -void InsertGlobalItem(QComboBox* combobox, const QString& global); +void InsertGlobalItem(QComboBox* combobox, int global_index); } // namespace ConfigurationShared -- cgit v1.2.3 From 6316a3d8d9db432eb810c554385837c96037cba5 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:00:56 -0400 Subject: configuration_shared: Add default combobox setup function Not a catch-all, but helps clean up the code for when I do this a lot. Also fixes some bugs caught in configure_graphics. --- src/yuzu/configuration/configuration_shared.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index f3676bd3a..b5d6ea8c8 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -57,8 +57,13 @@ void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); -void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting& setting, +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting& setting, ConfigurationShared::CheckState& tracker); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, + bool global_state, ConfigurationShared::CheckState& tracker); +void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, + int global); void InsertGlobalItem(QComboBox* combobox); void InsertGlobalItem(QComboBox* combobox, int global_index); -- cgit v1.2.3 From a350ae6be688f5fbc98dcb8657287e7116d084c3 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 13 Jul 2020 23:01:18 -0400 Subject: configure_system: Implement highlighted overrides --- src/yuzu/configuration/configuration_shared.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b5d6ea8c8..d3e86c3cf 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -36,6 +36,9 @@ struct Trackers { CheckState use_asynchronous_shaders; CheckState use_fast_gpu_time; CheckState force_30fps_mode; + + CheckState use_rng_seed; + CheckState use_custom_rtc; } extern trackers; // Global-aware apply and set functions -- cgit v1.2.3 From 0d462f560840f0ad584f1a24b02cd6c03cc4f5c2 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 13:55:47 -0400 Subject: configuration_shared: Break up tracker structs to respective classes One less global variable. --- src/yuzu/configuration/configuration_shared.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index d3e86c3cf..4cea7406f 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -22,25 +22,6 @@ enum CheckState { Count, }; -struct Trackers { - CheckState use_frame_limit; - CheckState use_multi_core; - - CheckState enable_audio_stretching; - - CheckState use_disk_shader_cache; - CheckState use_asynchronous_gpu_emulation; - - CheckState use_vsync; - CheckState use_assembly_shaders; - CheckState use_asynchronous_shaders; - CheckState use_fast_gpu_time; - CheckState force_30fps_mode; - - CheckState use_rng_seed; - CheckState use_custom_rtc; -} extern trackers; - // Global-aware apply and set functions void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, -- cgit v1.2.3 From 335aef78c43ec5b488575b5eb790ae6e32ec7b63 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:40:02 -0400 Subject: configuration_shared: Make CheckState strongly typed Also gets rid of unnecessary explicit namespace usage. --- src/yuzu/configuration/configuration_shared.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/yuzu/configuration/configuration_shared.h') 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& setting, - ConfigurationShared::CheckState& tracker); + const Settings::Setting& 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); -- cgit v1.2.3 From 520b4c7829196cef45995764509fb5b1afe2eac7 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 15:42:45 -0400 Subject: configuration_shared: Remove unused functions These were only kept for compatibility with old code during testing. --- src/yuzu/configuration/configuration_shared.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/yuzu/configuration/configuration_shared.h') diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index e9d765b94..003148c68 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -26,7 +26,6 @@ enum class CheckState { void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, const CheckState& tracker); -void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); @@ -48,7 +47,6 @@ void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool globa void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, int global); -void InsertGlobalItem(QComboBox* combobox); void InsertGlobalItem(QComboBox* combobox, int global_index); } // namespace ConfigurationShared -- cgit v1.2.3