From 17b9c1e1715a16bebcdd92c02ce7f7e503212462 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 21 Jul 2023 23:09:09 -0400 Subject: [PATCH] common,qt-config: Remove usage of forward_list --- src/common/settings.cpp | 1 - src/common/settings_common.h | 1 - .../configuration/configuration_shared.cpp | 5 +++-- src/yuzu/configuration/configuration_shared.h | 4 ++-- src/yuzu/configuration/configure_audio.cpp | 8 ++++---- src/yuzu/configuration/configure_audio.h | 6 +++--- src/yuzu/configuration/configure_cpu.cpp | 8 ++++---- src/yuzu/configuration/configure_cpu.h | 5 +++-- src/yuzu/configuration/configure_dialog.h | 3 +-- src/yuzu/configuration/configure_general.cpp | 8 ++++---- src/yuzu/configuration/configure_general.h | 5 +++-- src/yuzu/configuration/configure_graphics.cpp | 20 +++++++++---------- src/yuzu/configuration/configure_graphics.h | 4 ++-- .../configure_graphics_advanced.cpp | 4 ++-- .../configure_graphics_advanced.h | 6 +++--- src/yuzu/configuration/configure_per_game.cpp | 2 +- src/yuzu/configuration/configure_per_game.h | 3 +-- src/yuzu/configuration/configure_system.cpp | 12 +++++------ src/yuzu/configuration/configure_system.h | 6 +++--- src/yuzu/configuration/shared_widget.cpp | 8 ++++---- src/yuzu/configuration/shared_widget.h | 10 +++++----- 21 files changed, 64 insertions(+), 65 deletions(-) diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 0e2ccf857..4a4ba307c 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/src/common/settings_common.h b/src/common/settings_common.h index bfd1bad64..6f90ae90d 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 8c12d063e..0ed6146a0 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -3,13 +3,14 @@ #include #include +#include #include "yuzu/configuration/configuration_shared.h" namespace ConfigurationShared { -Tab::Tab(std::shared_ptr> group, QWidget* parent) : QWidget(parent) { +Tab::Tab(std::shared_ptr> group, QWidget* parent) : QWidget(parent) { if (group != nullptr) { - group->push_front(this); + group->push_back(this); } } diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 2a084b584..31897a6b0 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -3,8 +3,8 @@ #pragma once -#include #include +#include #include #include #include @@ -17,7 +17,7 @@ class Tab : public QWidget { Q_OBJECT public: - explicit Tab(std::shared_ptr> group, QWidget* parent = nullptr); + explicit Tab(std::shared_ptr> group, QWidget* parent = nullptr); ~Tab(); virtual void ApplyConfiguration() = 0; diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index 11714b86d..7eb752898 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -1,8 +1,8 @@ // 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" @@ -17,7 +17,7 @@ #include "yuzu/uisettings.h" ConfigureAudio::ConfigureAudio(const Core::System& system_, - std::shared_ptr> group_, + std::shared_ptr> group_, const ConfigurationShared::Builder& builder, QWidget* parent) : Tab(group_, parent), ui(std::make_unique()), system{system_} { ui->setupUi(this); @@ -31,11 +31,11 @@ ConfigureAudio::~ConfigureAudio() = default; void ConfigureAudio::Setup(const ConfigurationShared::Builder& builder) { auto& layout = *ui->audio_widget->layout(); - std::forward_list settings; + std::vector settings; auto push = [&](Settings::Category category) { for (auto* setting : Settings::values.linkage.by_category[category]) { - settings.push_front(setting); + settings.push_back(setting); } }; diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index 94606f210..79538e81c 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h @@ -3,9 +3,9 @@ #pragma once -#include #include #include +#include #include #include "yuzu/configuration/configuration_shared.h" @@ -26,7 +26,7 @@ class Builder; class ConfigureAudio : public ConfigurationShared::Tab { public: explicit ConfigureAudio(const Core::System& system_, - std::shared_ptr> group, + std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureAudio() override; @@ -51,7 +51,7 @@ private: const Core::System& system; - std::forward_list> apply_funcs{}; + std::vector> apply_funcs{}; QComboBox* sink_combo_box; QComboBox* output_device_combo_box; diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 7d122906e..8ed9a65f3 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp @@ -1,9 +1,9 @@ // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include #include #include +#include #include #include "common/common_types.h" #include "common/settings.h" @@ -15,7 +15,7 @@ #include "yuzu/configuration/configure_cpu.h" ConfigureCpu::ConfigureCpu(const Core::System& system_, - std::shared_ptr> group_, + std::shared_ptr> group_, const ConfigurationShared::Builder& builder, QWidget* parent) : Tab(group_, parent), ui{std::make_unique()}, system{system_}, combobox_translations(builder.ComboboxTranslations()) { @@ -37,10 +37,10 @@ void ConfigureCpu::Setup(const ConfigurationShared::Builder& builder) { auto* unsafe_layout = ui->unsafe_widget->layout(); std::map unsafe_hold{}; - std::forward_list settings; + std::vector settings; const auto push = [&](Settings::Category category) { for (const auto setting : Settings::values.linkage.by_category[category]) { - settings.push_front(setting); + settings.push_back(setting); } }; diff --git a/src/yuzu/configuration/configure_cpu.h b/src/yuzu/configuration/configure_cpu.h index ab19c0ba1..61a6de7aa 100644 --- a/src/yuzu/configuration/configure_cpu.h +++ b/src/yuzu/configuration/configure_cpu.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/shared_translation.h" @@ -25,7 +26,7 @@ class Builder; class ConfigureCpu : public ConfigurationShared::Tab { public: explicit ConfigureCpu(const Core::System& system_, - std::shared_ptr> group, + std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureCpu() override; @@ -45,7 +46,7 @@ private: const Core::System& system; const ConfigurationShared::ComboboxTranslationMap& combobox_translations; - std::forward_list> apply_funcs{}; + std::vector> apply_funcs{}; QComboBox* accuracy_combobox; }; diff --git a/src/yuzu/configuration/configure_dialog.h b/src/yuzu/configuration/configure_dialog.h index 1bfc9f9d0..96e9a8c3e 100644 --- a/src/yuzu/configuration/configure_dialog.h +++ b/src/yuzu/configuration/configure_dialog.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include @@ -74,7 +73,7 @@ private: Core::System& system; std::unique_ptr builder; - std::forward_list tab_group; + std::vector tab_group; std::unique_ptr audio_tab; std::unique_ptr cpu_tab; diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 54113543a..fc43a531d 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include "common/settings.h" #include "core/core.h" @@ -12,10 +13,9 @@ #include "yuzu/configuration/shared_widget.h" #include "yuzu/uisettings.h" -ConfigureGeneral::ConfigureGeneral( - const Core::System& system_, - std::shared_ptr> group_, - const ConfigurationShared::Builder& builder, QWidget* parent) +ConfigureGeneral::ConfigureGeneral(const Core::System& system_, + std::shared_ptr> group_, + const ConfigurationShared::Builder& builder, QWidget* parent) : Tab(group_, parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index f8ed3f8ab..2d953f679 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -5,6 +5,7 @@ #include #include +#include #include #include "yuzu/configuration/configuration_shared.h" @@ -26,7 +27,7 @@ class Builder; class ConfigureGeneral : public ConfigurationShared::Tab { public: explicit ConfigureGeneral(const Core::System& system_, - std::shared_ptr> group, + std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureGeneral() override; @@ -46,7 +47,7 @@ private: std::unique_ptr ui; - std::forward_list> apply_funcs{}; + std::vector> apply_funcs{}; const Core::System& system; }; diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 31e87ccf5..a6f711597 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -77,11 +77,11 @@ static constexpr Settings::VSyncMode PresentModeToSetting(VkPresentModeKHR mode) } } -ConfigureGraphics::ConfigureGraphics( - const Core::System& system_, std::vector& records_, - const std::function& expose_compute_option_, - std::shared_ptr> group_, - const ConfigurationShared::Builder& builder, QWidget* parent) +ConfigureGraphics::ConfigureGraphics(const Core::System& system_, + std::vector& records_, + const std::function& expose_compute_option_, + std::shared_ptr> group_, + const ConfigurationShared::Builder& builder, QWidget* parent) : ConfigurationShared::Tab(group_, parent), ui{std::make_unique()}, records{records_}, expose_compute_option{expose_compute_option_}, system{system_}, combobox_translations{builder.ComboboxTranslations()}, @@ -228,7 +228,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { QLayout& graphics_layout = *ui->graphics_widget->layout(); std::map hold_graphics; - std::forward_list hold_api; + std::vector hold_api; for (const auto setting : Settings::values.linkage.by_category[Settings::Category::Renderer]) { ConfigurationShared::Widget* widget = [&]() { @@ -268,12 +268,12 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { } } else if (setting->Id() == Settings::values.vulkan_device.Id()) { // Keep track of vulkan_device's combobox so we can populate it - hold_api.push_front(widget); + hold_api.push_back(widget); vulkan_device_combobox = widget->combobox; vulkan_device_widget = widget; } else if (setting->Id() == Settings::values.shader_backend.Id()) { // Keep track of shader_backend's combobox so we can populate it - hold_api.push_front(widget); + hold_api.push_back(widget); shader_backend_combobox = widget->combobox; shader_backend_widget = widget; } else if (setting->Id() == Settings::values.vsync_mode.Id()) { @@ -296,7 +296,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { // Background color is too specific to build into the new system, so we manage it here // (3 settings, all collected into a single widget with a QColor to manage on top) if (Settings::IsConfiguringGlobal()) { - apply_funcs.push_front([this](bool powered_on) { + apply_funcs.push_back([this](bool powered_on) { Settings::values.bg_red.SetValue(static_cast(bg_color.red())); Settings::values.bg_green.SetValue(static_cast(bg_color.green())); Settings::values.bg_blue.SetValue(static_cast(bg_color.blue())); @@ -322,7 +322,7 @@ void ConfigureGraphics::Setup(const ConfigurationShared::Builder& builder) { bg_restore_button->setEnabled(true); }); - apply_funcs.push_front([bg_restore_button, this](bool powered_on) { + apply_funcs.push_back([bg_restore_button, this](bool powered_on) { const bool using_global = !bg_restore_button->isEnabled(); Settings::values.bg_red.SetGlobal(using_global); Settings::values.bg_green.SetGlobal(using_global); diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 633a28414..02d9b00f1 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -46,7 +46,7 @@ public: explicit ConfigureGraphics(const Core::System& system_, std::vector& records, const std::function& expose_compute_option_, - std::shared_ptr> group, + std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureGraphics() override; @@ -80,7 +80,7 @@ private: std::unique_ptr ui; QColor bg_color; - std::forward_list> apply_funcs{}; + std::vector> apply_funcs{}; std::vector& records; std::vector vulkan_devices; diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 757e4659d..f60214ff9 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -1,6 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include #include #include "common/settings.h" @@ -12,8 +13,7 @@ #include "yuzu/configuration/shared_widget.h" ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced( - const Core::System& system_, - std::shared_ptr> group_, + const Core::System& system_, std::shared_ptr> group_, const ConfigurationShared::Builder& builder, QWidget* parent) : Tab(group_, parent), ui{std::make_unique()}, system{system_} { diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index 5530827d1..78b5389c3 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h @@ -4,6 +4,7 @@ #pragma once #include +#include #include #include "yuzu/configuration/configuration_shared.h" @@ -22,8 +23,7 @@ class Builder; class ConfigureGraphicsAdvanced : public ConfigurationShared::Tab { public: explicit ConfigureGraphicsAdvanced( - const Core::System& system_, - std::shared_ptr> group, + const Core::System& system_, std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureGraphicsAdvanced() override; @@ -41,7 +41,7 @@ private: const Core::System& system; - std::forward_list> apply_funcs; + std::vector> apply_funcs; QWidget* checkbox_enable_compute_pipelines{}; }; diff --git a/src/yuzu/configuration/configure_per_game.cpp b/src/yuzu/configuration/configure_per_game.cpp index cee8e726d..cd8b3012e 100644 --- a/src/yuzu/configuration/configure_per_game.cpp +++ b/src/yuzu/configuration/configure_per_game.cpp @@ -44,7 +44,7 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const std::st : QDialog(parent), ui(std::make_unique()), title_id{title_id_}, system{system_}, builder{std::make_unique(this, !system_.IsPoweredOn())}, - tab_group{std::make_shared>()} { + tab_group{std::make_shared>()} { const auto file_path = std::filesystem::path(Common::FS::ToU8String(file_name)); const auto config_file_name = title_id == 0 ? Common::FS::PathToUTF8String(file_path.filename()) : fmt::format("{:016X}", title_id); diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index 4ddd18c1f..1a727f32c 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include @@ -77,7 +76,7 @@ private: Core::System& system; std::unique_ptr builder; - std::shared_ptr> tab_group; + std::shared_ptr> tab_group; std::unique_ptr addons_tab; std::unique_ptr audio_tab; diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 7884886c3..93a0a4102 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include -#include #include +#include #include #include @@ -44,9 +44,9 @@ static bool IsValidLocale(u32 region_index, u32 language_index) { return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; } -ConfigureSystem::ConfigureSystem( - Core::System& system_, std::shared_ptr> group_, - const ConfigurationShared::Builder& builder, QWidget* parent) +ConfigureSystem::ConfigureSystem(Core::System& system_, + std::shared_ptr> group_, + const ConfigurationShared::Builder& builder, QWidget* parent) : Tab(group_, parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); @@ -95,10 +95,10 @@ void ConfigureSystem::Setup(const ConfigurationShared::Builder& builder) { std::map core_hold{}; std::map system_hold{}; - std::forward_list settings; + std::vector settings; auto push = [&settings](auto& list) { for (auto setting : list) { - settings.push_front(setting); + settings.push_back(setting); } }; diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index f63aedda0..eab99a48a 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -3,9 +3,9 @@ #pragma once -#include #include #include +#include #include #include "yuzu/configuration/configuration_shared.h" @@ -29,7 +29,7 @@ class Builder; class ConfigureSystem : public ConfigurationShared::Tab { public: explicit ConfigureSystem(Core::System& system_, - std::shared_ptr> group, + std::shared_ptr> group, const ConfigurationShared::Builder& builder, QWidget* parent = nullptr); ~ConfigureSystem() override; @@ -43,7 +43,7 @@ private: void Setup(const ConfigurationShared::Builder& builder); - std::forward_list> apply_funcs{}; + std::vector> apply_funcs{}; std::unique_ptr ui; bool enabled = false; diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index c9ab461f6..cf33bce2b 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp @@ -547,7 +547,7 @@ Widget::~Widget() = default; Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translations_, const ComboboxTranslationMap& combobox_translations_, QWidget* parent_, - bool runtime_lock_, std::forward_list>& apply_funcs_, + bool runtime_lock_, std::vector>& apply_funcs_, RequestType request, bool managed, float multiplier, Settings::BasicSetting* other_setting, const QString& suffix) : QWidget(parent_), parent{parent_}, translations{translations_}, @@ -584,7 +584,7 @@ Widget::Widget(Settings::BasicSetting* setting_, const TranslationMap& translati return; } - apply_funcs.push_front([load_func, setting_](bool powered_on) { + apply_funcs.push_back([load_func, setting_](bool powered_on) { if (setting_->RuntimeModfiable() || !powered_on) { load_func(); } @@ -607,7 +607,7 @@ Builder::Builder(QWidget* parent_, bool runtime_lock_) Builder::~Builder() = default; Widget* Builder::BuildWidget(Settings::BasicSetting* setting, - std::forward_list>& apply_funcs, + std::vector>& apply_funcs, RequestType request, bool managed, float multiplier, Settings::BasicSetting* other_setting, const QString& suffix) const { if (!Settings::IsConfiguringGlobal() && !setting->Switchable()) { @@ -624,7 +624,7 @@ Widget* Builder::BuildWidget(Settings::BasicSetting* setting, } Widget* Builder::BuildWidget(Settings::BasicSetting* setting, - std::forward_list>& apply_funcs, + std::vector>& apply_funcs, Settings::BasicSetting* other_setting, RequestType request, const QString& suffix) const { return BuildWidget(setting, apply_funcs, request, true, 1.0f, other_setting, suffix); diff --git a/src/yuzu/configuration/shared_widget.h b/src/yuzu/configuration/shared_widget.h index b3f9efd78..e64693bab 100644 --- a/src/yuzu/configuration/shared_widget.h +++ b/src/yuzu/configuration/shared_widget.h @@ -3,10 +3,10 @@ #pragma once -#include #include #include #include +#include #include #include #include @@ -62,7 +62,7 @@ public: */ explicit Widget(Settings::BasicSetting* setting, const TranslationMap& translations, const ComboboxTranslationMap& combobox_translations, QWidget* parent, - bool runtime_lock, std::forward_list>& apply_funcs_, + bool runtime_lock, std::vector>& apply_funcs_, RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, const QString& suffix = QStringLiteral("")); @@ -125,7 +125,7 @@ private: const TranslationMap& translations; const ComboboxTranslationMap& combobox_enumerations; Settings::BasicSetting& setting; - std::forward_list>& apply_funcs; + std::vector>& apply_funcs; bool created{false}; bool runtime_lock{false}; @@ -137,13 +137,13 @@ public: ~Builder(); Widget* BuildWidget(Settings::BasicSetting* setting, - std::forward_list>& apply_funcs, + std::vector>& apply_funcs, RequestType request = RequestType::Default, bool managed = true, float multiplier = 1.0f, Settings::BasicSetting* other_setting = nullptr, const QString& suffix = QStringLiteral("")) const; Widget* BuildWidget(Settings::BasicSetting* setting, - std::forward_list>& apply_funcs, + std::vector>& apply_funcs, Settings::BasicSetting* other_setting, RequestType request = RequestType::Default, const QString& suffix = QStringLiteral("")) const;