Files
eden/src/yuzu/configuration/system/new_user_dialog.h
T
crueter b2b98ac83a [desktop] refactor profile management and fix some misc bugs with it (#3415)
Adding and editing users is now done in a single dialog rather than all those other individual buttons and dialogs like before.

Fixed some bugs with profile management too, and made edit/delete a right-click menu.

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3415
2026-01-29 17:17:28 +01:00

72 lines
1.7 KiB
C++

// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QDialog>
#include "common/uuid.h"
#include "core/file_sys/vfs/vfs_types.h"
class QGraphicsScene;
class ProfileAvatarDialog;
namespace Ui {
class NewUserDialog;
}
struct User {
QString username;
Common::UUID uuid;
QPixmap pixmap;
};
class NewUserDialog : public QDialog
{
Q_OBJECT
Q_PROPERTY(bool isDefaultAvatar READ isDefaultAvatar WRITE setIsDefaultAvatar NOTIFY
isDefaultAvatarChanged FINAL)
public:
explicit NewUserDialog(QWidget *parent = nullptr);
explicit NewUserDialog(Common::UUID uuid, const std::string &username, const QString &title, QWidget *parent = nullptr);
~NewUserDialog();
bool isDefaultAvatar() const;
void setIsDefaultAvatar(bool newIsDefaultAvatar);
static QString GetImagePath(const Common::UUID& uuid);
static QPixmap GetIcon(const Common::UUID& uuid);
static QPixmap DefaultAvatar();
private:
Ui::NewUserDialog *ui;
QGraphicsScene *m_scene;
QPixmap m_pixmap;
ProfileAvatarDialog* avatar_dialog;
bool m_isDefaultAvatar = true;
bool m_editing = false;
void setup(Common::UUID uuid, const std::string &username, const QString &title);
bool LoadAvatarData();
std::vector<uint8_t> DecompressYaz0(const FileSys::VirtualFile& file);
public slots:
void setImage(const QPixmap &pixmap);
void selectImage();
void setAvatar();
void revertImage();
void updateRevertButton();
void generateUUID();
void verifyUser();
void dispatchUser();
signals:
void isDefaultAvatarChanged(bool isDefaultAvatar);
void userAdded(User user);
};