configure_profile_manager: Use a custom dialog for deletion

A hopefully more informative dialog that most importantly notifies the
user that their saves will be deleted with the user profile.

cpm: Only keep track of UI elements that we need

cpm: Remove unused forward declarations

cpm: Add missing include
This commit is contained in:
lat9nq
2022-11-15 17:57:01 -05:00
parent 9e27624a19
commit ef5184cf1c
2 changed files with 81 additions and 11 deletions

View File

@ -3,16 +3,22 @@
#pragma once
#include <functional>
#include <memory>
#include <QDialog>
#include <QList>
#include <QWidget>
#include "common/uuid.h"
namespace Core {
class System;
}
class QGraphicsScene;
class QDialogButtonBox;
class QLabel;
class QStandardItem;
class QStandardItemModel;
class QTreeView;
@ -26,6 +32,20 @@ namespace Ui {
class ConfigureProfileManager;
}
class ConfigureProfileManagerDeleteDialog : public QDialog {
public:
explicit ConfigureProfileManagerDeleteDialog(QWidget* parent);
~ConfigureProfileManagerDeleteDialog();
void SetInfo(const QString username, const Common::UUID uuid,
std::function<void()> accept_callback);
private:
QDialogButtonBox* dialog_button_box;
QGraphicsScene* icon_scene;
QLabel* label_info;
};
class ConfigureProfileManager : public QWidget {
Q_OBJECT
@ -47,7 +67,8 @@ private:
void SelectUser(const QModelIndex& index);
void AddUser();
void RenameUser();
void DeleteUser();
void ConfirmDeleteUser();
void DeleteUser(const Common::UUID uuid);
void SetUserImage();
QVBoxLayout* layout;
@ -55,6 +76,8 @@ private:
QStandardItemModel* item_model;
QGraphicsScene* scene;
std::unique_ptr<ConfigureProfileManagerDeleteDialog> confirm_dialog;
std::vector<QList<QStandardItem*>> list_items;
std::unique_ptr<Ui::ConfigureProfileManager> ui;