From e94bcf03cb20d65b6bda65fccb3f259783c8ff86 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:25:09 -0500 Subject: [PATCH] configure_profile_manager: Cleanup reference/pointer usage Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com> Co-authored-by: Mai M. --- src/yuzu/configuration/configure_profile_manager.cpp | 8 ++++---- src/yuzu/configuration/configure_profile_manager.h | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index 9493cb82e5..a470899889 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -115,7 +115,7 @@ ConfigureProfileManager::ConfigureProfileManager(const Core::System& system_, QW &ConfigureProfileManager::ConfirmDeleteUser); connect(ui->pm_set_image, &QPushButton::clicked, this, &ConfigureProfileManager::SetUserImage); - confirm_dialog = std::make_unique(this); + confirm_dialog = new ConfigureProfileManagerDeleteDialog(this); scene = new QGraphicsScene; ui->current_user_icon->setScene(scene); @@ -246,7 +246,7 @@ void ConfigureProfileManager::ConfirmDeleteUser() { confirm_dialog->show(); } -void ConfigureProfileManager::DeleteUser(const Common::UUID uuid) { +void ConfigureProfileManager::DeleteUser(const Common::UUID& uuid) { if (Settings::values.current_user.GetValue() == tree_view->currentIndex().row()) { Settings::values.current_user = 0; } @@ -324,7 +324,7 @@ void ConfigureProfileManager::SetUserImage() { } ConfigureProfileManagerDeleteDialog::ConfigureProfileManagerDeleteDialog(QWidget* parent) - : QDialog(parent) { + : QDialog{parent} { auto dialog_vbox_layout = new QVBoxLayout(this); dialog_button_box = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No, Qt::Horizontal, parent); @@ -354,7 +354,7 @@ ConfigureProfileManagerDeleteDialog::ConfigureProfileManagerDeleteDialog(QWidget ConfigureProfileManagerDeleteDialog::~ConfigureProfileManagerDeleteDialog() = default; -void ConfigureProfileManagerDeleteDialog::SetInfo(const QString username, const Common::UUID uuid, +void ConfigureProfileManagerDeleteDialog::SetInfo(const QString& username, const Common::UUID& uuid, std::function accept_callback) { label_info->setText( tr("Name: %1\nUUID: %2").arg(username, QString::fromStdString(uuid.FormattedString()))); diff --git a/src/yuzu/configuration/configure_profile_manager.h b/src/yuzu/configuration/configure_profile_manager.h index 6e5cb748d4..c4b1a334eb 100644 --- a/src/yuzu/configuration/configure_profile_manager.h +++ b/src/yuzu/configuration/configure_profile_manager.h @@ -10,7 +10,9 @@ #include #include -#include "common/uuid.h" +namespace Common { +struct UUID; +} namespace Core { class System; @@ -37,7 +39,7 @@ public: explicit ConfigureProfileManagerDeleteDialog(QWidget* parent); ~ConfigureProfileManagerDeleteDialog(); - void SetInfo(const QString username, const Common::UUID uuid, + void SetInfo(const QString& username, const Common::UUID& uuid, std::function accept_callback); private: @@ -68,7 +70,7 @@ private: void AddUser(); void RenameUser(); void ConfirmDeleteUser(); - void DeleteUser(const Common::UUID uuid); + void DeleteUser(const Common::UUID& uuid); void SetUserImage(); QVBoxLayout* layout; @@ -76,7 +78,7 @@ private: QStandardItemModel* item_model; QGraphicsScene* scene; - std::unique_ptr confirm_dialog; + ConfigureProfileManagerDeleteDialog* confirm_dialog; std::vector> list_items;