1
0
Fork 1
forked from suyu/suyu

configuration: Use shorter constructor as needed

Reduces some confusion hopefully, since some parameters specified were not
specific to the setting in question.
This commit is contained in:
lat9nq 2023-06-15 16:45:42 -04:00
parent 6935332cba
commit a7ee9d999f
3 changed files with 9 additions and 10 deletions

View file

@ -54,14 +54,15 @@ void ConfigureAudio::Setup() {
auto* widget = [&]() { auto* widget = [&]() {
if (setting->Id() == Settings::values.volume.Id()) { if (setting->Id() == Settings::values.volume.Id()) {
// volume needs to be a slider (default is line edit) // volume needs to be a slider (default is line edit)
return new ConfigurationShared::Widget( return new ConfigurationShared::Widget(setting, translations, combobox_translations,
setting, translations, combobox_translations, this, runtime_lock, apply_funcs, this, runtime_lock, apply_funcs, nullptr,
ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr, ConfigurationShared::RequestType::Slider,
tr("%1%", "Volume percentage (e.g. 50%)")); tr("%1%", "Volume percentage (e.g. 50%)"));
} else if (setting->Id() == Settings::values.audio_output_device_id.Id() || } else if (setting->Id() == Settings::values.audio_output_device_id.Id() ||
setting->Id() == Settings::values.audio_input_device_id.Id() || setting->Id() == Settings::values.audio_input_device_id.Id() ||
setting->Id() == Settings::values.sink_id.Id()) { setting->Id() == Settings::values.sink_id.Id()) {
// These need to be unmanaged comboboxes, so we can populate them ourselves // These need to be unmanaged comboboxes, so we can populate them ourselves
// TODO (lat9nq): Let it manage sink_id
return new ConfigurationShared::Widget( return new ConfigurationShared::Widget(
setting, translations, combobox_translations, this, runtime_lock, apply_funcs, setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
ConfigurationShared::RequestType::ComboBox, false); ConfigurationShared::RequestType::ComboBox, false);

View file

@ -253,8 +253,7 @@ void ConfigureGraphics::Setup() {
// speed_limit needs a checkbox to set use_speed_limit, as well as a spinbox // speed_limit needs a checkbox to set use_speed_limit, as well as a spinbox
return new ConfigurationShared::Widget( return new ConfigurationShared::Widget(
setting, translations, combobox_translations, this, runtime_lock, apply_funcs, setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
ConfigurationShared::RequestType::SpinBox, true, 1.0f, &Settings::values.use_speed_limit, ConfigurationShared::RequestType::SpinBox,
&Settings::values.use_speed_limit,
tr("%", "Limit speed percentage (e.g. 50%)")); tr("%", "Limit speed percentage (e.g. 50%)"));
} else { } else {
return new ConfigurationShared::Widget(setting, translations, combobox_translations, return new ConfigurationShared::Widget(setting, translations, combobox_translations,

View file

@ -134,15 +134,14 @@ void ConfigureSystem::Setup() {
// it and custom_rtc_enabled // it and custom_rtc_enabled
return new ConfigurationShared::Widget( return new ConfigurationShared::Widget(
setting, translations, combobox_translations, this, runtime_lock, apply_funcs, setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f, &Settings::values.custom_rtc_enabled,
&Settings::values.custom_rtc_enabled); ConfigurationShared::RequestType::DateTimeEdit);
} else if (setting->Id() == Settings::values.rng_seed.Id()) { } else if (setting->Id() == Settings::values.rng_seed.Id()) {
// rng_seed needs a HexEdit (default is LineEdit), and a checkbox to manage // rng_seed needs a HexEdit (default is LineEdit), and a checkbox to manage
// it and rng_seed_enabled // it and rng_seed_enabled
return new ConfigurationShared::Widget( return new ConfigurationShared::Widget(
setting, translations, combobox_translations, this, runtime_lock, apply_funcs, setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
ConfigurationShared::RequestType::HexEdit, true, 1.0f, &Settings::values.rng_seed_enabled, ConfigurationShared::RequestType::HexEdit);
&Settings::values.rng_seed_enabled);
} else { } else {
return new ConfigurationShared::Widget(setting, translations, combobox_translations, return new ConfigurationShared::Widget(setting, translations, combobox_translations,
this, runtime_lock, apply_funcs); this, runtime_lock, apply_funcs);