aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/configuration/configure_general.cpp
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2023-06-21 01:42:42 -0400
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2023-07-21 10:56:55 -0400
commitad645c29a44bd117cad90bda56e1f4d6296f2666 (patch)
tree6301d2470cd09ea5ef3bd4007d1aa1c97fe7717d /src/yuzu/configuration/configure_general.cpp
parent62ffaa730fabd2101947dd28e50fae6d03162aa4 (diff)
configuration: Use a builder to create widgets
This gets rid of some repeated code and sets us up to send more information to the new widget.
Diffstat (limited to 'src/yuzu/configuration/configure_general.cpp')
-rw-r--r--src/yuzu/configuration/configure_general.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index ca5b92bc06..54113543af 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -15,12 +15,12 @@
ConfigureGeneral::ConfigureGeneral(
const 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::ConfigureGeneral>()}, system{system_},
- translations{translations_}, combobox_translations{combobox_translations_} {
+ const ConfigurationShared::Builder& builder, QWidget* parent)
+ : Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_} {
ui->setupUi(this);
+ Setup(builder);
+
SetConfiguration();
connect(ui->button_reset_defaults, &QPushButton::clicked, this,
@@ -33,17 +33,20 @@ ConfigureGeneral::ConfigureGeneral(
ConfigureGeneral::~ConfigureGeneral() = default;
-void ConfigureGeneral::SetConfiguration() {
- const bool runtime_lock = !system.IsPoweredOn();
+void ConfigureGeneral::SetConfiguration() {}
+
+void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) {
QLayout& layout = *ui->general_widget->layout();
std::map<u32, QWidget*> hold{};
for (const auto setting :
UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) {
- auto* widget = new ConfigurationShared::Widget(setting, translations, combobox_translations,
- this, runtime_lock, apply_funcs);
+ auto* widget = builder.BuildWidget(setting, apply_funcs);
+ if (widget == nullptr) {
+ continue;
+ }
if (!widget->Valid()) {
delete widget;
continue;