summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
diff options
context:
space:
mode:
authorTryTwo <taolas@gmail.com>2024-09-17 23:29:13 -0700
committerTryTwo <taolas@gmail.com>2024-12-10 13:40:30 -0700
commit84a937ae651aa5296535e8feffe47aa1f2b219ab (patch)
tree7c875fc5a8725bd7a81a772854204d546edc23ae /Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp
parent08df9a66e03acb614dca6d1c118818f84f1cbcfd (diff)
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.
Diffstat (limited to 'Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp20
1 files changed, 12 insertions, 8 deletions
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 <QSignalBlocker>
-ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& setting)
- : ConfigControl(setting.GetLocation()), m_setting(setting)
+ConfigChoice::ConfigChoice(const QStringList& options, const Config::Info<int>& 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<std::string>& options,
- const Config::Info<std::string>& setting)
- : ConfigControl(setting.GetLocation()), m_setting(setting), m_text_is_data(true)
+ const Config::Info<std::string>& 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<std::string>& options,
}
ConfigStringChoice::ConfigStringChoice(const std::vector<std::pair<QString, QString>>& options,
- const Config::Info<std::string>& setting)
- : ConfigControl(setting.GetLocation()), m_setting(setting), m_text_is_data(false)
+ const Config::Info<std::string>& 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);
}