From 84a937ae651aa5296535e8feffe47aa1f2b219ab Mon Sep 17 00:00:00 2001 From: TryTwo Date: Tue, 17 Sep 2024 23:29:13 -0700 Subject: Add GFX property tabs to game properties window, allowing them to be set to the user game ini. Additionally, refactor ConfigWidgets to reduce duplication. Refactor GameConfigWidget to use config system. Creates a layer outside the game config layer system and passes it to the created gfx widows, so as to not interfere with the global config system. Supports multiple game properties being open at once. Supports editing while a game is playing, but the options only save and update the active game when the window is closed. Right-clicking will remove a property from the game ini. --- .../DolphinQt/Config/ConfigControls/ConfigChoice.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp') diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp index a26b87b46e..c2652563d1 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp @@ -5,8 +5,9 @@ #include -ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info& setting) - : ConfigControl(setting.GetLocation()), m_setting(setting) +ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info& setting, + Config::Layer* layer) + : ConfigControl(setting.GetLocation(), layer), m_setting(setting) { addItems(options); setCurrentIndex(ReadValue(setting)); @@ -25,8 +26,9 @@ void ConfigChoice::OnConfigChanged() } ConfigStringChoice::ConfigStringChoice(const std::vector& options, - const Config::Info& setting) - : ConfigControl(setting.GetLocation()), m_setting(setting), m_text_is_data(true) + const Config::Info& setting, + Config::Layer* layer) + : ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(true) { for (const auto& op : options) addItem(QString::fromStdString(op)); @@ -36,8 +38,9 @@ ConfigStringChoice::ConfigStringChoice(const std::vector& options, } ConfigStringChoice::ConfigStringChoice(const std::vector>& options, - const Config::Info& setting) - : ConfigControl(setting.GetLocation()), m_setting(setting), m_text_is_data(false) + const Config::Info& setting, + Config::Layer* layer) + : ConfigControl(setting.GetLocation(), layer), m_setting(setting), m_text_is_data(false) { for (const auto& [option_text, option_data] : options) addItem(option_text, option_data); @@ -57,9 +60,10 @@ void ConfigStringChoice::Update(int index) void ConfigStringChoice::Load() { const QString setting_value = QString::fromStdString(ReadValue(m_setting)); - const int index = m_text_is_data ? findText(setting_value) : findData(setting_value); - const QSignalBlocker blocker(this); + + // This can be called publicly. + const QSignalBlocker block(this); setCurrentIndex(index); } -- cgit v1.2.3