mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 20:27:45 +00:00
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.
45 lines
No EOL
992 B
C++
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;
|
|
}; |