Quellcode durchsuchen

FIXME configuration: Avoid unnecessary allocations

ConfigurationShared::Widget needs to be created with a builder. This
would avoid some duplicated code.
lat9nq vor 3 Jahren
Ursprung
Commit
79024bb955

+ 4 - 0
src/yuzu/configuration/configure_audio.cpp

@@ -47,6 +47,10 @@ void ConfigureAudio::Setup() {
     push(Settings::Category::SystemAudio);
     push(Settings::Category::SystemAudio);
 
 
     for (auto* setting : settings) {
     for (auto* setting : settings) {
+        if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
+            continue;
+        }
+
         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)

+ 4 - 0
src/yuzu/configuration/configure_cpu.cpp

@@ -50,6 +50,10 @@ void ConfigureCpu::Setup() {
     push(Settings::Category::CpuUnsafe);
     push(Settings::Category::CpuUnsafe);
 
 
     for (const auto setting : settings) {
     for (const auto setting : settings) {
+        if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
+            continue;
+        }
+
         auto* widget = new ConfigurationShared::Widget(setting, translations, combobox_translations,
         auto* widget = new ConfigurationShared::Widget(setting, translations, combobox_translations,
                                                        this, runtime_lock, apply_funcs);
                                                        this, runtime_lock, apply_funcs);
 
 

+ 6 - 2
src/yuzu/configuration/configure_graphics.cpp

@@ -231,6 +231,10 @@ void ConfigureGraphics::Setup() {
     std::forward_list<QWidget*> hold_api;
     std::forward_list<QWidget*> hold_api;
 
 
     for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) {
     for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) {
+        if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
+            continue;
+        }
+
         ConfigurationShared::Widget* widget = [&]() {
         ConfigurationShared::Widget* widget = [&]() {
             // Set managed to false on these and set up the comboboxes ourselves
             // Set managed to false on these and set up the comboboxes ourselves
             if (setting->Id() == Settings::values.vulkan_device.Id() ||
             if (setting->Id() == Settings::values.vulkan_device.Id() ||
@@ -273,8 +277,8 @@ void ConfigureGraphics::Setup() {
                                  [=](bool) { UpdateAPILayout(); });
                                  [=](bool) { UpdateAPILayout(); });
 
 
                 // Detach API's restore button and place it where we want
                 // Detach API's restore button and place it where we want
-                // Lets us put it on the side, and it will automatically scale if there's a second
-                // combobox (shader_backend, vulkan_device)
+                // Lets us put it on the side, and it will automatically scale if there's a
+                // second combobox (shader_backend, vulkan_device)
                 widget->layout()->removeWidget(api_restore_global_button);
                 widget->layout()->removeWidget(api_restore_global_button);
                 api_layout->addWidget(api_restore_global_button);
                 api_layout->addWidget(api_restore_global_button);
             }
             }

+ 4 - 0
src/yuzu/configuration/configure_graphics_advanced.cpp

@@ -35,6 +35,10 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
 
 
     for (auto setting :
     for (auto setting :
          Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
          Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
+        if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) {
+            continue;
+        }
+
         ConfigurationShared::Widget* widget = new ConfigurationShared::Widget(
         ConfigurationShared::Widget* widget = new ConfigurationShared::Widget(
             setting, translations, combobox_translations, this, runtime_lock, apply_funcs);
             setting, translations, combobox_translations, this, runtime_lock, apply_funcs);
 
 

+ 4 - 0
src/yuzu/configuration/configure_system.cpp

@@ -123,6 +123,10 @@ 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()) {
+            continue;
+        }
+
         [[maybe_unused]] std::string label = setting->GetLabel();
         [[maybe_unused]] std::string label = setting->GetLabel();
         ConfigurationShared::Widget* widget = [=]() {
         ConfigurationShared::Widget* widget = [=]() {
             if (setting->Id() == Settings::values.custom_rtc.Id()) {
             if (setting->Id() == Settings::values.custom_rtc.Id()) {