From 85ed10f31f0aae93a12bc7e79bb98b9b2aac20bb Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sat, 22 Jul 2023 00:42:15 -0400 Subject: [PATCH] configure_audio/cpu: Sort settings Was producing out of order settings as a result of the switch to vectors --- src/yuzu/configuration/configure_audio.cpp | 11 ++++++++++- src/yuzu/configuration/configure_cpu.cpp | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index d32328087..9ccfb2435 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -1,13 +1,16 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include #include #include "audio_core/sink/sink.h" #include "audio_core/sink/sink_details.h" +#include "common/common_types.h" #include "common/settings.h" +#include "common/settings_common.h" #include "core/core.h" #include "ui_configure_audio.h" #include "yuzu/configuration/configuration_shared.h" @@ -33,6 +36,8 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { std::vector settings; + std::map hold; + auto push = [&](Settings::Category category) { for (auto* setting : Settings::values.linkage.by_category[category]) { settings.push_back(setting); @@ -53,7 +58,7 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { continue; } - layout.addWidget(widget); + hold.emplace(std::pair{setting->Id(), widget}); if (setting->Id() == Settings::values.sink_id.Id()) { // TODO (lat9nq): Let the system manage sink_id @@ -70,6 +75,10 @@ void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { input_device_combo_box = widget->combobox; } } + + for (const auto& [id, widget] : hold) { + layout.addWidget(widget); + } } void ConfigureAudio::SetConfiguration() { diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 08f2b4d9c..a51359903 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp @@ -35,7 +35,7 @@ void ConfigureCpu::SetConfiguration() {} void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { auto* accuracy_layout = ui->widget_accuracy->layout(); auto* unsafe_layout = ui->unsafe_widget->layout(); - std::map unsafe_hold{}; + std::map unsafe_hold{}; std::vector settings; const auto push = [&](Settings::Category category) { @@ -64,7 +64,7 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { accuracy_combobox = widget->combobox; } else { // Presently, all other settings here are unsafe checkboxes - unsafe_hold.insert({setting->GetLabel(), widget}); + unsafe_hold.insert({setting->Id(), widget}); } }