mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 13:26:30 -05:00
configuration: Use paired settings
This commit is contained in:
parent
7f708e8d77
commit
9de50d6194
2 changed files with 6 additions and 12 deletions
|
@ -107,18 +107,8 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
|
||||||
|
|
||||||
for (auto setting : settings) {
|
for (auto setting : settings) {
|
||||||
ConfigurationShared::Widget* widget = [this, setting, &builder]() {
|
ConfigurationShared::Widget* widget = [this, setting, &builder]() {
|
||||||
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
if (setting->Id() == Settings::values.speed_limit.Id()) {
|
||||||
// custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
|
// speed_limit must be specified to translate the percentage
|
||||||
// it and custom_rtc_enabled
|
|
||||||
return builder.BuildWidget(setting, apply_funcs,
|
|
||||||
&Settings::values.custom_rtc_enabled);
|
|
||||||
} else if (setting->Id() == Settings::values.rng_seed.Id()) {
|
|
||||||
// rng_seed needs a HexEdit (default is LineEdit), and a checkbox to manage
|
|
||||||
// it and rng_seed_enabled
|
|
||||||
return builder.BuildWidget(setting, apply_funcs,
|
|
||||||
&Settings::values.rng_seed_enabled);
|
|
||||||
} else if (setting->Id() == Settings::values.speed_limit.Id()) {
|
|
||||||
// speed_limit needs a checkbox to set use_speed_limit, as well as a spinbox
|
|
||||||
return builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit,
|
return builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit,
|
||||||
ConfigurationShared::RequestType::SpinBox,
|
ConfigurationShared::RequestType::SpinBox,
|
||||||
tr("%", "Limit speed percentage (e.g. 50%)"));
|
tr("%", "Limit speed percentage (e.g. 50%)"));
|
||||||
|
|
|
@ -345,6 +345,10 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu
|
||||||
QLayout* layout = new QHBoxLayout(this);
|
QLayout* layout = new QHBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
if (other_setting == nullptr) {
|
||||||
|
other_setting = setting.PairedSetting();
|
||||||
|
}
|
||||||
|
|
||||||
const bool require_checkbox =
|
const bool require_checkbox =
|
||||||
other_setting != nullptr && other_setting->TypeId() == typeid(bool);
|
other_setting != nullptr && other_setting->TypeId() == typeid(bool);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue