|
|
@ -46,13 +46,11 @@ static bool IsValidLocale(u32 region_index, u32 language_index) {
|
|
|
|
|
|
|
|
|
|
|
|
ConfigureSystem::ConfigureSystem(
|
|
|
|
ConfigureSystem::ConfigureSystem(
|
|
|
|
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
|
|
|
Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group_,
|
|
|
|
const ConfigurationShared::TranslationMap& translations_,
|
|
|
|
const ConfigurationShared::Builder& builder, QWidget* parent)
|
|
|
|
const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent)
|
|
|
|
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
|
|
|
|
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_},
|
|
|
|
|
|
|
|
translations{translations_}, combobox_translations{combobox_translations_} {
|
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
Setup();
|
|
|
|
Setup(builder);
|
|
|
|
|
|
|
|
|
|
|
|
connect(rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](int state) {
|
|
|
|
connect(rng_seed_checkbox, &QCheckBox::stateChanged, this, [this](int state) {
|
|
|
|
rng_seed_edit->setEnabled(state == Qt::Checked);
|
|
|
|
rng_seed_edit->setEnabled(state == Qt::Checked);
|
|
|
@ -104,8 +102,7 @@ void ConfigureSystem::RetranslateUI() {
|
|
|
|
ui->retranslateUi(this);
|
|
|
|
ui->retranslateUi(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfigureSystem::Setup() {
|
|
|
|
void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) {
|
|
|
|
const bool runtime_lock = !system.IsPoweredOn();
|
|
|
|
|
|
|
|
auto& core_layout = *ui->core_widget->layout();
|
|
|
|
auto& core_layout = *ui->core_widget->layout();
|
|
|
|
auto& system_layout = *ui->system_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]);
|
|
|
|
push(Settings::values.linkage.by_category[Settings::Category::System]);
|
|
|
|
|
|
|
|
|
|
|
|
for (auto setting : settings) {
|
|
|
|
for (auto setting : settings) {
|
|
|
|
if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
|
|
|
|
ConfigurationShared::Widget* widget = [this, setting, &builder]() {
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[maybe_unused]] std::string label = setting->GetLabel();
|
|
|
|
|
|
|
|
ConfigurationShared::Widget* widget = [this, setting, runtime_lock]() {
|
|
|
|
|
|
|
|
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
|
|
|
if (setting->Id() == Settings::values.custom_rtc.Id()) {
|
|
|
|
// custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
|
|
|
|
// custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
|
|
|
|
// it and custom_rtc_enabled
|
|
|
|
// it and custom_rtc_enabled
|
|
|
|
return new ConfigurationShared::Widget(
|
|
|
|
return builder.BuildWidget(setting, apply_funcs,
|
|
|
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
|
|
|
&Settings::values.custom_rtc_enabled,
|
|
|
|
&Settings::values.custom_rtc_enabled,
|
|
|
|
ConfigurationShared::RequestType::DateTimeEdit);
|
|
|
|
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 builder.BuildWidget(setting, apply_funcs, &Settings::values.rng_seed_enabled,
|
|
|
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
|
|
|
ConfigurationShared::RequestType::HexEdit);
|
|
|
|
&Settings::values.rng_seed_enabled, ConfigurationShared::RequestType::HexEdit);
|
|
|
|
|
|
|
|
} else if (setting->Id() == Settings::values.speed_limit.Id()) {
|
|
|
|
} else if (setting->Id() == Settings::values.speed_limit.Id()) {
|
|
|
|
// 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 builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit,
|
|
|
|
setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
|
|
|
|
ConfigurationShared::RequestType::SpinBox,
|
|
|
|
&Settings::values.use_speed_limit, ConfigurationShared::RequestType::SpinBox,
|
|
|
|
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 builder.BuildWidget(setting, apply_funcs);
|
|
|
|
this, runtime_lock, apply_funcs);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (widget == nullptr) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!widget->Valid()) {
|
|
|
|
if (!widget->Valid()) {
|
|
|
|
delete widget;
|
|
|
|
delete widget;
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|