// SPDX-FileCopyrightText: 2023 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include #include #include "profile.h" class ProfileManager : public QAbstractListModel { Q_OBJECT QML_ELEMENT QML_UNCREATABLE("Use LauncherCore.profileManager") public: explicit ProfileManager(LauncherCore &launcher, QObject *parent = nullptr); void load(); enum CustomRoles { ProfileRole = Qt::UserRole, }; [[nodiscard]] int rowCount(const QModelIndex &index) const override; [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override; [[nodiscard]] QHash roleNames() const override; Q_INVOKABLE Profile *getProfile(int index); int getProfileIndex(const QString &name); Q_INVOKABLE Profile *addProfile(); Q_INVOKABLE void deleteProfile(Profile *profile); [[nodiscard]] QVector profiles() const; Q_INVOKABLE bool canDelete(Profile *account) const; static QString getDefaultGamePath(const QString &uuid); private: void insertProfile(Profile *profile); QString getDefaultWinePrefixPath(); QVector m_profiles; LauncherCore &m_launcher; };