diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-07-29 19:23:06 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-07-29 19:23:06 +0200 |
commit | 05c8063ac131ef5087f645c57b649157099f786b (patch) | |
tree | 28979adda2626646d8ce90ddebf747a4093d1c03 | |
parent | settings: Correct Linkage member impl location (diff) | |
download | yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar.gz yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar.bz2 yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar.lz yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar.xz yuzu-05c8063ac131ef5087f645c57b649157099f786b.tar.zst yuzu-05c8063ac131ef5087f645c57b649157099f786b.zip |
-rw-r--r-- | src/yuzu/configuration/config.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index f2ef34cbc..785716735 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -1256,23 +1256,27 @@ void Config::WriteCategory(Settings::Category category) { } void Config::ReadSettingGeneric(Settings::BasicSetting* const setting) { - if (!setting->Save()) { + if (!setting->Save() || (!setting->Switchable() && !global)) { return; } const QString name = QString::fromStdString(setting->GetLabel()); const auto default_value = QVariant::fromValue<QString>(QString::fromStdString(setting->DefaultToString())); - if (setting->Switchable()) { - const bool use_global = - qt_config->value(name + QStringLiteral("/use_global"), true).value<bool>(); + bool use_global = true; + if (setting->Switchable() && !global) { + use_global = qt_config->value(name + QStringLiteral("/use_global"), true).value<bool>(); setting->SetGlobal(use_global); + } - if (global || !use_global) { + if (global || !use_global) { + const bool is_default = ReadSetting(name + QStringLiteral("/default"), true).value<bool>(); + if (!is_default) { setting->LoadString(ReadSetting(name, default_value).value<QString>().toStdString()); + } else { + // Empty string resets the Setting to default + setting->LoadString(""); } - } else if (global) { - setting->LoadString(ReadSetting(name, default_value).value<QString>().toStdString()); } } |