diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-06-21 09:29:20 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-07-21 16:56:55 +0200 |
commit | 21723879e7631b2d81d3c3ff14f93c834bc1cdd8 (patch) | |
tree | ca8a5f8e23f36a207fa04669e3399cd501d03c58 | |
parent | settings: Define specializations for settings (diff) | |
download | yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar.gz yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar.bz2 yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar.lz yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar.xz yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.tar.zst yuzu-21723879e7631b2d81d3c3ff14f93c834bc1cdd8.zip |
-rw-r--r-- | src/yuzu/configuration/configure_audio.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 8 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 7 | ||||
-rw-r--r-- | src/yuzu/configuration/shared_widget.cpp | 31 |
4 files changed, 36 insertions, 18 deletions
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 6db47fd61..cdb89ccda 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -44,18 +44,12 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { for (auto* setting : settings) { auto* widget = [&]() { + // TODO (lat9nq): Let the system manage sink_id if (setting->Id() == Settings::values.volume.Id()) { // volume needs to be a slider (default is line edit) return builder.BuildWidget(setting, apply_funcs, nullptr, ConfigurationShared::RequestType::Slider, tr("%1%", "Volume percentage (e.g. 50%)")); - } else if (setting->Id() == Settings::values.audio_output_device_id.Id() || - setting->Id() == Settings::values.audio_input_device_id.Id() || - setting->Id() == Settings::values.sink_id.Id()) { - // These need to be unmanaged comboboxes, so we can populate them ourselves - // TODO (lat9nq): Let it manage sink_id - return builder.BuildWidget(setting, apply_funcs, - ConfigurationShared::RequestType::ComboBox, false); } else { return builder.BuildWidget(setting, apply_funcs); } diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 18872fa69..74449e6d4 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -231,13 +231,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { ConfigurationShared::Widget* widget = [&]() { - // Set managed to false on these and set up the comboboxes ourselves - if (setting->Id() == Settings::values.vulkan_device.Id() || - setting->Id() == Settings::values.shader_backend.Id() || - setting->Id() == Settings::values.vsync_mode.Id()) { - return builder.BuildWidget(setting, apply_funcs, - ConfigurationShared::RequestType::ComboBox, false); - } else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { + if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { // FSR needs a reversed slider return builder.BuildWidget( setting, apply_funcs, ConfigurationShared::RequestType::ReverseSlider, true, diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 9be09244a..796ebc44f 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -125,13 +125,12 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { // custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage // it and custom_rtc_enabled return builder.BuildWidget(setting, apply_funcs, - &Settings::values.custom_rtc_enabled, - ConfigurationShared::RequestType::DateTimeEdit); + &Settings::values.custom_rtc_enabled); } 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 builder.BuildWidget(setting, apply_funcs, &Settings::values.rng_seed_enabled, - ConfigurationShared::RequestType::HexEdit); + return builder.BuildWidget(setting, apply_funcs, + &Settings::values.rng_seed_enabled); } 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 builder.BuildWidget(setting, apply_funcs, &Settings::values.use_speed_limit, diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index dc8b31238..807d1d668 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp @@ -376,6 +376,32 @@ void Widget::SetupComponent(const QString& label, std::function<void()>& load_fu layout->addWidget(qt_label); } + request = [&]() { + if (request != RequestType::Default) { + return request; + } + switch (setting.Specialization()) { + case Settings::Specialization::Default: + return RequestType::Default; + case Settings::Specialization::Time: + return RequestType::DateTimeEdit; + case Settings::Specialization::Hex: + return RequestType::HexEdit; + case Settings::Specialization::RuntimeList: + managed = false; + [[fallthrough]]; + case Settings::Specialization::List: + return RequestType::ComboBox; + case Settings::Specialization::Scalar: + return RequestType::Slider; + case Settings::Specialization::Countable: + return RequestType::SpinBox; + default: + break; + } + return request; + }(); + if (setting.TypeId() == typeid(bool)) { data_component = CreateCheckBox(&setting, label, serializer, restore_func, touch); } else if (setting.IsEnum()) { @@ -544,6 +570,11 @@ Widget* Builder::BuildWidget(Settings::BasicSetting* setting, return nullptr; } + if (setting->Specialization() == Settings::Specialization::Paired) { + LOG_DEBUG(Frontend, "\"{}\" has specialization Paired: ignoring", setting->GetLabel()); + return nullptr; + } + return new Widget(setting, *translations, *combobox_translations, parent, runtime_lock, apply_funcs, request, managed, multiplier, other_setting, string); } |