mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include <QSignalBlocker>
|
||||
|
||||
#include "Common/Config/Enums.h"
|
||||
#include "Common/Config/Layer.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
namespace Config
|
||||
@ -21,14 +22,19 @@ template <class Derived>
|
||||
class ConfigControl : public Derived
|
||||
{
|
||||
public:
|
||||
ConfigControl(const Config::Location& location) : m_location(location) { ConnectConfig(); }
|
||||
ConfigControl(const QString& label, const Config::Location& location)
|
||||
: Derived(label), m_location(location)
|
||||
ConfigControl(const Config::Location& location, Config::Layer* layer)
|
||||
: m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
ConfigControl(const Qt::Orientation& orient, const Config::Location& location)
|
||||
: Derived(orient), m_location(location)
|
||||
ConfigControl(const QString& label, const Config::Location& location, Config::Layer* layer)
|
||||
: Derived(label), m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
ConfigControl(const Qt::Orientation& orient, const Config::Location& location,
|
||||
Config::Layer* layer)
|
||||
: Derived(orient), m_location(location), m_layer(layer)
|
||||
{
|
||||
ConnectConfig();
|
||||
}
|
||||
@ -51,22 +57,49 @@ protected:
|
||||
template <typename T>
|
||||
void SaveValue(const Config::Info<T>& setting, const T& value)
|
||||
{
|
||||
if (m_layer != nullptr)
|
||||
{
|
||||
m_layer->Set(m_location, value);
|
||||
Config::OnConfigChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
Config::SetBaseOrCurrent(setting, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T ReadValue(const Config::Info<T>& setting) const
|
||||
{
|
||||
if (m_layer != nullptr)
|
||||
return m_layer->Get(setting);
|
||||
|
||||
return Config::Get(setting);
|
||||
}
|
||||
|
||||
virtual void OnConfigChanged() {};
|
||||
virtual void OnConfigChanged(){};
|
||||
|
||||
private:
|
||||
bool IsConfigLocal() const
|
||||
{
|
||||
return Config::GetActiveLayerForConfig(m_location) != Config::LayerType::Base;
|
||||
if (m_layer != nullptr)
|
||||
return m_layer->Exists(m_location);
|
||||
else
|
||||
return Config::GetActiveLayerForConfig(m_location) != Config::LayerType::Base;
|
||||
}
|
||||
|
||||
void mousePressEvent(QMouseEvent* event) override
|
||||
{
|
||||
if (m_layer != nullptr && event->button() == Qt::RightButton)
|
||||
{
|
||||
m_layer->DeleteKey(m_location);
|
||||
Config::OnConfigChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
Derived::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
const Config::Location m_location;
|
||||
Config::Layer* m_layer;
|
||||
};
|
||||
|
Reference in New Issue
Block a user