config: Remove float {Read,Write}Setting variants
This commit is contained in:
parent
8284658bac
commit
f9139ddab7
|
@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& settin
|
||||||
qt_config->setValue(name, QString::fromStdString(value));
|
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<float>& 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 <typename Type>
|
template <typename Type>
|
||||||
void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
|
void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
|
||||||
const QString name = QString::fromStdString(setting.GetLabel());
|
const QString name = QString::fromStdString(setting.GetLabel());
|
||||||
|
@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
|
||||||
qt_config->setValue(name, value);
|
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<float>& 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 <typename Type>
|
template <typename Type>
|
||||||
void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) {
|
void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) {
|
||||||
const QString name = QString::fromStdString(setting.GetLabel());
|
const QString name = QString::fromStdString(setting.GetLabel());
|
||||||
|
|
|
@ -241,18 +241,16 @@ static const std::array<int, 8> keyboard_mods{
|
||||||
SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI,
|
SDL_SCANCODE_RCTRL, SDL_SCANCODE_RSHIFT, SDL_SCANCODE_RALT, SDL_SCANCODE_RGUI,
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) {
|
|
||||||
setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault());
|
|
||||||
}
|
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) {
|
||||||
setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
|
setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) {
|
||||||
setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
|
setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) {
|
||||||
setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
|
setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
|
||||||
|
|
Loading…
Reference in a new issue