2023-08-05 22:14:05 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
#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;
|
|
|
|
|
2023-08-18 14:52:06 -04:00
|
|
|
static QString getDefaultGamePath(const QString &uuid);
|
2023-08-18 12:59:07 -04:00
|
|
|
|
2023-07-30 08:49:34 -04:00
|
|
|
private:
|
|
|
|
void insertProfile(Profile *profile);
|
|
|
|
|
|
|
|
QString getDefaultWinePrefixPath();
|
|
|
|
|
|
|
|
QVector<Profile *> m_profiles;
|
|
|
|
|
|
|
|
LauncherCore &m_launcher;
|
|
|
|
};
|