diff options
| author | 2023-05-18 22:17:36 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:07 -0400 | |
| commit | c5a3642cb62b4676d0c8b98949daec20e7c02e6b (patch) | |
| tree | 2954ab28d4690054016c01cfa2bdf40ccb14482d /src | |
| parent | settings, shared_widget: typo fixes (diff) | |
| download | yuzu-c5a3642cb62b4676d0c8b98949daec20e7c02e6b.tar.gz yuzu-c5a3642cb62b4676d0c8b98949daec20e7c02e6b.tar.xz yuzu-c5a3642cb62b4676d0c8b98949daec20e7c02e6b.zip | |
configuration: Use a mapping of setting value to name
Makes comboboxes always correspond to the value of the setting they're
modifying.
Diffstat (limited to 'src')
18 files changed, 355 insertions, 229 deletions
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index dd9eb4dc1..1cafeaa31 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp | |||
| @@ -15,12 +15,13 @@ | |||
| 15 | #include "yuzu/configuration/shared_widget.h" | 15 | #include "yuzu/configuration/shared_widget.h" |
| 16 | #include "yuzu/uisettings.h" | 16 | #include "yuzu/uisettings.h" |
| 17 | 17 | ||
| 18 | ConfigureAudio::ConfigureAudio(const Core::System& system_, | 18 | ConfigureAudio::ConfigureAudio( |
| 19 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 19 | const Core::System& system_, |
| 20 | const ConfigurationShared::TranslationMap& translations_, | 20 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 21 | QWidget* parent) | 21 | const ConfigurationShared::TranslationMap& translations_, |
| 22 | : Tab(group, parent), | 22 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent) |
| 23 | ui(std::make_unique<Ui::ConfigureAudio>()), system{system_}, translations{translations_} { | 23 | : Tab(group, parent), ui(std::make_unique<Ui::ConfigureAudio>()), system{system_}, |
| 24 | translations{translations_}, combobox_translations{combobox_translations_} { | ||
| 24 | ui->setupUi(this); | 25 | ui->setupUi(this); |
| 25 | Setup(); | 26 | Setup(); |
| 26 | 27 | ||
| @@ -48,18 +49,18 @@ void ConfigureAudio::Setup() { | |||
| 48 | auto* widget = [&]() { | 49 | auto* widget = [&]() { |
| 49 | if (setting->Id() == Settings::values.volume.Id()) { | 50 | if (setting->Id() == Settings::values.volume.Id()) { |
| 50 | return new ConfigurationShared::Widget( | 51 | return new ConfigurationShared::Widget( |
| 51 | setting, translations, this, runtime_lock, apply_funcs, | 52 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 52 | ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr, | 53 | ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr, |
| 53 | tr("%1%", "Volume percentage (e.g. 50%)")); | 54 | tr("%1%", "Volume percentage (e.g. 50%)")); |
| 54 | } else if (setting->Id() == Settings::values.audio_output_device_id.Id() || | 55 | } else if (setting->Id() == Settings::values.audio_output_device_id.Id() || |
| 55 | setting->Id() == Settings::values.audio_input_device_id.Id() || | 56 | setting->Id() == Settings::values.audio_input_device_id.Id() || |
| 56 | setting->Id() == Settings::values.sink_id.Id()) { | 57 | setting->Id() == Settings::values.sink_id.Id()) { |
| 57 | return new ConfigurationShared::Widget( | 58 | return new ConfigurationShared::Widget( |
| 58 | setting, translations, this, runtime_lock, apply_funcs, | 59 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 59 | ConfigurationShared::RequestType::ComboBox, false); | 60 | ConfigurationShared::RequestType::ComboBox, false); |
| 60 | } else { | 61 | } else { |
| 61 | return new ConfigurationShared::Widget(setting, translations, this, runtime_lock, | 62 | return new ConfigurationShared::Widget(setting, translations, combobox_translations, |
| 62 | apply_funcs); | 63 | this, runtime_lock, apply_funcs); |
| 63 | } | 64 | } |
| 64 | }(); | 65 | }(); |
| 65 | 66 | ||
diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index 170e0bce8..a9b005433 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h | |||
| @@ -22,10 +22,12 @@ class ConfigureAudio; | |||
| 22 | 22 | ||
| 23 | class ConfigureAudio : public ConfigurationShared::Tab { | 23 | class ConfigureAudio : public ConfigurationShared::Tab { |
| 24 | public: | 24 | public: |
| 25 | explicit ConfigureAudio(const Core::System& system_, | 25 | explicit ConfigureAudio( |
| 26 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 26 | const Core::System& system_, |
| 27 | const ConfigurationShared::TranslationMap& translations_, | 27 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 28 | QWidget* parent = nullptr); | 28 | const ConfigurationShared::TranslationMap& translations_, |
| 29 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, | ||
| 30 | QWidget* parent = nullptr); | ||
| 29 | ~ConfigureAudio() override; | 31 | ~ConfigureAudio() override; |
| 30 | 32 | ||
| 31 | void ApplyConfiguration() override; | 33 | void ApplyConfiguration() override; |
| @@ -49,6 +51,7 @@ private: | |||
| 49 | 51 | ||
| 50 | const Core::System& system; | 52 | const Core::System& system; |
| 51 | const ConfigurationShared::TranslationMap& translations; | 53 | const ConfigurationShared::TranslationMap& translations; |
| 54 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||
| 52 | 55 | ||
| 53 | std::forward_list<std::function<void(bool)>> apply_funcs{}; | 56 | std::forward_list<std::function<void(bool)>> apply_funcs{}; |
| 54 | 57 | ||
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index f0f00be83..1a339a227 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp | |||
| @@ -34,21 +34,25 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_, | |||
| 34 | : QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, | 34 | : QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()}, |
| 35 | registry(registry_), system{system_}, | 35 | registry(registry_), system{system_}, |
| 36 | translations{ConfigurationShared::InitializeTranslations(this)}, | 36 | translations{ConfigurationShared::InitializeTranslations(this)}, |
| 37 | audio_tab{std::make_unique<ConfigureAudio>(system_, nullptr, *translations, this)}, | 37 | combobox_translations{ConfigurationShared::ComboboxEnumeration(this)}, |
| 38 | audio_tab{std::make_unique<ConfigureAudio>(system_, nullptr, *translations, | ||
| 39 | *combobox_translations, this)}, | ||
| 38 | cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, this)}, | 40 | cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, this)}, |
| 39 | debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)}, | 41 | debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)}, |
| 40 | filesystem_tab{std::make_unique<ConfigureFilesystem>(this)}, | 42 | filesystem_tab{std::make_unique<ConfigureFilesystem>(this)}, |
| 41 | general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *translations, this)}, | 43 | general_tab{std::make_unique<ConfigureGeneral>(system_, nullptr, *translations, |
| 42 | graphics_advanced_tab{ | 44 | *combobox_translations, this)}, |
| 43 | std::make_unique<ConfigureGraphicsAdvanced>(system_, nullptr, *translations, this)}, | 45 | graphics_advanced_tab{std::make_unique<ConfigureGraphicsAdvanced>( |
| 46 | system_, nullptr, *translations, *combobox_translations, this)}, | ||
| 44 | graphics_tab{std::make_unique<ConfigureGraphics>( | 47 | graphics_tab{std::make_unique<ConfigureGraphics>( |
| 45 | system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, | 48 | system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, |
| 46 | nullptr, *translations, this)}, | 49 | nullptr, *translations, *combobox_translations, this)}, |
| 47 | hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)}, | 50 | hotkeys_tab{std::make_unique<ConfigureHotkeys>(system_.HIDCore(), this)}, |
| 48 | input_tab{std::make_unique<ConfigureInput>(system_, this)}, | 51 | input_tab{std::make_unique<ConfigureInput>(system_, this)}, |
| 49 | network_tab{std::make_unique<ConfigureNetwork>(system_, this)}, | 52 | network_tab{std::make_unique<ConfigureNetwork>(system_, this)}, |
| 50 | profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)}, | 53 | profile_tab{std::make_unique<ConfigureProfileManager>(system_, this)}, |
| 51 | system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *translations, this)}, | 54 | system_tab{std::make_unique<ConfigureSystem>(system_, nullptr, *translations, |
| 55 | *combobox_translations, this)}, | ||
| 52 | ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>( | 56 | ui_tab{std::make_unique<ConfigureUi>(system_, this)}, web_tab{std::make_unique<ConfigureWeb>( |
| 53 | this)} { | 57 | this)} { |
| 54 | Settings::SetConfiguringGlobal(true); | 58 | Settings::SetConfiguringGlobal(true); |
diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 0416b01d9..4f8c1912f 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h | |||
| @@ -72,6 +72,7 @@ private: | |||
| 72 | 72 | ||
| 73 | Core::System& system; | 73 | Core::System& system; |
| 74 | std::unique_ptr<ConfigurationShared::TranslationMap> translations; | 74 | std::unique_ptr<ConfigurationShared::TranslationMap> translations; |
| 75 | std::unique_ptr<ConfigurationShared::ComboboxTranslationMap> combobox_translations; | ||
| 75 | std::forward_list<ConfigurationShared::Tab*> tab_group; | 76 | std::forward_list<ConfigurationShared::Tab*> tab_group; |
| 76 | 77 | ||
| 77 | std::unique_ptr<ConfigureAudio> audio_tab; | 78 | std::unique_ptr<ConfigureAudio> audio_tab; |
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 7eb6cb9ec..fdae83c64 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp | |||
| @@ -15,9 +15,10 @@ | |||
| 15 | ConfigureGeneral::ConfigureGeneral( | 15 | ConfigureGeneral::ConfigureGeneral( |
| 16 | const Core::System& system_, | 16 | const Core::System& system_, |
| 17 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 17 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 18 | const ConfigurationShared::TranslationMap& translations_, QWidget* parent) | 18 | const ConfigurationShared::TranslationMap& translations_, |
| 19 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent) | ||
| 19 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_}, | 20 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureGeneral>()}, system{system_}, |
| 20 | translations{translations_} { | 21 | translations{translations_}, combobox_translations{combobox_translations_} { |
| 21 | ui->setupUi(this); | 22 | ui->setupUi(this); |
| 22 | 23 | ||
| 23 | SetConfiguration(); | 24 | SetConfiguration(); |
| @@ -40,8 +41,8 @@ void ConfigureGeneral::SetConfiguration() { | |||
| 40 | 41 | ||
| 41 | for (const auto setting : | 42 | for (const auto setting : |
| 42 | UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) { | 43 | UISettings::values.linkage.by_category[Settings::Category::UiGeneral]) { |
| 43 | auto* widget = | 44 | auto* widget = new ConfigurationShared::Widget(setting, translations, combobox_translations, |
| 44 | new ConfigurationShared::Widget(setting, translations, this, runtime_lock, apply_funcs); | 45 | this, runtime_lock, apply_funcs); |
| 45 | 46 | ||
| 46 | if (!widget->Valid()) { | 47 | if (!widget->Valid()) { |
| 47 | delete widget; | 48 | delete widget; |
diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 7692c16da..864dc3d2e 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h | |||
| @@ -22,10 +22,12 @@ class ConfigureGeneral; | |||
| 22 | 22 | ||
| 23 | class ConfigureGeneral : public ConfigurationShared::Tab { | 23 | class ConfigureGeneral : public ConfigurationShared::Tab { |
| 24 | public: | 24 | public: |
| 25 | explicit ConfigureGeneral(const Core::System& system_, | 25 | explicit ConfigureGeneral( |
| 26 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 26 | const Core::System& system_, |
| 27 | const ConfigurationShared::TranslationMap& translations_, | 27 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 28 | QWidget* parent = nullptr); | 28 | const ConfigurationShared::TranslationMap& translations_, |
| 29 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, | ||
| 30 | QWidget* parent = nullptr); | ||
| 29 | ~ConfigureGeneral() override; | 31 | ~ConfigureGeneral() override; |
| 30 | 32 | ||
| 31 | void SetResetCallback(std::function<void()> callback); | 33 | void SetResetCallback(std::function<void()> callback); |
| @@ -45,4 +47,5 @@ private: | |||
| 45 | 47 | ||
| 46 | const Core::System& system; | 48 | const Core::System& system; |
| 47 | const ConfigurationShared::TranslationMap& translations; | 49 | const ConfigurationShared::TranslationMap& translations; |
| 50 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||
| 48 | }; | 51 | }; |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 45a4db430..a4dac659f 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -79,10 +79,12 @@ ConfigureGraphics::ConfigureGraphics( | |||
| 79 | const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_, | 79 | const Core::System& system_, std::vector<VkDeviceInfo::Record>& records_, |
| 80 | const std::function<void()>& expose_compute_option_, | 80 | const std::function<void()>& expose_compute_option_, |
| 81 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 81 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 82 | const ConfigurationShared::TranslationMap& translations_, QWidget* parent) | 82 | const ConfigurationShared::TranslationMap& translations_, |
| 83 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent) | ||
| 83 | : ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, | 84 | : ConfigurationShared::Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphics>()}, |
| 84 | records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, | 85 | records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, |
| 85 | translations{translations_} { | 86 | translations{translations_}, combobox_translations{combobox_translations_}, |
| 87 | shader_mapping{combobox_translations.at(typeid(Settings::ShaderBackend))} { | ||
| 86 | vulkan_device = Settings::values.vulkan_device.GetValue(); | 88 | vulkan_device = Settings::values.vulkan_device.GetValue(); |
| 87 | RetrieveVulkanDevices(); | 89 | RetrieveVulkanDevices(); |
| 88 | 90 | ||
| @@ -235,22 +237,22 @@ void ConfigureGraphics::Setup() { | |||
| 235 | setting->Id() == Settings::values.shader_backend.Id() || | 237 | setting->Id() == Settings::values.shader_backend.Id() || |
| 236 | setting->Id() == Settings::values.vsync_mode.Id()) { | 238 | setting->Id() == Settings::values.vsync_mode.Id()) { |
| 237 | return new ConfigurationShared::Widget( | 239 | return new ConfigurationShared::Widget( |
| 238 | setting, translations, this, runtime_lock, apply_funcs, | 240 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 239 | ConfigurationShared::RequestType::ComboBox, false); | 241 | ConfigurationShared::RequestType::ComboBox, false); |
| 240 | } else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { | 242 | } else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { |
| 241 | return new ConfigurationShared::Widget( | 243 | return new ConfigurationShared::Widget( |
| 242 | setting, translations, this, runtime_lock, apply_funcs, | 244 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 243 | ConfigurationShared::RequestType::ReverseSlider, true, 0.5f, nullptr, | 245 | ConfigurationShared::RequestType::ReverseSlider, true, 0.5f, nullptr, |
| 244 | tr("%1%", "FSR sharpening percentage (e.g. 50%)")); | 246 | tr("%1%", "FSR sharpening percentage (e.g. 50%)")); |
| 245 | } else if (setting->Id() == Settings::values.speed_limit.Id()) { | 247 | } else if (setting->Id() == Settings::values.speed_limit.Id()) { |
| 246 | return new ConfigurationShared::Widget( | 248 | return new ConfigurationShared::Widget( |
| 247 | setting, translations, this, runtime_lock, apply_funcs, | 249 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 248 | ConfigurationShared::RequestType::SpinBox, true, 1.0f, | 250 | ConfigurationShared::RequestType::SpinBox, true, 1.0f, |
| 249 | &Settings::values.use_speed_limit, | 251 | &Settings::values.use_speed_limit, |
| 250 | tr("%", "Limit speed percentage (e.g. 50%)")); | 252 | tr("%", "Limit speed percentage (e.g. 50%)")); |
| 251 | } else { | 253 | } else { |
| 252 | return new ConfigurationShared::Widget(setting, translations, this, runtime_lock, | 254 | return new ConfigurationShared::Widget(setting, translations, combobox_translations, |
| 253 | apply_funcs); | 255 | this, runtime_lock, apply_funcs); |
| 254 | } | 256 | } |
| 255 | }(); | 257 | }(); |
| 256 | 258 | ||
| @@ -360,6 +362,15 @@ const QString ConfigureGraphics::TranslateVSyncMode(VkPresentModeKHR mode, | |||
| 360 | } | 362 | } |
| 361 | } | 363 | } |
| 362 | 364 | ||
| 365 | int ConfigureGraphics::FindIndex(std::type_index enumeration, int value) const { | ||
| 366 | for (u32 i = 0; i < combobox_translations.at(enumeration).size(); i++) { | ||
| 367 | if (combobox_translations.at(enumeration)[i].first == static_cast<u32>(value)) { | ||
| 368 | return i; | ||
| 369 | } | ||
| 370 | } | ||
| 371 | return -1; | ||
| 372 | } | ||
| 373 | |||
| 363 | void ConfigureGraphics::ApplyConfiguration() { | 374 | void ConfigureGraphics::ApplyConfiguration() { |
| 364 | const bool powered_on = system.IsPoweredOn(); | 375 | const bool powered_on = system.IsPoweredOn(); |
| 365 | for (const auto& func : apply_funcs) { | 376 | for (const auto& func : apply_funcs) { |
| @@ -374,13 +385,17 @@ void ConfigureGraphics::ApplyConfiguration() { | |||
| 374 | 385 | ||
| 375 | Settings::values.shader_backend.SetGlobal(true); | 386 | Settings::values.shader_backend.SetGlobal(true); |
| 376 | Settings::values.vulkan_device.SetGlobal(true); | 387 | Settings::values.vulkan_device.SetGlobal(true); |
| 377 | if (!Settings::IsConfiguringGlobal() && api_restore_global_button->isEnabled()) { | 388 | if (Settings::IsConfiguringGlobal() || |
| 378 | auto backend = static_cast<Settings::RendererBackend>(api_combobox->currentIndex()); | 389 | (!Settings::IsConfiguringGlobal() && api_restore_global_button->isEnabled())) { |
| 390 | auto backend = static_cast<Settings::RendererBackend>( | ||
| 391 | combobox_translations | ||
| 392 | .at(typeid(Settings::RendererBackend))[api_combobox->currentIndex()] | ||
| 393 | .first); | ||
| 379 | switch (backend) { | 394 | switch (backend) { |
| 380 | case Settings::RendererBackend::OpenGL: | 395 | case Settings::RendererBackend::OpenGL: |
| 381 | Settings::values.shader_backend.SetGlobal(false); | 396 | Settings::values.shader_backend.SetGlobal(false); |
| 382 | Settings::values.shader_backend.SetValue( | 397 | Settings::values.shader_backend.SetValue(static_cast<Settings::ShaderBackend>( |
| 383 | static_cast<Settings::ShaderBackend>(shader_backend_combobox->currentIndex())); | 398 | shader_mapping[shader_backend_combobox->currentIndex()].first)); |
| 384 | break; | 399 | break; |
| 385 | case Settings::RendererBackend::Vulkan: | 400 | case Settings::RendererBackend::Vulkan: |
| 386 | Settings::values.vulkan_device.SetGlobal(false); | 401 | Settings::values.vulkan_device.SetGlobal(false); |
| @@ -430,7 +445,8 @@ void ConfigureGraphics::UpdateAPILayout() { | |||
| 430 | 445 | ||
| 431 | switch (GetCurrentGraphicsBackend()) { | 446 | switch (GetCurrentGraphicsBackend()) { |
| 432 | case Settings::RendererBackend::OpenGL: | 447 | case Settings::RendererBackend::OpenGL: |
| 433 | shader_backend_combobox->setCurrentIndex(static_cast<u32>(shader_backend)); | 448 | shader_backend_combobox->setCurrentIndex( |
| 449 | FindIndex(typeid(Settings::ShaderBackend), static_cast<int>(shader_backend))); | ||
| 434 | vulkan_device_widget->setVisible(false); | 450 | vulkan_device_widget->setVisible(false); |
| 435 | shader_backend_widget->setVisible(true); | 451 | shader_backend_widget->setVisible(true); |
| 436 | break; | 452 | break; |
| @@ -467,5 +483,8 @@ Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { | |||
| 467 | if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { | 483 | if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { |
| 468 | return Settings::values.renderer_backend.GetValue(true); | 484 | return Settings::values.renderer_backend.GetValue(true); |
| 469 | } | 485 | } |
| 470 | return static_cast<Settings::RendererBackend>(api_combobox->currentIndex()); | 486 | return static_cast<Settings::RendererBackend>( |
| 487 | combobox_translations.at(typeid(Settings::RendererBackend)) | ||
| 488 | .at(api_combobox->currentIndex()) | ||
| 489 | .first); | ||
| 471 | } | 490 | } |
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index f36495ed3..9e421d024 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -36,12 +36,13 @@ class ConfigureGraphics; | |||
| 36 | 36 | ||
| 37 | class ConfigureGraphics : public ConfigurationShared::Tab { | 37 | class ConfigureGraphics : public ConfigurationShared::Tab { |
| 38 | public: | 38 | public: |
| 39 | explicit ConfigureGraphics(const Core::System& system_, | 39 | explicit ConfigureGraphics( |
| 40 | std::vector<VkDeviceInfo::Record>& records, | 40 | const Core::System& system_, std::vector<VkDeviceInfo::Record>& records, |
| 41 | const std::function<void()>& expose_compute_option_, | 41 | const std::function<void()>& expose_compute_option_, |
| 42 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 42 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 43 | const ConfigurationShared::TranslationMap& translations_, | 43 | const ConfigurationShared::TranslationMap& translations_, |
| 44 | QWidget* parent = nullptr); | 44 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, |
| 45 | QWidget* parent = nullptr); | ||
| 45 | ~ConfigureGraphics() override; | 46 | ~ConfigureGraphics() override; |
| 46 | 47 | ||
| 47 | void ApplyConfiguration() override; | 48 | void ApplyConfiguration() override; |
| @@ -68,6 +69,8 @@ private: | |||
| 68 | 69 | ||
| 69 | Settings::RendererBackend GetCurrentGraphicsBackend() const; | 70 | Settings::RendererBackend GetCurrentGraphicsBackend() const; |
| 70 | 71 | ||
| 72 | int FindIndex(std::type_index enumeration, int value) const; | ||
| 73 | |||
| 71 | std::unique_ptr<Ui::ConfigureGraphics> ui; | 74 | std::unique_ptr<Ui::ConfigureGraphics> ui; |
| 72 | QColor bg_color; | 75 | QColor bg_color; |
| 73 | 76 | ||
| @@ -85,6 +88,8 @@ private: | |||
| 85 | 88 | ||
| 86 | const Core::System& system; | 89 | const Core::System& system; |
| 87 | const ConfigurationShared::TranslationMap& translations; | 90 | const ConfigurationShared::TranslationMap& translations; |
| 91 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||
| 92 | const std::vector<std::pair<u32, QString>>& shader_mapping; | ||
| 88 | 93 | ||
| 89 | QPushButton* api_restore_global_button; | 94 | QPushButton* api_restore_global_button; |
| 90 | QComboBox* vulkan_device_combobox; | 95 | QComboBox* vulkan_device_combobox; |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 4f57a7ae6..61e9b3d69 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp | |||
| @@ -13,9 +13,10 @@ | |||
| 13 | ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced( | 13 | ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced( |
| 14 | const Core::System& system_, | 14 | const Core::System& system_, |
| 15 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 15 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 16 | const ConfigurationShared::TranslationMap& translations_, QWidget* parent) | 16 | const ConfigurationShared::TranslationMap& translations_, |
| 17 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent) | ||
| 17 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_}, | 18 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_}, |
| 18 | translations{translations_} { | 19 | translations{translations_}, combobox_translations{combobox_translations_} { |
| 19 | 20 | ||
| 20 | ui->setupUi(this); | 21 | ui->setupUi(this); |
| 21 | 22 | ||
| @@ -33,8 +34,8 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { | |||
| 33 | 34 | ||
| 34 | for (auto setting : | 35 | for (auto setting : |
| 35 | Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) { | 36 | Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) { |
| 36 | ConfigurationShared::Widget* widget = | 37 | ConfigurationShared::Widget* widget = new ConfigurationShared::Widget( |
| 37 | new ConfigurationShared::Widget(setting, translations, this, runtime_lock, apply_funcs); | 38 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs); |
| 38 | 39 | ||
| 39 | if (!widget->Valid()) { | 40 | if (!widget->Valid()) { |
| 40 | delete widget; | 41 | delete widget; |
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index 327134ee6..42634d3ff 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h | |||
| @@ -20,7 +20,9 @@ public: | |||
| 20 | explicit ConfigureGraphicsAdvanced( | 20 | explicit ConfigureGraphicsAdvanced( |
| 21 | const Core::System& system_, | 21 | const Core::System& system_, |
| 22 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 22 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 23 | const ConfigurationShared::TranslationMap& translations_, QWidget* parent = nullptr); | 23 | const ConfigurationShared::TranslationMap& translations_, |
| 24 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, | ||
| 25 | QWidget* parent = nullptr); | ||
| 24 | ~ConfigureGraphicsAdvanced() override; | 26 | ~ConfigureGraphicsAdvanced() override; |
| 25 | 27 | ||
| 26 | void ApplyConfiguration() override; | 28 | void ApplyConfiguration() override; |
| @@ -36,6 +38,7 @@ private: | |||
| 36 | 38 | ||
| 37 | const Core::System& system; | 39 | const Core::System& system; |
| 38 | const ConfigurationShared::TranslationMap& translations; | 40 | const ConfigurationShared::TranslationMap& translations; |
| 41 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||
| 39 | std::forward_list<std::function<void(bool)>> apply_funcs; | 42 | std::forward_list<std::function<void(bool)>> apply_funcs; |
| 40 | 43 | ||
| 41 | QWidget* checkbox_enable_compute_pipelines{}; | 44 | QWidget* checkbox_enable_compute_pipelines{}; |
diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index 2ee0a8ffa..845ffeeb8 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp | |||
| @@ -43,6 +43,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st | |||
| 43 | : QDialog(parent), | 43 | : QDialog(parent), |
| 44 | ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_}, | 44 | ui(std::make_unique<Ui::ConfigurePerGame>()), title_id{title_id_}, system{system_}, |
| 45 | translations{ConfigurationShared::InitializeTranslations(this)}, | 45 | translations{ConfigurationShared::InitializeTranslations(this)}, |
| 46 | combobox_translations{ConfigurationShared::ComboboxEnumeration(this)}, | ||
| 46 | tab_group{std::make_shared<std::forward_list<ConfigurationShared::Tab*>>()} { | 47 | tab_group{std::make_shared<std::forward_list<ConfigurationShared::Tab*>>()} { |
| 47 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); | 48 | const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); |
| 48 | const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) | 49 | const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) |
| @@ -50,15 +51,17 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st | |||
| 50 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); | 51 | game_config = std::make_unique<Config>(config_file_name, Config::ConfigType::PerGameConfig); |
| 51 | 52 | ||
| 52 | addons_tab = std::make_unique<ConfigurePerGameAddons>(system_, this); | 53 | addons_tab = std::make_unique<ConfigurePerGameAddons>(system_, this); |
| 53 | audio_tab = std::make_unique<ConfigureAudio>(system_, tab_group, *translations, this); | 54 | audio_tab = std::make_unique<ConfigureAudio>(system_, tab_group, *translations, |
| 55 | *combobox_translations, this); | ||
| 54 | cpu_tab = std::make_unique<ConfigureCpu>(system_, tab_group, this); | 56 | cpu_tab = std::make_unique<ConfigureCpu>(system_, tab_group, this); |
| 55 | graphics_advanced_tab = | 57 | graphics_advanced_tab = std::make_unique<ConfigureGraphicsAdvanced>( |
| 56 | std::make_unique<ConfigureGraphicsAdvanced>(system_, tab_group, *translations, this); | 58 | system_, tab_group, *translations, *combobox_translations, this); |
| 57 | graphics_tab = std::make_unique<ConfigureGraphics>( | 59 | graphics_tab = std::make_unique<ConfigureGraphics>( |
| 58 | system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, | 60 | system_, vk_device_records, [&]() { graphics_advanced_tab->ExposeComputeOption(); }, |
| 59 | tab_group, *translations, this); | 61 | tab_group, *translations, *combobox_translations, this); |
| 60 | input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this); | 62 | input_tab = std::make_unique<ConfigureInputPerGame>(system_, game_config.get(), this); |
| 61 | system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *translations, this); | 63 | system_tab = std::make_unique<ConfigureSystem>(system_, tab_group, *translations, |
| 64 | *combobox_translations, this); | ||
| 62 | 65 | ||
| 63 | ui->setupUi(this); | 66 | ui->setupUi(this); |
| 64 | 67 | ||
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index 32217c1f1..e43d4df94 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -75,6 +75,7 @@ private: | |||
| 75 | 75 | ||
| 76 | Core::System& system; | 76 | Core::System& system; |
| 77 | std::unique_ptr<ConfigurationShared::TranslationMap> translations; | 77 | std::unique_ptr<ConfigurationShared::TranslationMap> translations; |
| 78 | std::unique_ptr<ConfigurationShared::ComboboxTranslationMap> combobox_translations; | ||
| 78 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> tab_group; | 79 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> tab_group; |
| 79 | 80 | ||
| 80 | std::unique_ptr<ConfigurePerGameAddons> addons_tab; | 81 | std::unique_ptr<ConfigurePerGameAddons> addons_tab; |
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 128860800..40d0be8ca 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp | |||
| @@ -44,9 +44,10 @@ static bool IsValidLocale(u32 region_index, u32 language_index) { | |||
| 44 | 44 | ||
| 45 | ConfigureSystem::ConfigureSystem( | 45 | ConfigureSystem::ConfigureSystem( |
| 46 | Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 46 | Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 47 | ConfigurationShared::TranslationMap& translations_, QWidget* parent) | 47 | const ConfigurationShared::TranslationMap& translations_, |
| 48 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations_, QWidget* parent) | ||
| 48 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_}, | 49 | : Tab(group, parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_}, |
| 49 | translations{translations_} { | 50 | translations{translations_}, combobox_translations{combobox_translations_} { |
| 50 | ui->setupUi(this); | 51 | ui->setupUi(this); |
| 51 | 52 | ||
| 52 | Setup(); | 53 | Setup(); |
| @@ -121,18 +122,17 @@ void ConfigureSystem::Setup() { | |||
| 121 | ConfigurationShared::Widget* widget = [=]() { | 122 | ConfigurationShared::Widget* widget = [=]() { |
| 122 | if (setting->Id() == Settings::values.custom_rtc.Id()) { | 123 | if (setting->Id() == Settings::values.custom_rtc.Id()) { |
| 123 | return new ConfigurationShared::Widget( | 124 | return new ConfigurationShared::Widget( |
| 124 | setting, translations, this, runtime_lock, apply_funcs, | 125 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 125 | ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f, | 126 | ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f, |
| 126 | &Settings::values.custom_rtc_enabled); | 127 | &Settings::values.custom_rtc_enabled); |
| 127 | } else if (setting->Id() == Settings::values.rng_seed.Id()) { | 128 | } else if (setting->Id() == Settings::values.rng_seed.Id()) { |
| 128 | return new ConfigurationShared::Widget( | 129 | return new ConfigurationShared::Widget( |
| 129 | setting, translations, this, runtime_lock, apply_funcs, | 130 | setting, translations, combobox_translations, this, runtime_lock, apply_funcs, |
| 130 | ConfigurationShared::RequestType::HexEdit, true, 1.0f, | 131 | ConfigurationShared::RequestType::HexEdit, true, 1.0f, |
| 131 | &Settings::values.rng_seed_enabled); | 132 | &Settings::values.rng_seed_enabled); |
| 132 | } else { | 133 | } else { |
| 133 | return new ConfigurationShared::Widget(setting, translations, this, runtime_lock, | 134 | return new ConfigurationShared::Widget(setting, translations, combobox_translations, |
| 134 | 135 | this, runtime_lock, apply_funcs); | |
| 135 | apply_funcs); | ||
| 136 | } | 136 | } |
| 137 | }(); | 137 | }(); |
| 138 | 138 | ||
diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index 87b575060..c598c07f3 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h | |||
| @@ -22,10 +22,11 @@ class ConfigureSystem; | |||
| 22 | 22 | ||
| 23 | class ConfigureSystem : public ConfigurationShared::Tab { | 23 | class ConfigureSystem : public ConfigurationShared::Tab { |
| 24 | public: | 24 | public: |
| 25 | explicit ConfigureSystem(Core::System& system_, | 25 | explicit ConfigureSystem( |
| 26 | std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, | 26 | Core::System& system_, std::shared_ptr<std::forward_list<ConfigurationShared::Tab*>> group, |
| 27 | ConfigurationShared::TranslationMap& translations, | 27 | const ConfigurationShared::TranslationMap& translations, |
| 28 | QWidget* parent = nullptr); | 28 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations, |
| 29 | QWidget* parent = nullptr); | ||
| 29 | ~ConfigureSystem() override; | 30 | ~ConfigureSystem() override; |
| 30 | 31 | ||
| 31 | void ApplyConfiguration() override; | 32 | void ApplyConfiguration() override; |
| @@ -46,7 +47,8 @@ private: | |||
| 46 | ConfigurationShared::CheckState use_unsafe_extended_memory_layout; | 47 | ConfigurationShared::CheckState use_unsafe_extended_memory_layout; |
| 47 | 48 | ||
| 48 | Core::System& system; | 49 | Core::System& system; |
| 49 | ConfigurationShared::TranslationMap& translations; | 50 | const ConfigurationShared::TranslationMap& translations; |
| 51 | const ConfigurationShared::ComboboxTranslationMap& combobox_translations; | ||
| 50 | 52 | ||
| 51 | QCheckBox* rng_seed_checkbox; | 53 | QCheckBox* rng_seed_checkbox; |
| 52 | QLineEdit* rng_seed_edit; | 54 | QLineEdit* rng_seed_edit; |
diff --git a/src/yuzu/configuration/shared_translation.cpp b/src/yuzu/configuration/shared_translation.cpp index c3b38f776..8fd8f3076 100644 --- a/src/yuzu/configuration/shared_translation.cpp +++ b/src/yuzu/configuration/shared_translation.cpp | |||
| @@ -152,134 +152,204 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) { | |||
| 152 | return translations; | 152 | return translations; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | std::forward_list<QString> ComboboxEnumeration(std::type_index type, QWidget* parent) { | 155 | std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) { |
| 156 | std::unique_ptr<ComboboxTranslationMap> translations = | ||
| 157 | std::make_unique<ComboboxTranslationMap>(); | ||
| 156 | const auto& tr = [&](const char* text) { return parent->tr(text); }; | 158 | const auto& tr = [&](const char* text) { return parent->tr(text); }; |
| 157 | 159 | ||
| 158 | // Intentionally skipping VSyncMode to let the UI fill that one out | 160 | // Intentionally skipping VSyncMode to let the UI fill that one out |
| 159 | 161 | ||
| 160 | if (type == typeid(Settings::AstcDecodeMode)) { | 162 | translations->insert( |
| 161 | return { | 163 | {typeid(Settings::AstcDecodeMode), |
| 162 | tr("CPU"), | 164 | { |
| 163 | tr("GPU"), | 165 | {static_cast<u32>(Settings::AstcDecodeMode::CPU), tr("CPU")}, |
| 164 | tr("CPU Asynchronous"), | 166 | {static_cast<u32>(Settings::AstcDecodeMode::GPU), tr("GPU")}, |
| 165 | }; | 167 | {static_cast<u32>(Settings::AstcDecodeMode::CPUAsynchronous), tr("CPU Asynchronous")}, |
| 166 | } else if (type == typeid(Settings::RendererBackend)) { | 168 | }}); |
| 167 | return { | 169 | translations->insert({typeid(Settings::RendererBackend), |
| 168 | tr("OpenGL"), | 170 | { |
| 169 | tr("Vulkan"), | 171 | #ifdef HAS_OPENGL |
| 170 | tr("Null"), | 172 | {static_cast<u32>(Settings::RendererBackend::OpenGL), tr("OpenGL")}, |
| 171 | }; | 173 | #endif |
| 172 | } else if (type == typeid(Settings::ShaderBackend)) { | 174 | {static_cast<u32>(Settings::RendererBackend::Vulkan), tr("Vulkan")}, |
| 173 | return { | 175 | {static_cast<u32>(Settings::RendererBackend::Null), tr("Null")}, |
| 174 | tr("GLSL"), | 176 | }}); |
| 175 | tr("GLASM (Assembly Shaders, NVIDIA Only)"), | 177 | translations->insert({typeid(Settings::ShaderBackend), |
| 176 | tr("SPIR-V (Experimental, Mesa Only)"), | 178 | { |
| 177 | }; | 179 | {static_cast<u32>(Settings::ShaderBackend::GLSL), tr("GLSL")}, |
| 178 | } else if (type == typeid(Settings::GPUAccuracy)) { | 180 | {static_cast<u32>(Settings::ShaderBackend::GLASM), |
| 179 | return { | 181 | tr("GLASM (Assembly Shaders, NVIDIA Only)")}, |
| 180 | tr("Normal"), | 182 | {static_cast<u32>(Settings::ShaderBackend::SPIRV), |
| 181 | tr("High"), | 183 | tr("SPIR-V (Experimental, Mesa Only)")}, |
| 182 | tr("Extreme"), | 184 | }}); |
| 183 | }; | 185 | translations->insert({typeid(Settings::GPUAccuracy), |
| 184 | } else if (type == typeid(Settings::CPUAccuracy)) { | 186 | { |
| 185 | return { | 187 | {static_cast<u32>(Settings::GPUAccuracy::Normal), tr("Normal")}, |
| 186 | tr("Auto"), | 188 | {static_cast<u32>(Settings::GPUAccuracy::High), tr("High")}, |
| 187 | tr("Accurate"), | 189 | {static_cast<u32>(Settings::GPUAccuracy::Extreme), tr("Extreme")}, |
| 188 | tr("Unsafe"), | 190 | }}); |
| 189 | tr("Paranoid (disables most optimizations)"), | 191 | translations->insert({typeid(Settings::CPUAccuracy), |
| 190 | }; | 192 | { |
| 191 | } else if (type == typeid(Settings::FullscreenMode)) { | 193 | {static_cast<u32>(Settings::CPUAccuracy::Auto), tr("Auto")}, |
| 192 | return { | 194 | {static_cast<u32>(Settings::CPUAccuracy::Accurate), tr("Accurate")}, |
| 193 | tr("Borderless Windowed"), | 195 | {static_cast<u32>(Settings::CPUAccuracy::Unsafe), tr("Unsafe")}, |
| 194 | tr("Exclusive Fullscreen"), | 196 | {static_cast<u32>(Settings::CPUAccuracy::Paranoid), |
| 195 | }; | 197 | tr("Paranoid (disables most optimizations)")}, |
| 196 | } else if (type == typeid(Settings::NvdecEmulation)) { | 198 | }}); |
| 197 | return { | 199 | translations->insert( |
| 198 | tr("No Video Output"), | 200 | {typeid(Settings::FullscreenMode), |
| 199 | tr("CPU Video Decoding"), | 201 | { |
| 200 | tr("GPU Video Decoding (Default)"), | 202 | {static_cast<u32>(Settings::FullscreenMode::Borderless), tr("Borderless Windowed")}, |
| 201 | }; | 203 | {static_cast<u32>(Settings::FullscreenMode::Exclusive), tr("Exclusive Fullscreen")}, |
| 202 | } else if (type == typeid(Settings::ResolutionSetup)) { | 204 | }}); |
| 203 | return { | 205 | translations->insert( |
| 204 | tr("0.5X (360p/540p) [EXPERIMENTAL]"), | 206 | {typeid(Settings::NvdecEmulation), |
| 205 | tr("0.75X (540p/810p) [EXPERIMENTAL]"), | 207 | { |
| 206 | tr("1X (720p/1080p)"), | 208 | {static_cast<u32>(Settings::NvdecEmulation::Off), tr("No Video Output")}, |
| 207 | tr("1.5X (1080p/1620p) [EXPERIMENTAL]"), | 209 | {static_cast<u32>(Settings::NvdecEmulation::CPU), tr("CPU Video Decoding")}, |
| 208 | tr("2X (1440p/2160p)"), | 210 | {static_cast<u32>(Settings::NvdecEmulation::GPU), tr("GPU Video Decoding (Default)")}, |
| 209 | tr("3X (2160p/3240p)"), | 211 | }}); |
| 210 | tr("4X (2880p/4320p)"), | 212 | translations->insert( |
| 211 | tr("5X (3600p/5400p)"), | 213 | {typeid(Settings::ResolutionSetup), |
| 212 | tr("6X (4320p/6480p)"), | 214 | { |
| 213 | tr("7X (5040p/7560p)"), | 215 | {static_cast<u32>(Settings::ResolutionSetup::Res1_2X), |
| 214 | tr("8X (5760p/8640p)"), | 216 | tr("0.5X (360p/540p) [EXPERIMENTAL]")}, |
| 215 | }; | 217 | {static_cast<u32>(Settings::ResolutionSetup::Res3_4X), |
| 216 | } else if (type == typeid(Settings::ScalingFilter)) { | 218 | tr("0.75X (540p/810p) [EXPERIMENTAL]")}, |
| 217 | return { | 219 | {static_cast<u32>(Settings::ResolutionSetup::Res1X), tr("1X (720p/1080p)")}, |
| 218 | tr("Nearest Neighbor"), tr("Bilinear"), tr("Bicubic"), | 220 | {static_cast<u32>(Settings::ResolutionSetup::Res3_2X), |
| 219 | tr("Gaussian"), tr("ScaleForce"), tr("AMD FidelityFX™️ Super Resolution"), | 221 | tr("1.5X (1080p/1620p) [EXPERIMENTAL]")}, |
| 220 | }; | 222 | {static_cast<u32>(Settings::ResolutionSetup::Res2X), tr("2X (1440p/2160p)")}, |
| 221 | } else if (type == typeid(Settings::AntiAliasing)) { | 223 | {static_cast<u32>(Settings::ResolutionSetup::Res3X), tr("3X (2160p/3240p)")}, |
| 222 | return { | 224 | {static_cast<u32>(Settings::ResolutionSetup::Res4X), tr("4X (2880p/4320p)")}, |
| 223 | tr("None"), | 225 | {static_cast<u32>(Settings::ResolutionSetup::Res5X), tr("5X (3600p/5400p)")}, |
| 224 | tr("FXAA"), | 226 | {static_cast<u32>(Settings::ResolutionSetup::Res6X), tr("6X (4320p/6480p)")}, |
| 225 | tr("SMAA"), | 227 | {static_cast<u32>(Settings::ResolutionSetup::Res7X), tr("7X (5040p/7560p)")}, |
| 226 | }; | 228 | {static_cast<u32>(Settings::ResolutionSetup::Res8X), tr("8X (5760p/8640p)")}, |
| 227 | } else if (type == typeid(Settings::AspectRatio)) { | 229 | }}); |
| 228 | return { | 230 | translations->insert( |
| 229 | tr("Default (16:9)"), tr("Force 4:3"), tr("Force 21:9"), | 231 | {typeid(Settings::ScalingFilter), |
| 230 | tr("Force 16:10"), tr("Stretch to Window"), | 232 | { |
| 231 | }; | 233 | {static_cast<u32>(Settings::ScalingFilter::NearestNeighbor), tr("Nearest Neighbor")}, |
| 232 | } else if (type == typeid(Settings::AnisotropyMode)) { | 234 | {static_cast<u32>(Settings::ScalingFilter::Bilinear), tr("Bilinear")}, |
| 233 | return { | 235 | {static_cast<u32>(Settings::ScalingFilter::Bicubic), tr("Bicubic")}, |
| 234 | tr("Automatic"), tr("Default"), tr("2x"), tr("4x"), tr("8x"), tr("16x"), | 236 | {static_cast<u32>(Settings::ScalingFilter::Gaussian), tr("Gaussian")}, |
| 235 | }; | 237 | {static_cast<u32>(Settings::ScalingFilter::ScaleForce), tr("ScaleForce")}, |
| 236 | } else if (type == typeid(Settings::Language)) { | 238 | {static_cast<u32>(Settings::ScalingFilter::Fsr), |
| 237 | return { | 239 | tr("AMD FidelityFX™️ Super Resolution")}, |
| 238 | tr("Japanese (日本語)"), | 240 | }}); |
| 239 | tr("American English"), | 241 | translations->insert({typeid(Settings::AntiAliasing), |
| 240 | tr("French (français)"), | 242 | { |
| 241 | tr("German (Deutsch)"), | 243 | {static_cast<u32>(Settings::AntiAliasing::None), tr("None")}, |
| 242 | tr("Italian (italiano)"), | 244 | {static_cast<u32>(Settings::AntiAliasing::Fxaa), tr("FXAA")}, |
| 243 | tr("Spanish (español)"), | 245 | {static_cast<u32>(Settings::AntiAliasing::Smaa), tr("SMAA")}, |
| 244 | tr("Chinese"), | 246 | }}); |
| 245 | tr("Korean (한국어)"), | 247 | translations->insert( |
| 246 | tr("Dutch (Nederlands)"), | 248 | {typeid(Settings::AspectRatio), |
| 247 | tr("Portuguese (português)"), | 249 | { |
| 248 | tr("Russian (Русский)"), | 250 | {static_cast<u32>(Settings::AspectRatio::R16_9), tr("Default (16:9)")}, |
| 249 | tr("Taiwanese"), | 251 | {static_cast<u32>(Settings::AspectRatio::R4_3), tr("Force 4:3")}, |
| 250 | tr("British English"), | 252 | {static_cast<u32>(Settings::AspectRatio::R21_9), tr("Force 21:9")}, |
| 251 | tr("Canadian French"), | 253 | {static_cast<u32>(Settings::AspectRatio::R16_10), tr("Force 16:10")}, |
| 252 | tr("Latin American Spanish"), | 254 | {static_cast<u32>(Settings::AspectRatio::Stretch), tr("Stretch to Window")}, |
| 253 | tr("Simplified Chinese"), | 255 | }}); |
| 254 | tr("Traditional Chinese (正體中文)"), | 256 | translations->insert( |
| 255 | tr("Brazilian Portuguese (português do Brasil)"), | 257 | {typeid(Settings::AnisotropyMode), |
| 256 | }; | 258 | { |
| 257 | } else if (type == typeid(Settings::Region)) { | 259 | {static_cast<u32>(Settings::AnisotropyMode::Automatic), tr("Automatic")}, |
| 258 | return { | 260 | {static_cast<u32>(Settings::AnisotropyMode::Default), tr("Default")}, |
| 259 | tr("Japan"), tr("USA"), tr("Europe"), tr("Australia"), | 261 | {static_cast<u32>(Settings::AnisotropyMode::X2), tr("2x")}, |
| 260 | tr("China"), tr("Korea"), tr("Taiwan"), | 262 | {static_cast<u32>(Settings::AnisotropyMode::X4), tr("4x")}, |
| 261 | }; | 263 | {static_cast<u32>(Settings::AnisotropyMode::X8), tr("8x")}, |
| 262 | } else if (type == typeid(Settings::TimeZone)) { | 264 | {static_cast<u32>(Settings::AnisotropyMode::X16), tr("16x")}, |
| 263 | return { | 265 | }}); |
| 264 | tr("Auto"), tr("Default"), tr("CET"), tr("CST6CDT"), tr("Cuba"), | 266 | translations->insert( |
| 265 | tr("EET"), tr("Egypt"), tr("Eire"), tr("EST"), tr("EST5EDT"), | 267 | {typeid(Settings::Language), |
| 266 | tr("GB"), tr("GB-Eire"), tr("GMT"), tr("GMT+0"), tr("GMT-0"), | 268 | { |
| 267 | tr("GMT0"), tr("Greenwich"), tr("Hongkong"), tr("HST"), tr("Iceland"), | 269 | {static_cast<u32>(Settings::Language::Japanese), tr("Japanese (日本語)")}, |
| 268 | tr("Iran"), tr("Israel"), tr("Jamaica"), tr("Kwajalein"), tr("Libya"), | 270 | {static_cast<u32>(Settings::Language::EnglishAmerican), tr("American English")}, |
| 269 | tr("MET"), tr("MST"), tr("MST7MDT"), tr("Navajo"), tr("NZ"), | 271 | {static_cast<u32>(Settings::Language::French), tr("French (français)")}, |
| 270 | tr("NZ-CHAT"), tr("Poland"), tr("Portugal"), tr("PRC"), tr("PST8PDT"), | 272 | {static_cast<u32>(Settings::Language::German), tr("German (Deutsch)")}, |
| 271 | tr("ROC"), tr("ROK"), tr("Singapore"), tr("Turkey"), tr("UCT"), | 273 | {static_cast<u32>(Settings::Language::Italian), tr("Italian (italiano)")}, |
| 272 | tr("W-SU"), tr("WET"), tr("Zulu"), | 274 | {static_cast<u32>(Settings::Language::Spanish), tr("Spanish (español)")}, |
| 273 | }; | 275 | {static_cast<u32>(Settings::Language::Chinese), tr("Chinese")}, |
| 274 | } else if (type == typeid(Settings::AudioMode)) { | 276 | {static_cast<u32>(Settings::Language::Korean), tr("Korean (한국어)")}, |
| 275 | return { | 277 | {static_cast<u32>(Settings::Language::Dutch), tr("Dutch (Nederlands)")}, |
| 276 | tr("Mono"), | 278 | {static_cast<u32>(Settings::Language::Portuguese), tr("Portuguese (português)")}, |
| 277 | tr("Stereo"), | 279 | {static_cast<u32>(Settings::Language::Russian), tr("Russian (Русский)")}, |
| 278 | tr("Surround"), | 280 | {static_cast<u32>(Settings::Language::Taiwanese), tr("Taiwanese")}, |
| 279 | }; | 281 | {static_cast<u32>(Settings::Language::EnglishBritish), tr("British English")}, |
| 280 | } | 282 | {static_cast<u32>(Settings::Language::FrenchCanadian), tr("Canadian French")}, |
| 281 | 283 | {static_cast<u32>(Settings::Language::SpanishLatin), tr("Latin American Spanish")}, | |
| 282 | return {}; | 284 | {static_cast<u32>(Settings::Language::ChineseSimplified), tr("Simplified Chinese")}, |
| 283 | } | 285 | {static_cast<u32>(Settings::Language::ChineseTraditional), |
| 286 | tr("Traditional Chinese (正體中文)")}, | ||
| 287 | {static_cast<u32>(Settings::Language::PortugueseBrazilian), | ||
| 288 | tr("Brazilian Portuguese (português do Brasil)")}, | ||
| 289 | }}); | ||
| 290 | translations->insert({typeid(Settings::Region), | ||
| 291 | { | ||
| 292 | {static_cast<u32>(Settings::Region::Japan), tr("Japan")}, | ||
| 293 | {static_cast<u32>(Settings::Region::USA), tr("USA")}, | ||
| 294 | {static_cast<u32>(Settings::Region::Europe), tr("Europe")}, | ||
| 295 | {static_cast<u32>(Settings::Region::Australia), tr("Australia")}, | ||
| 296 | {static_cast<u32>(Settings::Region::China), tr("China")}, | ||
| 297 | {static_cast<u32>(Settings::Region::Korea), tr("Korea")}, | ||
| 298 | {static_cast<u32>(Settings::Region::Taiwan), tr("Taiwan")}, | ||
| 299 | }}); | ||
| 300 | translations->insert({typeid(Settings::TimeZone), | ||
| 301 | { | ||
| 302 | {static_cast<u32>(Settings::TimeZone::Auto), tr("Auto")}, | ||
| 303 | {static_cast<u32>(Settings::TimeZone::Default), tr("Default")}, | ||
| 304 | {static_cast<u32>(Settings::TimeZone::CET), tr("CET")}, | ||
| 305 | {static_cast<u32>(Settings::TimeZone::CST6CDT), tr("CST6CDT")}, | ||
| 306 | {static_cast<u32>(Settings::TimeZone::Cuba), tr("Cuba")}, | ||
| 307 | {static_cast<u32>(Settings::TimeZone::EET), tr("EET")}, | ||
| 308 | {static_cast<u32>(Settings::TimeZone::Egypt), tr("Egypt")}, | ||
| 309 | {static_cast<u32>(Settings::TimeZone::Eire), tr("Eire")}, | ||
| 310 | {static_cast<u32>(Settings::TimeZone::EST), tr("EST")}, | ||
| 311 | {static_cast<u32>(Settings::TimeZone::EST5EDT), tr("EST5EDT")}, | ||
| 312 | {static_cast<u32>(Settings::TimeZone::GB), tr("GB")}, | ||
| 313 | {static_cast<u32>(Settings::TimeZone::GBEire), tr("GB-Eire")}, | ||
| 314 | {static_cast<u32>(Settings::TimeZone::GMT), tr("GMT")}, | ||
| 315 | {static_cast<u32>(Settings::TimeZone::GMTPlusZero), tr("GMT+0")}, | ||
| 316 | {static_cast<u32>(Settings::TimeZone::GMTMinusZero), tr("GMT-0")}, | ||
| 317 | {static_cast<u32>(Settings::TimeZone::GMTZero), tr("GMT0")}, | ||
| 318 | {static_cast<u32>(Settings::TimeZone::Greenwich), tr("Greenwich")}, | ||
| 319 | {static_cast<u32>(Settings::TimeZone::Hongkong), tr("Hongkong")}, | ||
| 320 | {static_cast<u32>(Settings::TimeZone::HST), tr("HST")}, | ||
| 321 | {static_cast<u32>(Settings::TimeZone::Iceland), tr("Iceland")}, | ||
| 322 | {static_cast<u32>(Settings::TimeZone::Iran), tr("Iran")}, | ||
| 323 | {static_cast<u32>(Settings::TimeZone::Israel), tr("Israel")}, | ||
| 324 | {static_cast<u32>(Settings::TimeZone::Jamaica), tr("Jamaica")}, | ||
| 325 | {static_cast<u32>(Settings::TimeZone::Kwajalein), tr("Kwajalein")}, | ||
| 326 | {static_cast<u32>(Settings::TimeZone::Libya), tr("Libya")}, | ||
| 327 | {static_cast<u32>(Settings::TimeZone::MET), tr("MET")}, | ||
| 328 | {static_cast<u32>(Settings::TimeZone::MST), tr("MST")}, | ||
| 329 | {static_cast<u32>(Settings::TimeZone::MST7MDT), tr("MST7MDT")}, | ||
| 330 | {static_cast<u32>(Settings::TimeZone::Navajo), tr("Navajo")}, | ||
| 331 | {static_cast<u32>(Settings::TimeZone::NZ), tr("NZ")}, | ||
| 332 | {static_cast<u32>(Settings::TimeZone::NZCHAT), tr("NZ-CHAT")}, | ||
| 333 | {static_cast<u32>(Settings::TimeZone::Poland), tr("Poland")}, | ||
| 334 | {static_cast<u32>(Settings::TimeZone::Portugal), tr("Portugal")}, | ||
| 335 | {static_cast<u32>(Settings::TimeZone::PRC), tr("PRC")}, | ||
| 336 | {static_cast<u32>(Settings::TimeZone::PST8PDT), tr("PST8PDT")}, | ||
| 337 | {static_cast<u32>(Settings::TimeZone::ROC), tr("ROC")}, | ||
| 338 | {static_cast<u32>(Settings::TimeZone::ROK), tr("ROK")}, | ||
| 339 | {static_cast<u32>(Settings::TimeZone::Singapore), tr("Singapore")}, | ||
| 340 | {static_cast<u32>(Settings::TimeZone::Turkey), tr("Turkey")}, | ||
| 341 | {static_cast<u32>(Settings::TimeZone::UCT), tr("UCT")}, | ||
| 342 | {static_cast<u32>(Settings::TimeZone::W_SU), tr("W-SU")}, | ||
| 343 | {static_cast<u32>(Settings::TimeZone::WET), tr("WET")}, | ||
| 344 | {static_cast<u32>(Settings::TimeZone::Zulu), tr("Zulu")}, | ||
| 345 | }}); | ||
| 346 | translations->insert({typeid(Settings::AudioMode), | ||
| 347 | { | ||
| 348 | {static_cast<u32>(Settings::AudioMode::Mono), tr("Mono")}, | ||
| 349 | {static_cast<u32>(Settings::AudioMode::Stereo), tr("Stereo")}, | ||
| 350 | {static_cast<u32>(Settings::AudioMode::Surround), tr("Surround")}, | ||
| 351 | }}); | ||
| 284 | 352 | ||
| 353 | return translations; | ||
| 354 | } | ||
| 285 | } // namespace ConfigurationShared | 355 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/shared_translation.h b/src/yuzu/configuration/shared_translation.h index fcf638ea5..abe9c89b1 100644 --- a/src/yuzu/configuration/shared_translation.h +++ b/src/yuzu/configuration/shared_translation.h | |||
| @@ -1,21 +1,23 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <forward_list> | ||
| 5 | #include <map> | 4 | #include <map> |
| 6 | #include <memory> | 5 | #include <memory> |
| 7 | #include <string> | 6 | #include <string> |
| 8 | #include <typeindex> | 7 | #include <typeindex> |
| 9 | #include <utility> | 8 | #include <utility> |
| 9 | #include <vector> | ||
| 10 | #include <QString> | 10 | #include <QString> |
| 11 | 11 | ||
| 12 | class QWidget; | 12 | class QWidget; |
| 13 | 13 | ||
| 14 | namespace ConfigurationShared { | 14 | namespace ConfigurationShared { |
| 15 | using TranslationMap = std::map<u32, std::pair<QString, QString>>; | 15 | using TranslationMap = std::map<u32, std::pair<QString, QString>>; |
| 16 | using ComboboxTranslations = std::vector<std::pair<u32, QString>>; | ||
| 17 | using ComboboxTranslationMap = std::map<std::type_index, ComboboxTranslations>; | ||
| 16 | 18 | ||
| 17 | std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent); | 19 | std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent); |
| 18 | 20 | ||
| 19 | std::forward_list<QString> ComboboxEnumeration(std::type_index type, QWidget* parent); | 21 | std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent); |
| 20 | 22 | ||
| 21 | } // namespace ConfigurationShared | 23 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 4b21e5be8..64e1d90ad 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp | |||
| @@ -113,40 +113,51 @@ void Widget::CreateCombobox(const QString& label, std::function<void()>& load_fu | |||
| 113 | QLabel* qt_label = new QLabel(label, this); | 113 | QLabel* qt_label = new QLabel(label, this); |
| 114 | combobox = new QComboBox(this); | 114 | combobox = new QComboBox(this); |
| 115 | 115 | ||
| 116 | std::forward_list<QString> combobox_enumerations = ComboboxEnumeration(type, this); | ||
| 117 | for (const auto& item : combobox_enumerations) { | ||
| 118 | combobox->addItem(item); | ||
| 119 | } | ||
| 120 | |||
| 121 | layout->addWidget(qt_label); | 116 | layout->addWidget(qt_label); |
| 122 | layout->addWidget(combobox); | 117 | layout->addWidget(combobox); |
| 123 | 118 | ||
| 124 | layout->setSpacing(6); | 119 | layout->setSpacing(6); |
| 125 | layout->setContentsMargins(0, 0, 0, 0); | 120 | layout->setContentsMargins(0, 0, 0, 0); |
| 126 | 121 | ||
| 127 | if (!managed) { | 122 | const ComboboxTranslations* enumeration{nullptr}; |
| 128 | return; | 123 | if (combobox_enumerations.contains(type)) { |
| 124 | enumeration = &combobox_enumerations.at(type); | ||
| 125 | for (const auto& [id, name] : *enumeration) { | ||
| 126 | combobox->addItem(name); | ||
| 127 | } | ||
| 129 | } | 128 | } |
| 130 | 129 | ||
| 131 | // TODO: Remove audio engine specialization | 130 | if (!managed || enumeration == nullptr) { |
| 132 | if (setting.TypeId() != typeid(Settings::AudioEngine)) { | 131 | return; |
| 133 | combobox->setCurrentIndex(std::stoi(setting.ToString())); | ||
| 134 | } else { | ||
| 135 | combobox->setCurrentIndex( | ||
| 136 | static_cast<u32>(Settings::ToEnum<Settings::AudioEngine>(setting.ToString()))); | ||
| 137 | } | 132 | } |
| 138 | 133 | ||
| 134 | const auto find_index = [=](u32 value) -> int { | ||
| 135 | for (u32 i = 0; i < enumeration->size(); i++) { | ||
| 136 | if (enumeration->at(i).first == value) { | ||
| 137 | return i; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | return -1; | ||
| 141 | }; | ||
| 142 | |||
| 143 | const u32 setting_value = std::stoi(setting.ToString()); | ||
| 144 | combobox->setCurrentIndex(find_index(setting_value)); | ||
| 145 | |||
| 139 | if (Settings::IsConfiguringGlobal()) { | 146 | if (Settings::IsConfiguringGlobal()) { |
| 140 | load_func = [=]() { setting.LoadString(std::to_string(combobox->currentIndex())); }; | 147 | load_func = [=]() { |
| 148 | int current = combobox->currentIndex(); | ||
| 149 | setting.LoadString(std::to_string(enumeration->at(current).first)); | ||
| 150 | }; | ||
| 141 | } else { | 151 | } else { |
| 142 | restore_button = CreateRestoreGlobalButton(setting.UsingGlobal(), this); | 152 | restore_button = CreateRestoreGlobalButton(setting.UsingGlobal(), this); |
| 143 | layout->addWidget(restore_button); | 153 | layout->addWidget(restore_button); |
| 144 | 154 | ||
| 145 | QObject::connect(restore_button, &QAbstractButton::clicked, [&](bool) { | 155 | QObject::connect(restore_button, &QAbstractButton::clicked, [=](bool) { |
| 146 | restore_button->setEnabled(false); | 156 | restore_button->setEnabled(false); |
| 147 | restore_button->setVisible(false); | 157 | restore_button->setVisible(false); |
| 148 | 158 | ||
| 149 | combobox->setCurrentIndex(std::stoi(setting.ToStringGlobal())); | 159 | const u32 global_value = std::stoi(setting.ToStringGlobal()); |
| 160 | combobox->setCurrentIndex(find_index(global_value)); | ||
| 150 | }); | 161 | }); |
| 151 | 162 | ||
| 152 | QObject::connect(combobox, QOverload<int>::of(&QComboBox::activated), [=](int) { | 163 | QObject::connect(combobox, QOverload<int>::of(&QComboBox::activated), [=](int) { |
| @@ -158,7 +169,8 @@ void Widget::CreateCombobox(const QString& label, std::function<void()>& load_fu | |||
| 158 | bool using_global = !restore_button->isEnabled(); | 169 | bool using_global = !restore_button->isEnabled(); |
| 159 | setting.SetGlobal(using_global); | 170 | setting.SetGlobal(using_global); |
| 160 | if (!using_global) { | 171 | if (!using_global) { |
| 161 | setting.LoadString(std::to_string(combobox->currentIndex())); | 172 | int current = combobox->currentIndex(); |
| 173 | setting.LoadString(std::to_string(enumeration->at(current).first)); | ||
| 162 | } | 174 | } |
| 163 | }; | 175 | }; |
| 164 | } | 176 | } |
| @@ -523,17 +535,13 @@ bool Widget::Valid() { | |||
| 523 | Widget::~Widget() = default; | 535 | Widget::~Widget() = default; |
| 524 | 536 | ||
| 525 | Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, | 537 | Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, |
| 526 | QWidget* parent_, std::forward_list<std::function<void(bool)>>& apply_funcs_) | 538 | const ComboboxTranslationMap& combobox_translations_, QWidget* parent_, |
| 527 | : QWidget(parent_), parent{parent_}, translations{translations_}, setting{*setting_}, | 539 | bool runtime_lock_, std::forward_list<std::function<void(bool)>>& apply_funcs_, |
| 528 | apply_funcs{apply_funcs_} {} | 540 | RequestType request, bool managed, float multiplier, |
| 529 | 541 | Settings::BasicSetting* other_setting, const QString& string) | |
| 530 | Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, | 542 | : QWidget(parent_), parent{parent_}, translations{translations_}, |
| 531 | QWidget* parent_, bool runtime_lock_, | 543 | combobox_enumerations{combobox_translations_}, setting{*setting_}, apply_funcs{apply_funcs_}, |
| 532 | std::forward_list<std::function<void(bool)>>& apply_funcs_, RequestType request, | 544 | runtime_lock{runtime_lock_} { |
| 533 | bool managed, float multiplier, Settings::BasicSetting* other_setting, | ||
| 534 | const QString& string) | ||
| 535 | : QWidget(parent_), parent{parent_}, translations{translations_}, setting{*setting_}, | ||
| 536 | apply_funcs{apply_funcs_}, runtime_lock{runtime_lock_} { | ||
| 537 | if (!Settings::IsConfiguringGlobal() && !setting.Switchable()) { | 545 | if (!Settings::IsConfiguringGlobal() && !setting.Switchable()) { |
| 538 | LOG_DEBUG(Frontend, "\"{}\" is not switchable, skipping...", setting.GetLabel()); | 546 | LOG_DEBUG(Frontend, "\"{}\" is not switchable, skipping...", setting.GetLabel()); |
| 539 | return; | 547 | return; |
| @@ -632,5 +640,4 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati | |||
| 632 | 640 | ||
| 633 | this->setToolTip(tooltip); | 641 | this->setToolTip(tooltip); |
| 634 | } | 642 | } |
| 635 | |||
| 636 | } // namespace ConfigurationShared | 643 | } // namespace ConfigurationShared |
diff --git a/src/yuzu/configuration/shared_widget.h b/src/yuzu/configuration/shared_widget.h index 331316040..6077f045d 100644 --- a/src/yuzu/configuration/shared_widget.h +++ b/src/yuzu/configuration/shared_widget.h | |||
| @@ -35,13 +35,12 @@ class Widget : public QWidget { | |||
| 35 | Q_OBJECT | 35 | Q_OBJECT |
| 36 | 36 | ||
| 37 | public: | 37 | public: |
| 38 | Widget(Settings::BasicSetting* setting, const TranslationMap& translations, QWidget* parent, | 38 | Widget(Settings::BasicSetting* setting, const TranslationMap& translations, |
| 39 | bool runtime_lock, std::forward_list<std::function<void(bool)>>& apply_funcs_, | 39 | const ComboboxTranslationMap& combobox_translations, QWidget* parent, bool runtime_lock, |
| 40 | std::forward_list<std::function<void(bool)>>& apply_funcs_, | ||
| 40 | RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f, | 41 | RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f, |
| 41 | Settings::BasicSetting* other_setting = nullptr, | 42 | Settings::BasicSetting* other_setting = nullptr, |
| 42 | const QString& string = QStringLiteral("")); | 43 | const QString& string = QStringLiteral("")); |
| 43 | Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, QWidget* parent_, | ||
| 44 | std::forward_list<std::function<void(bool)>>& apply_funcs_); | ||
| 45 | virtual ~Widget(); | 44 | virtual ~Widget(); |
| 46 | 45 | ||
| 47 | bool Valid(); | 46 | bool Valid(); |
| @@ -77,6 +76,7 @@ private: | |||
| 77 | 76 | ||
| 78 | QWidget* parent; | 77 | QWidget* parent; |
| 79 | const TranslationMap& translations; | 78 | const TranslationMap& translations; |
| 79 | const ComboboxTranslationMap& combobox_enumerations; | ||
| 80 | Settings::BasicSetting& setting; | 80 | Settings::BasicSetting& setting; |
| 81 | std::forward_list<std::function<void(bool)>>& apply_funcs; | 81 | std::forward_list<std::function<void(bool)>>& apply_funcs; |
| 82 | 82 | ||