configure_profile_manager: Cleanup reference/pointer usage

Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: Mai M. <mathew1800@gmail.com>
This commit is contained in:
lat9nq 2022-11-15 19:25:09 -05:00
parent 8ca02794c5
commit e94bcf03cb
2 changed files with 10 additions and 8 deletions

View file

@ -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<ConfigureProfileManagerDeleteDialog>(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<void()> accept_callback) {
label_info->setText(
tr("Name: %1\nUUID: %2").arg(username, QString::fromStdString(uuid.FormattedString())));

View file

@ -10,7 +10,9 @@
#include <QList>
#include <QWidget>
#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<void()> 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<ConfigureProfileManagerDeleteDialog> confirm_dialog;
ConfigureProfileManagerDeleteDialog* confirm_dialog;
std::vector<QList<QStandardItem*>> list_items;