summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2023-06-09 17:40:25 -0400
committerGravatar lat9nq2023-07-21 10:56:54 -0400
commit81e9cf09349119cb84c5f52e2d7b64f0fe2482b8 (patch)
tree3de932c14c77ddf85d2a135726d7bd20510cea63
parentsettings: Reorder (diff)
downloadyuzu-81e9cf09349119cb84c5f52e2d7b64f0fe2482b8.tar.gz
yuzu-81e9cf09349119cb84c5f52e2d7b64f0fe2482b8.tar.xz
yuzu-81e9cf09349119cb84c5f52e2d7b64f0fe2482b8.zip
configuration: Document odd widget cases
Explain why we need to do things differently at times, to serve as a reference.
-rw-r--r--src/yuzu/configuration/configure_audio.cpp4
-rw-r--r--src/yuzu/configuration/configure_cpu.cpp2
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp10
-rw-r--r--src/yuzu/configuration/configure_graphics_advanced.cpp1
-rw-r--r--src/yuzu/configuration/configure_system.cpp9
5 files changed, 25 insertions, 1 deletions
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp
index 7cc8affb7..9f9e4df8b 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -49,6 +49,7 @@ void ConfigureAudio::Setup() {
49 for (auto* setting : settings) { 49 for (auto* setting : settings) {
50 auto* widget = [&]() { 50 auto* widget = [&]() {
51 if (setting->Id() == Settings::values.volume.Id()) { 51 if (setting->Id() == Settings::values.volume.Id()) {
52 // volume needs to be a slider (default is line edit)
52 return new ConfigurationShared::Widget( 53 return new ConfigurationShared::Widget(
53 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 54 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
54 ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr, 55 ConfigurationShared::RequestType::Slider, true, 1.0f, nullptr,
@@ -56,6 +57,7 @@ void ConfigureAudio::Setup() {
56 } else if (setting->Id() == Settings::values.audio_output_device_id.Id() || 57 } else if (setting->Id() == Settings::values.audio_output_device_id.Id() ||
57 setting->Id() == Settings::values.audio_input_device_id.Id() || 58 setting->Id() == Settings::values.audio_input_device_id.Id() ||
58 setting->Id() == Settings::values.sink_id.Id()) { 59 setting->Id() == Settings::values.sink_id.Id()) {
60 // These need to be unmanaged comboboxes, so we can populate them ourselves
59 return new ConfigurationShared::Widget( 61 return new ConfigurationShared::Widget(
60 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 62 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
61 ConfigurationShared::RequestType::ComboBox, false); 63 ConfigurationShared::RequestType::ComboBox, false);
@@ -79,6 +81,8 @@ void ConfigureAudio::Setup() {
79 connect(sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this, 81 connect(sink_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
80 &ConfigureAudio::UpdateAudioDevices); 82 &ConfigureAudio::UpdateAudioDevices);
81 } else if (setting->Id() == Settings::values.audio_output_device_id.Id()) { 83 } else if (setting->Id() == Settings::values.audio_output_device_id.Id()) {
84 // Keep track of output (and input) device comboboxes to populate them with system
85 // devices, which are determined at run time
82 output_device_combo_box = widget->combobox; 86 output_device_combo_box = widget->combobox;
83 } else if (setting->Id() == Settings::values.audio_input_device_id.Id()) { 87 } else if (setting->Id() == Settings::values.audio_input_device_id.Id()) {
84 input_device_combo_box = widget->combobox; 88 input_device_combo_box = widget->combobox;
diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp
index 67b811014..159837ebd 100644
--- a/src/yuzu/configuration/configure_cpu.cpp
+++ b/src/yuzu/configuration/configure_cpu.cpp
@@ -58,9 +58,11 @@ void ConfigureCpu::Setup() {
58 } 58 }
59 59
60 if (setting->Id() == Settings::values.cpu_accuracy.Id()) { 60 if (setting->Id() == Settings::values.cpu_accuracy.Id()) {
61 // Keep track of cpu_accuracy combobox to display/hide the unsafe settings
61 accuracy_layout->addWidget(widget); 62 accuracy_layout->addWidget(widget);
62 accuracy_combobox = widget->combobox; 63 accuracy_combobox = widget->combobox;
63 } else { 64 } else {
65 // Presently, all other settings here are unsafe checkboxes
64 unsafe_hold.insert({setting->GetLabel(), widget}); 66 unsafe_hold.insert({setting->GetLabel(), widget});
65 } 67 }
66 } 68 }
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 1e26267a0..c053da0cd 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -231,6 +231,7 @@ void ConfigureGraphics::Setup() {
231 231
232 for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { 232 for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) {
233 ConfigurationShared::Widget* widget = [&]() { 233 ConfigurationShared::Widget* widget = [&]() {
234 // Set managed to false on these and set up the comboboxes ourselves
234 if (setting->Id() == Settings::values.vulkan_device.Id() || 235 if (setting->Id() == Settings::values.vulkan_device.Id() ||
235 setting->Id() == Settings::values.shader_backend.Id() || 236 setting->Id() == Settings::values.shader_backend.Id() ||
236 setting->Id() == Settings::values.vsync_mode.Id()) { 237 setting->Id() == Settings::values.vsync_mode.Id()) {
@@ -238,11 +239,13 @@ void ConfigureGraphics::Setup() {
238 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 239 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
239 ConfigurationShared::RequestType::ComboBox, false); 240 ConfigurationShared::RequestType::ComboBox, false);
240 } else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) { 241 } else if (setting->Id() == Settings::values.fsr_sharpening_slider.Id()) {
242 // FSR needs a reversed slider
241 return new ConfigurationShared::Widget( 243 return new ConfigurationShared::Widget(
242 setting, translations, combobox_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()) {
248 // speed_limit needs a checkbox to set use_speed_limit, as well as a spinbox
246 return new ConfigurationShared::Widget( 249 return new ConfigurationShared::Widget(
247 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 250 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
248 ConfigurationShared::RequestType::SpinBox, true, 1.0f, 251 ConfigurationShared::RequestType::SpinBox, true, 1.0f,
@@ -269,18 +272,23 @@ void ConfigureGraphics::Setup() {
269 [=](bool) { UpdateAPILayout(); }); 272 [=](bool) { UpdateAPILayout(); });
270 273
271 // Detach API's restore button and place it where we want 274 // Detach API's restore button and place it where we want
275 // Lets us put it on the side, and it will automatically scale if there's a second
276 // combobox (shader_backend, vulkan_device)
272 widget->layout()->removeWidget(api_restore_global_button); 277 widget->layout()->removeWidget(api_restore_global_button);
273 api_layout->addWidget(api_restore_global_button); 278 api_layout->addWidget(api_restore_global_button);
274 } 279 }
275 } else if (setting->Id() == Settings::values.vulkan_device.Id()) { 280 } else if (setting->Id() == Settings::values.vulkan_device.Id()) {
281 // Keep track of vulkan_device's combobox so we can populate it
276 hold_api.push_front(widget); 282 hold_api.push_front(widget);
277 vulkan_device_combobox = widget->combobox; 283 vulkan_device_combobox = widget->combobox;
278 vulkan_device_widget = widget; 284 vulkan_device_widget = widget;
279 } else if (setting->Id() == Settings::values.shader_backend.Id()) { 285 } else if (setting->Id() == Settings::values.shader_backend.Id()) {
286 // Keep track of shader_backend's combobox so we can populate it
280 hold_api.push_front(widget); 287 hold_api.push_front(widget);
281 shader_backend_combobox = widget->combobox; 288 shader_backend_combobox = widget->combobox;
282 shader_backend_widget = widget; 289 shader_backend_widget = widget;
283 } else if (setting->Id() == Settings::values.vsync_mode.Id()) { 290 } else if (setting->Id() == Settings::values.vsync_mode.Id()) {
291 // Keep track of vsync_mode's combobox so we can populate it
284 vsync_mode_combobox = widget->combobox; 292 vsync_mode_combobox = widget->combobox;
285 hold_graphics.emplace(setting->Id(), widget); 293 hold_graphics.emplace(setting->Id(), widget);
286 } else { 294 } else {
@@ -296,6 +304,8 @@ void ConfigureGraphics::Setup() {
296 api_grid_layout->addWidget(widget); 304 api_grid_layout->addWidget(widget);
297 } 305 }
298 306
307 // Background color is too specific to build into the new system, so we manage it here
308 // (3 settings, all collected into a single widget with a QColor to manage on top)
299 if (Settings::IsConfiguringGlobal()) { 309 if (Settings::IsConfiguringGlobal()) {
300 apply_funcs.push_front([this](bool powered_on) { 310 apply_funcs.push_front([this](bool powered_on) {
301 Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red())); 311 Settings::values.bg_red.SetValue(static_cast<u8>(bg_color.red()));
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp
index 8c932f10a..843af230b 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.cpp
+++ b/src/yuzu/configuration/configure_graphics_advanced.cpp
@@ -45,6 +45,7 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
45 45
46 hold.emplace(setting->Id(), widget); 46 hold.emplace(setting->Id(), widget);
47 47
48 // Keep track of enable_compute_pipelines so we can display it when needed
48 if (setting->Id() == Settings::values.enable_compute_pipelines.Id()) { 49 if (setting->Id() == Settings::values.enable_compute_pipelines.Id()) {
49 checkbox_enable_compute_pipelines = widget; 50 checkbox_enable_compute_pipelines = widget;
50 } 51 }
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 4b0e0a649..ffcbab6d9 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -126,11 +126,15 @@ void ConfigureSystem::Setup() {
126 [[maybe_unused]] std::string label = setting->GetLabel(); 126 [[maybe_unused]] std::string label = setting->GetLabel();
127 ConfigurationShared::Widget* widget = [=]() { 127 ConfigurationShared::Widget* widget = [=]() {
128 if (setting->Id() == Settings::values.custom_rtc.Id()) { 128 if (setting->Id() == Settings::values.custom_rtc.Id()) {
129 // custom_rtc needs a DateTimeEdit (default is LineEdit), and a checkbox to manage
130 // it and custom_rtc_enabled
129 return new ConfigurationShared::Widget( 131 return new ConfigurationShared::Widget(
130 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 132 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
131 ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f, 133 ConfigurationShared::RequestType::DateTimeEdit, true, 1.0f,
132 &Settings::values.custom_rtc_enabled); 134 &Settings::values.custom_rtc_enabled);
133 } else if (setting->Id() == Settings::values.rng_seed.Id()) { 135 } else if (setting->Id() == Settings::values.rng_seed.Id()) {
136 // rng_seed needs a HexEdit (default is LineEdit), and a checkbox to manage
137 // it and rng_seed_enabled
134 return new ConfigurationShared::Widget( 138 return new ConfigurationShared::Widget(
135 setting, translations, combobox_translations, this, runtime_lock, apply_funcs, 139 setting, translations, combobox_translations, this, runtime_lock, apply_funcs,
136 ConfigurationShared::RequestType::HexEdit, true, 1.0f, 140 ConfigurationShared::RequestType::HexEdit, true, 1.0f,
@@ -147,17 +151,20 @@ void ConfigureSystem::Setup() {
147 } 151 }
148 152
149 if (setting->Id() == Settings::values.rng_seed.Id()) { 153 if (setting->Id() == Settings::values.rng_seed.Id()) {
154 // Keep track of rng_seed's widgets to reset it with the checkbox state
150 rng_seed_checkbox = widget->checkbox; 155 rng_seed_checkbox = widget->checkbox;
151 rng_seed_edit = widget->line_edit; 156 rng_seed_edit = widget->line_edit;
152 157
153 rng_seed_edit->setEnabled(Settings::values.rng_seed_enabled.GetValue()); 158 rng_seed_edit->setEnabled(Settings::values.rng_seed_enabled.GetValue());
154 } else if (setting->Id() == Settings::values.custom_rtc.Id()) { 159 } else if (setting->Id() == Settings::values.custom_rtc.Id()) {
160 // Keep track of custom_rtc's widgets to reset it with the checkbox state
155 custom_rtc_checkbox = widget->checkbox; 161 custom_rtc_checkbox = widget->checkbox;
156 custom_rtc_edit = widget->date_time_edit; 162 custom_rtc_edit = widget->date_time_edit;
157 163
158 custom_rtc_edit->setEnabled(Settings::values.custom_rtc_enabled.GetValue()); 164 custom_rtc_edit->setEnabled(Settings::values.custom_rtc_enabled.GetValue());
159 } else if (setting->Id() == Settings::values.region_index.Id()) { 165 } else if (setting->Id() == Settings::values.region_index.Id()) {
160 166 // Keep track of the region_index (and langauge_index) combobox to validate the selected
167 // settings
161 combo_region = widget->combobox; 168 combo_region = widget->combobox;
162 } else if (setting->Id() == Settings::values.language_index.Id()) { 169 } else if (setting->Id() == Settings::values.language_index.Id()) {
163 combo_language = widget->combobox; 170 combo_language = widget->combobox;