From ab441fb0093d64d7e652b88b8db27262cae98562 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Fri, 15 Oct 2021 15:26:20 -0400 Subject: [PATCH] configuration: Use std::make_unique instead of operator new for ui --- src/yuzu/about_dialog.cpp | 3 ++- src/yuzu/configuration/configure_cpu.cpp | 2 +- src/yuzu/configuration/configure_cpu_debug.cpp | 2 +- src/yuzu/configuration/configure_debug.cpp | 2 +- src/yuzu/configuration/configure_debug_tab.cpp | 4 ++-- src/yuzu/configuration/configure_dialog.cpp | 2 +- src/yuzu/configuration/configure_general.cpp | 2 +- src/yuzu/configuration/configure_graphics.cpp | 2 +- src/yuzu/configuration/configure_graphics_advanced.cpp | 2 +- src/yuzu/configuration/configure_per_game_addons.cpp | 2 +- src/yuzu/configuration/configure_profile_manager.cpp | 2 +- src/yuzu/configuration/configure_system.cpp | 2 +- src/yuzu/configuration/configure_ui.cpp | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index 6b0155a788..04ab4ae21c 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -8,7 +8,8 @@ #include "ui_aboutdialog.h" #include "yuzu/about_dialog.h" -AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) { +AboutDialog::AboutDialog(QWidget* parent) + : QDialog(parent), ui{std::make_unique()} { const auto branch_name = std::string(Common::g_scm_branch); const auto description = std::string(Common::g_scm_desc); const auto build_id = std::string(Common::g_build_id); diff --git a/src/yuzu/configuration/configure_cpu.cpp b/src/yuzu/configuration/configure_cpu.cpp index 27fabef386..f66cab5d45 100644 --- a/src/yuzu/configuration/configure_cpu.cpp +++ b/src/yuzu/configuration/configure_cpu.cpp @@ -14,7 +14,7 @@ #include "yuzu/configuration/configure_cpu.h" ConfigureCpu::ConfigureCpu(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureCpu), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); SetupPerGameUI(); diff --git a/src/yuzu/configuration/configure_cpu_debug.cpp b/src/yuzu/configuration/configure_cpu_debug.cpp index 6e910e33e2..05a90963df 100644 --- a/src/yuzu/configuration/configure_cpu_debug.cpp +++ b/src/yuzu/configuration/configure_cpu_debug.cpp @@ -12,7 +12,7 @@ #include "yuzu/configuration/configure_cpu_debug.h" ConfigureCpuDebug::ConfigureCpuDebug(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureCpuDebug), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); SetConfiguration(); diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp index 40447093eb..07bfa03603 100644 --- a/src/yuzu/configuration/configure_debug.cpp +++ b/src/yuzu/configuration/configure_debug.cpp @@ -15,7 +15,7 @@ #include "yuzu/uisettings.h" ConfigureDebug::ConfigureDebug(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureDebug), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); SetConfiguration(); diff --git a/src/yuzu/configuration/configure_debug_tab.cpp b/src/yuzu/configuration/configure_debug_tab.cpp index e126eeea98..e69cca1ef1 100644 --- a/src/yuzu/configuration/configure_debug_tab.cpp +++ b/src/yuzu/configuration/configure_debug_tab.cpp @@ -9,8 +9,8 @@ #include "yuzu/configuration/configure_debug_tab.h" ConfigureDebugTab::ConfigureDebugTab(const Core::System& system_, QWidget* parent) - : QWidget(parent), - ui(new Ui::ConfigureDebugTab), debug_tab{std::make_unique(system_, this)}, + : QWidget(parent), ui{std::make_unique()}, + debug_tab{std::make_unique(system_, this)}, cpu_debug_tab{std::make_unique(system_, this)} { ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 759625ef7e..4fa0c4a43b 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -36,7 +36,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, InputCommon::InputSubsystem* input_subsystem, Core::System& system_) - : QDialog(parent), ui(new Ui::ConfigureDialog), + : QDialog(parent), ui{std::make_unique()}, registry(registry), system{system_}, audio_tab{std::make_unique(system_, this)}, cpu_tab{std::make_unique(system_, this)}, diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index e562e89e56..7af3ea97e7 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -16,7 +16,7 @@ #include "yuzu/uisettings.h" ConfigureGeneral::ConfigureGeneral(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureGeneral), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); SetupPerGameUI(); diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index be4e7997bd..8e20cc6f30 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -20,7 +20,7 @@ #include "yuzu/configuration/configure_graphics.h" ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureGraphics), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { vulkan_device = Settings::values.vulkan_device.GetValue(); RetrieveVulkanDevices(); diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index 4407e65d3f..30c5a3595b 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -9,7 +9,7 @@ #include "yuzu/configuration/configure_graphics_advanced.h" ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureGraphicsAdvanced), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_per_game_addons.cpp b/src/yuzu/configuration/configure_per_game_addons.cpp index c8de8e2ff2..65e615963d 100644 --- a/src/yuzu/configuration/configure_per_game_addons.cpp +++ b/src/yuzu/configuration/configure_per_game_addons.cpp @@ -27,7 +27,7 @@ #include "yuzu/util/util.h" ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigurePerGameAddons), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); layout = new QVBoxLayout; diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index 9feec37ff5..99d5f4686d 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -77,7 +77,7 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t } // Anonymous namespace ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureProfileManager), + : QWidget(parent), ui{std::make_unique()}, profile_manager(std::make_unique()), system{system_} { ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 33eb059a3b..eea45f8eaa 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -18,7 +18,7 @@ #include "yuzu/configuration/configure_system.h" ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureSystem), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); connect(ui->button_regenerate_console_id, &QPushButton::clicked, this, &ConfigureSystem::RefreshConsoleID); diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index d01895bf2c..46e5409dba 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -55,7 +55,7 @@ QString GetTranslatedRowTextName(size_t index) { } // Anonymous namespace ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureUi), system{system_} { + : QWidget(parent), ui{std::make_unique()}, system{system_} { ui->setupUi(this); InitializeLanguageComboBox();