diff options
| author | 2023-06-13 20:35:24 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:54 -0400 | |
| commit | 3240d199a29ca8a8d21f5008045767a7cb89b51d (patch) | |
| tree | 82332df3cb9318cd7dfdffb1f9af4794ada0a23d /src | |
| parent | settings: Delete cpu_accuracy_first_time (diff) | |
| download | yuzu-3240d199a29ca8a8d21f5008045767a7cb89b51d.tar.gz yuzu-3240d199a29ca8a8d21f5008045767a7cb89b51d.tar.xz yuzu-3240d199a29ca8a8d21f5008045767a7cb89b51d.zip | |
config: Remove unused functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 81 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 47 |
2 files changed, 0 insertions, 128 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index ffd4c623d..5755e5b2d 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -171,66 +171,6 @@ bool Config::IsCustomConfig() { | |||
| 171 | return type == ConfigType::PerGameConfig; | 171 | return type == ConfigType::PerGameConfig; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | /* {Read,Write}BasicSetting and WriteGlobalSetting templates must be defined here before their | ||
| 175 | * usages later in this file. This allows explicit definition of some types that don't work | ||
| 176 | * nicely with the general version. | ||
| 177 | */ | ||
| 178 | |||
| 179 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor | ||
| 180 | // can it implicitly convert a QVariant back to a {std::,Q}string | ||
| 181 | template <> | ||
| 182 | void Config::ReadBasicSetting(Settings::Setting<std::string>& setting) { | ||
| 183 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 184 | const auto default_value = QString::fromStdString(setting.GetDefault()); | ||
| 185 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | ||
| 186 | setting.SetValue(default_value.toStdString()); | ||
| 187 | } else { | ||
| 188 | setting.SetValue(qt_config->value(name, default_value).toString().toStdString()); | ||
| 189 | } | ||
| 190 | } | ||
| 191 | |||
| 192 | template <typename Type, bool ranged> | ||
| 193 | void Config::ReadBasicSetting(Settings::Setting<Type, ranged>& setting) { | ||
| 194 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 195 | const Type default_value = setting.GetDefault(); | ||
| 196 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | ||
| 197 | setting.SetValue(default_value); | ||
| 198 | } else { | ||
| 199 | setting.SetValue( | ||
| 200 | static_cast<QVariant>(qt_config->value(name, default_value)).value<Type>()); | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant | ||
| 205 | template <> | ||
| 206 | void Config::WriteBasicSetting(const Settings::Setting<std::string>& setting) { | ||
| 207 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 208 | const std::string& value = setting.GetValue(); | ||
| 209 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 210 | qt_config->setValue(name, QString::fromStdString(value)); | ||
| 211 | } | ||
| 212 | |||
| 213 | template <typename Type, bool ranged> | ||
| 214 | void Config::WriteBasicSetting(const Settings::Setting<Type, ranged>& setting) { | ||
| 215 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 216 | const Type value = setting.GetValue(); | ||
| 217 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 218 | qt_config->setValue(name, value); | ||
| 219 | } | ||
| 220 | |||
| 221 | template <typename Type, bool ranged> | ||
| 222 | void Config::WriteGlobalSetting(const Settings::SwitchableSetting<Type, ranged>& setting) { | ||
| 223 | const QString name = QString::fromStdString(setting.GetLabel()); | ||
| 224 | const Type& value = setting.GetValue(global); | ||
| 225 | if (!global) { | ||
| 226 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | ||
| 227 | } | ||
| 228 | if (global || !setting.UsingGlobal()) { | ||
| 229 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | ||
| 230 | qt_config->setValue(name, value); | ||
| 231 | } | ||
| 232 | } | ||
| 233 | |||
| 234 | void Config::ReadPlayerValue(std::size_t player_index) { | 174 | void Config::ReadPlayerValue(std::size_t player_index) { |
| 235 | const QString player_prefix = [this, player_index] { | 175 | const QString player_prefix = [this, player_index] { |
| 236 | if (type == ConfigType::InputProfile) { | 176 | if (type == ConfigType::InputProfile) { |
| @@ -1230,27 +1170,6 @@ QVariant Config::ReadSetting(const QString& name, const QVariant& default_value) | |||
| 1230 | return result; | 1170 | return result; |
| 1231 | } | 1171 | } |
| 1232 | 1172 | ||
| 1233 | template <typename Type, bool ranged> | ||
| 1234 | void Config::ReadGlobalSetting(Settings::SwitchableSetting<Type, ranged>& setting) { | ||
| 1235 | QString name = QString::fromStdString(setting.GetLabel()); | ||
| 1236 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); | ||
| 1237 | setting.SetGlobal(use_global); | ||
| 1238 | if (global || !use_global) { | ||
| 1239 | setting.SetValue(static_cast<QVariant>( | ||
| 1240 | ReadSetting(name, QVariant::fromValue<Type>(setting.GetDefault()))) | ||
| 1241 | .value<Type>()); | ||
| 1242 | } | ||
| 1243 | } | ||
| 1244 | |||
| 1245 | template <typename Type> | ||
| 1246 | void Config::ReadSettingGlobal(Type& setting, const QString& name, | ||
| 1247 | const QVariant& default_value) const { | ||
| 1248 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); | ||
| 1249 | if (global || !use_global) { | ||
| 1250 | setting = ReadSetting(name, default_value).value<Type>(); | ||
| 1251 | } | ||
| 1252 | } | ||
| 1253 | |||
| 1254 | void Config::WriteSetting(const QString& name, const QVariant& value) { | 1173 | void Config::WriteSetting(const QString& name, const QVariant& value) { |
| 1255 | qt_config->setValue(name, value); | 1174 | qt_config->setValue(name, value); |
| 1256 | } | 1175 | } |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index c00e717b8..a68f291a2 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -139,18 +139,6 @@ private: | |||
| 139 | QVariant ReadSetting(const QString& name, const QVariant& default_value) const; | 139 | QVariant ReadSetting(const QString& name, const QVariant& default_value) const; |
| 140 | 140 | ||
| 141 | /** | 141 | /** |
| 142 | * Only reads a setting from the qt_config if the current config is a global config, or if the | ||
| 143 | * current config is a custom config and the setting is overriding the global setting. Otherwise | ||
| 144 | * it does nothing. | ||
| 145 | * | ||
| 146 | * @param setting The variable to be modified | ||
| 147 | * @param name The setting's identifier | ||
| 148 | * @param default_value The value to use when the setting is not already present in the config | ||
| 149 | */ | ||
| 150 | template <typename Type> | ||
| 151 | void ReadSettingGlobal(Type& setting, const QString& name, const QVariant& default_value) const; | ||
| 152 | |||
| 153 | /** | ||
| 154 | * Writes a setting to the qt_config. | 142 | * Writes a setting to the qt_config. |
| 155 | * | 143 | * |
| 156 | * @param name The setting's idetentifier | 144 | * @param name The setting's idetentifier |
| @@ -164,41 +152,6 @@ private: | |||
| 164 | void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value, | 152 | void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value, |
| 165 | bool use_global); | 153 | bool use_global); |
| 166 | 154 | ||
| 167 | /** | ||
| 168 | * Reads a value from the qt_config and applies it to the setting, using its label and default | ||
| 169 | * value. If the config is a custom config, this will also read the global state of the setting | ||
| 170 | * and apply that information to it. | ||
| 171 | * | ||
| 172 | * @param The setting | ||
| 173 | */ | ||
| 174 | template <typename Type, bool ranged> | ||
| 175 | void ReadGlobalSetting(Settings::SwitchableSetting<Type, ranged>& setting); | ||
| 176 | |||
| 177 | /** | ||
| 178 | * Sets a value to the qt_config using the setting's label and default value. If the config is a | ||
| 179 | * custom config, it will apply the global state, and the custom value if needed. | ||
| 180 | * | ||
| 181 | * @param The setting | ||
| 182 | */ | ||
| 183 | template <typename Type, bool ranged> | ||
| 184 | void WriteGlobalSetting(const Settings::SwitchableSetting<Type, ranged>& setting); | ||
| 185 | |||
| 186 | /** | ||
| 187 | * Reads a value from the qt_config using the setting's label and default value and applies the | ||
| 188 | * value to the setting. | ||
| 189 | * | ||
| 190 | * @param The setting | ||
| 191 | */ | ||
| 192 | template <typename Type, bool ranged> | ||
| 193 | void ReadBasicSetting(Settings::Setting<Type, ranged>& setting); | ||
| 194 | |||
| 195 | /** Sets a value from the setting in the qt_config using the setting's label and default value. | ||
| 196 | * | ||
| 197 | * @param The setting | ||
| 198 | */ | ||
| 199 | template <typename Type, bool ranged> | ||
| 200 | void WriteBasicSetting(const Settings::Setting<Type, ranged>& setting); | ||
| 201 | |||
| 202 | void ReadCategory(Settings::Category category); | 155 | void ReadCategory(Settings::Category category); |
| 203 | void WriteCategory(Settings::Category category); | 156 | void WriteCategory(Settings::Category category); |
| 204 | void ReadSettingGeneric(Settings::BasicSetting* const setting); | 157 | void ReadSettingGeneric(Settings::BasicSetting* const setting); |