diff options
Diffstat (limited to 'src/yuzu/configuration/config.h')
-rw-r--r-- | src/yuzu/configuration/config.h | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 62501997c..96f9b6de1 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h @@ -102,28 +102,75 @@ private: void SaveUILayoutValues(); void SaveWebServiceValues(); + /** + * Reads a setting from the qt_config. + * + * @param name The setting's identifier + * @param default_value The value to use when the setting is not already present in the config + */ QVariant ReadSetting(const QString& name) const; QVariant ReadSetting(const QString& name, const QVariant& default_value) const; - QVariant ReadSetting(const QString& name, Settings::CPUAccuracy default_value) const; - QVariant ReadSetting(const QString& name, Settings::GPUAccuracy default_value) const; - QVariant ReadSetting(const QString& name, Settings::RendererBackend default_value) const; - // Templated ReadSettingGlobal functions will also look for the use_global setting and set - // both the value and the global state properly - template <typename Type> - void ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name); + + /** + * Only reads a setting from the qt_config if the current config is a global config, or if the + * current config is a custom config and the setting is overriding the global setting. Otherwise + * it does nothing. + * + * @param setting The variable to be modified + * @param name The setting's identifier + * @param default_value The value to use when the setting is not already present in the config + */ template <typename Type> void ReadSettingGlobal(Type& setting, const QString& name, const QVariant& default_value) const; - // Templated WriteSettingGlobal functions will also write the global state if needed and will - // skip writing the actual setting if it defers to the global value + + /** + * Writes a setting to the qt_config. + * + * @param name The setting's idetentifier + * @param value Value of the setting + * @param default_value Default of the setting if not present in qt_config + * @param use_global Specifies if the custom or global config should be in use, for custom + * configs + */ void WriteSetting(const QString& name, const QVariant& value); void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value); + void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value, + bool use_global); + + /** + * Reads a value from the qt_config and applies it to the setting, using its label and default + * value. If the config is a custom config, this will also read the global state of the setting + * and apply that information to it. + * + * @param The setting + */ template <typename Type> - void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting); + void ReadGlobalSetting(Settings::Setting<Type>& setting); + + /** + * Sets a value to the qt_config using the setting's label and default value. If the config is a + * custom config, it will apply the global state, and the custom value if needed. + * + * @param The setting + */ + template <typename Type> + void WriteGlobalSetting(const Settings::Setting<Type>& setting); + + /** + * Reads a value from the qt_config using the setting's label and default value and applies the + * value to the setting. + * + * @param The setting + */ + template <typename Type> + void ReadBasicSetting(Settings::BasicSetting<Type>& setting); + + /** Sets a value from the setting in the qt_config using the setting's label and default value. + * + * @param The setting + */ template <typename Type> - void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting, - const QVariant& default_value); - void WriteSettingGlobal(const QString& name, const QVariant& value, bool use_global, - const QVariant& default_value); + void WriteBasicSetting(const Settings::BasicSetting<Type>& setting); ConfigType type; std::unique_ptr<QSettings> qt_config; |