From f9139ddab78d5995c981228c33e32c52a22170df Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 8 Jul 2021 22:04:24 -0400 Subject: [PATCH] config: Remove float {Read,Write}Setting variants --- src/yuzu/configuration/config.cpp | 25 ------------------------- src/yuzu_cmd/config.cpp | 6 ++---- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1a0f75373..6ea529171 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting& settin qt_config->setValue(name, QString::fromStdString(value)); } -// Explicit float definition: use a double as Qt doesn't write legible floats to config files -template <> -void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { - const QString name = QString::fromStdString(setting.GetLabel()); - const double value = setting.GetValue(); - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue() == setting.GetDefault()); - qt_config->setValue(name, value); -} - template void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); @@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { qt_config->setValue(name, value); } -// Explicit float definition: use a double as Qt doesn't write legible floats to config files -template <> -void Config::WriteGlobalSetting(const Settings::Setting& setting) { - const QString name = QString::fromStdString(setting.GetLabel()); - const double value = setting.GetValue(global); - if (!global) { - qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); - } - if (global || !setting.UsingGlobal()) { - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue(global) == setting.GetDefault()); - qt_config->setValue(name, value); - } -} - template void Config::WriteGlobalSetting(const Settings::Setting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 325584a1a..23ada3f92 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -241,18 +241,16 @@ static const std::array keyboard_mods{ SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI, }; -template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { - setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault()); -} template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); } + template <> void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); } + template void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = static_cast(sdl2_config->GetInteger(group, setting.GetLabel(),