1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00
astra/launcher/include/profilemanager.h
Joshua Goins 16420b7421 Complete rewrite to Kirigami
Giant commit overhauling the interface to use KDE's Kirigami framework,
which is based on Qt Quick. The logic is all but rewritten, allowing
accounts to be separate from profiles.
2023-07-30 08:49:34 -04:00

45 lines
No EOL
992 B
C++

#pragma once
#include <QAbstractListModel>
#include "profile.h"
class ProfileManager : public QAbstractListModel
{
Q_OBJECT
public:
explicit ProfileManager(LauncherCore &launcher, QObject *parent = nullptr);
void load();
enum CustomRoles {
ProfileRole = Qt::UserRole,
};
int rowCount(const QModelIndex &index = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE Profile *getProfile(int index);
int getProfileIndex(const QString &name);
Q_INVOKABLE Profile *addProfile();
Q_INVOKABLE void deleteProfile(Profile *profile);
QVector<Profile *> profiles() const;
Q_INVOKABLE bool canDelete(Profile *account) const;
private:
void insertProfile(Profile *profile);
QString getDefaultGamePath();
QString getDefaultWinePrefixPath();
QVector<Profile *> m_profiles;
LauncherCore &m_launcher;
};