summaryrefslogtreecommitdiffstats
path: root/src/yuzu/configuration/configure_system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/configuration/configure_system.cpp')
-rw-r--r--src/yuzu/configuration/configure_system.cpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 6a985c515..9be09244a 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -46,13 +46,11 @@ static bool IsValidLocale(u32 region_index, u32 language_index) {
ConfigureSystem::ConfigureSystem(
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
- const ConfigurationShared::TranslationMap& translations_,
- const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
- : Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
- translations{translations_}, combobox_translations{combobox_translations_} {
+ const ConfigurationShared::Builder& builder, QWidget* parent)
+ : Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
ui->setupUi(this);
- Setup();
+ Setup(builder);
connect(rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](int state) {
rng_seed_edit->setEnabled(state == Qt::Checked);
@@ -104,8 +102,7 @@ void ConfigureSystem::RetranslateUI() {
ui->retranslateUi(this);
}
-void ConfigureSystem::Setup() {
- const bool runtime_lock = !system.IsPoweredOn();
+void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
auto& core_layout = *ui->core_widget->layout();
auto& system_layout = *ui->system_widget->layout();
@@ -123,37 +120,31 @@ void ConfigureSystem::Setup() {
push(Settings::values.linkage.by_category[Settings::Category::System]);
for (auto setting : settings) {
- if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
- continue;
- }
-
- [[maybe_unused]] std::string label = setting->GetLabel();
- ConfigurationShared::Widget* widget = [this, setting, runtime_lock]() {
+ ConfigurationShared::Widget* widget = [this, setting, &builder]() {
if (setting->Id() == Settings::values.custom_rtc.Id()) {
// custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
// it and custom_rtc_enabled
- return new ConfigurationShared::Widget(
- setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
- &Settings::values.custom_rtc_enabled,
- ConfigurationShared::RequestType::DateTimeEdit);
+ return builder.BuildWidget(setting, apply_funcs,
+ &Settings::values.custom_rtc_enabled,
+ ConfigurationShared::RequestType::DateTimeEdit);
} 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 new ConfigurationShared::Widget(
- setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
- &Settings::values.rng_seed_enabled, ConfigurationShared::RequestType::HexEdit);
+ return builder.BuildWidget(setting, apply_funcs, &Settings::values.rng_seed_enabled,
+ ConfigurationShared::RequestType::HexEdit);
} 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 new ConfigurationShared::Widget(
- setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
- &Settings::values.use_speed_limit, ConfigurationShared::RequestType::SpinBox,
- tr("%", "Limit speed percentage (e.g. 50%)"));
+ return builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit,
+ ConfigurationShared::RequestType::SpinBox,
+ tr("%", "Limit speed percentage (e.g. 50%)"));
} else {
- return new ConfigurationShared::Widget(setting, translations, combobox_translations,
- this, runtime_lock, apply_funcs);
+ return builder.BuildWidget(setting, apply_funcs);
}
}();
+ if (widget == nullptr) {
+ continue;
+ }
if (!widget->Valid()) {
delete widget;
continue;