forked from ShuriZma/suyu
1
0
Fork 0

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); &ConfigureProfileManager::ConfirmDeleteUser);
connect(ui->pm_set_image, &QPushButton::clicked, this, &ConfigureProfileManager::SetUserImage); 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; scene = new QGraphicsScene;
ui->current_user_icon->setScene(scene); ui->current_user_icon->setScene(scene);
@ -246,7 +246,7 @@ void ConfigureProfileManager::ConfirmDeleteUser() {
confirm_dialog->show(); 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()) { if (Settings::values.current_user.GetValue() == tree_view->currentIndex().row()) {
Settings::values.current_user = 0; Settings::values.current_user = 0;
} }
@ -324,7 +324,7 @@ void ConfigureProfileManager::SetUserImage() {
} }
ConfigureProfileManagerDeleteDialog::ConfigureProfileManagerDeleteDialog(QWidget* parent) ConfigureProfileManagerDeleteDialog::ConfigureProfileManagerDeleteDialog(QWidget* parent)
: QDialog(parent) { : QDialog{parent} {
auto dialog_vbox_layout = new QVBoxLayout(this); auto dialog_vbox_layout = new QVBoxLayout(this);
dialog_button_box = dialog_button_box =
new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No, Qt::Horizontal, parent); new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No, Qt::Horizontal, parent);
@ -354,7 +354,7 @@ ConfigureProfileManagerDeleteDialog::ConfigureProfileManagerDeleteDialog(QWidget
ConfigureProfileManagerDeleteDialog::~ConfigureProfileManagerDeleteDialog() = default; 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) { std::function<void()> accept_callback) {
label_info->setText( label_info->setText(
tr("Name: %1\nUUID: %2").arg(username, QString::fromStdString(uuid.FormattedString()))); tr("Name: %1\nUUID: %2").arg(username, QString::fromStdString(uuid.FormattedString())));

View File

@ -10,7 +10,9 @@
#include <QList> #include <QList>
#include <QWidget> #include <QWidget>
#include "common/uuid.h" namespace Common {
struct UUID;
}
namespace Core { namespace Core {
class System; class System;
@ -37,7 +39,7 @@ public:
explicit ConfigureProfileManagerDeleteDialog(QWidget* parent); explicit ConfigureProfileManagerDeleteDialog(QWidget* parent);
~ConfigureProfileManagerDeleteDialog(); ~ConfigureProfileManagerDeleteDialog();
void SetInfo(const QString username, const Common::UUID uuid, void SetInfo(const QString& username, const Common::UUID& uuid,
std::function<void()> accept_callback); std::function<void()> accept_callback);
private: private:
@ -68,7 +70,7 @@ private:
void AddUser(); void AddUser();
void RenameUser(); void RenameUser();
void ConfirmDeleteUser(); void ConfirmDeleteUser();
void DeleteUser(const Common::UUID uuid); void DeleteUser(const Common::UUID& uuid);
void SetUserImage(); void SetUserImage();
QVBoxLayout* layout; QVBoxLayout* layout;
@ -76,7 +78,7 @@ private:
QStandardItemModel* item_model; QStandardItemModel* item_model;
QGraphicsScene* scene; QGraphicsScene* scene;
std::unique_ptr<ConfigureProfileManagerDeleteDialog> confirm_dialog; ConfigureProfileManagerDeleteDialog* confirm_dialog;
std::vector<QList<QStandardItem*>> list_items; std::vector<QList<QStandardItem*>> list_items;