mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-25 18:57:56 -05:00
Merge pull request #6579 from ameerj/float-settings
settings: Eliminate usage of float-point setting values
This commit is contained in:
@ -311,16 +311,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& 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<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>
|
||||
void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) {
|
||||
const QString name = QString::fromStdString(setting.GetLabel());
|
||||
@ -329,21 +319,6 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& 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<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>
|
||||
void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) {
|
||||
const QString name = QString::fromStdString(setting.GetLabel());
|
||||
|
@ -47,7 +47,8 @@ void ConfigureAudio::SetConfiguration() {
|
||||
|
||||
SetAudioDeviceFromDeviceID();
|
||||
|
||||
ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum());
|
||||
const auto volume_value = Settings::values.volume.GetValue() * ui->volume_slider->maximum();
|
||||
ui->volume_slider->setValue(volume_value / 100);
|
||||
|
||||
ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue());
|
||||
|
||||
@ -112,18 +113,16 @@ void ConfigureAudio::ApplyConfiguration() {
|
||||
|
||||
// Guard if during game and set to game-specific value
|
||||
if (Settings::values.volume.UsingGlobal()) {
|
||||
Settings::values.volume.SetValue(
|
||||
static_cast<float>(ui->volume_slider->sliderPosition()) /
|
||||
ui->volume_slider->maximum());
|
||||
const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
|
||||
Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
|
||||
}
|
||||
} else {
|
||||
if (ui->volume_combo_box->currentIndex() == 0) {
|
||||
Settings::values.volume.SetGlobal(true);
|
||||
} else {
|
||||
Settings::values.volume.SetGlobal(false);
|
||||
Settings::values.volume.SetValue(
|
||||
static_cast<float>(ui->volume_slider->sliderPosition()) /
|
||||
ui->volume_slider->maximum());
|
||||
const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
|
||||
Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ void ConfigureGraphics::SetConfiguration() {
|
||||
ConfigurationShared::SetHighlight(ui->bg_layout, !Settings::values.bg_red.UsingGlobal());
|
||||
}
|
||||
|
||||
UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(),
|
||||
Settings::values.bg_green.GetValue(),
|
||||
Settings::values.bg_blue.GetValue()));
|
||||
UpdateBackgroundColorButton(QColor::fromRgb(Settings::values.bg_red.GetValue(),
|
||||
Settings::values.bg_green.GetValue(),
|
||||
Settings::values.bg_blue.GetValue()));
|
||||
UpdateDeviceComboBox();
|
||||
}
|
||||
|
||||
@ -132,9 +132,9 @@ void ConfigureGraphics::ApplyConfiguration() {
|
||||
Settings::values.vulkan_device.SetValue(vulkan_device);
|
||||
}
|
||||
if (Settings::values.bg_red.UsingGlobal()) {
|
||||
Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF()));
|
||||
Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF()));
|
||||
Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF()));
|
||||
Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
|
||||
Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
|
||||
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
|
||||
}
|
||||
} else {
|
||||
if (ui->api->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) {
|
||||
@ -159,9 +159,9 @@ void ConfigureGraphics::ApplyConfiguration() {
|
||||
Settings::values.bg_red.SetGlobal(false);
|
||||
Settings::values.bg_green.SetGlobal(false);
|
||||
Settings::values.bg_blue.SetGlobal(false);
|
||||
Settings::values.bg_red.SetValue(static_cast<float>(bg_color.redF()));
|
||||
Settings::values.bg_green.SetValue(static_cast<float>(bg_color.greenF()));
|
||||
Settings::values.bg_blue.SetValue(static_cast<float>(bg_color.blueF()));
|
||||
Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
|
||||
Settings::values.bg_green.SetValue(static_cast<u8>(bg_color.green()));
|
||||
Settings::values.bg_blue.SetValue(static_cast<u8>(bg_color.blue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2573,27 +2573,24 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QDoubleSpinBox" name="mouse_panning_sensitivity">
|
||||
<widget class="QSpinBox" name="mouse_panning_sensitivity">
|
||||
<property name="toolTip">
|
||||
<string>Mouse sensitivity</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.100000000000000</double>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>16.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.010000000000000</double>
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Reference in New Issue
Block a user