1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00
astra/launcher/include/profile.h

199 lines
7.2 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <QObject>
#include <QtLogging>
2023-09-16 18:01:02 -04:00
#include <QtQml/qqmlregistration.h>
#include <physis.hpp>
class Account;
class ProfileConfig;
class LauncherCore;
class Profile : public QObject
{
Q_OBJECT
2023-09-16 18:01:02 -04:00
QML_ELEMENT
QML_UNCREATABLE("Use from ProfileManager")
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QString gamePath READ gamePath WRITE setGamePath NOTIFY gamePathChanged)
Q_PROPERTY(QString winePath READ winePath WRITE setWinePath NOTIFY winePathChanged)
Q_PROPERTY(QString winePrefixPath READ winePrefixPath WRITE setWinePrefixPath NOTIFY winePrefixPathChanged)
Q_PROPERTY(WineType wineType READ wineType WRITE setWineType NOTIFY wineTypeChanged)
Q_PROPERTY(bool gamescopeEnabled READ gamescopeEnabled WRITE setGamescopeEnabled NOTIFY useGamescopeChanged)
Q_PROPERTY(bool gamemodeEnabled READ gamemodeEnabled WRITE setGamemodeEnabled NOTIFY useGamemodeChanged)
Q_PROPERTY(bool directx9Enabled READ directx9Enabled WRITE setDirectX9Enabled NOTIFY useDX9Changed)
2024-03-23 12:51:48 -04:00
Q_PROPERTY(bool hasDirectx9 READ hasDirectx9 NOTIFY gamePathChanged)
Q_PROPERTY(bool gamescopeFullscreen READ gamescopeFullscreen WRITE setGamescopeFullscreen NOTIFY gamescopeFullscreenChanged)
Q_PROPERTY(bool gamescopeBorderless READ gamescopeBorderless WRITE setGamescopeBorderless NOTIFY gamescopeBorderlessChanged)
Q_PROPERTY(int gamescopeWidth READ gamescopeWidth WRITE setGamescopeWidth NOTIFY gamescopeWidthChanged)
Q_PROPERTY(int gamescopeHeight READ gamescopeHeight WRITE setGamescopeHeight NOTIFY gamescopeHeightChanged)
Q_PROPERTY(int gamescopeRefreshRate READ gamescopeRefreshRate WRITE setGamescopeRefreshRate NOTIFY gamescopeRefreshRateChanged)
Q_PROPERTY(bool dalamudEnabled READ dalamudEnabled WRITE setDalamudEnabled NOTIFY dalamudEnabledChanged)
Q_PROPERTY(DalamudInjectMethod dalamudInjectMethod READ dalamudInjectMethod WRITE setDalamudInjectMethod NOTIFY dalamudInjectMethodChanged)
Q_PROPERTY(int dalamudInjectDelay READ dalamudInjectDelay WRITE setDalamudInjectDelay NOTIFY dalamudInjectDelayChanged)
Q_PROPERTY(DalamudChannel dalamudChannel READ dalamudChannel WRITE setDalamudChannel NOTIFY dalamudChannelChanged)
Q_PROPERTY(bool isGameInstalled READ isGameInstalled NOTIFY gameInstallChanged)
Q_PROPERTY(Account *account READ account WRITE setAccount NOTIFY accountChanged)
Q_PROPERTY(QString expansionVersionText READ expansionVersionText NOTIFY gameInstallChanged)
Q_PROPERTY(QString dalamudVersionText READ dalamudVersionText NOTIFY gameInstallChanged)
Q_PROPERTY(QString wineVersionText READ wineVersionText NOTIFY wineChanged)
Q_PROPERTY(bool loggedIn READ loggedIn NOTIFY loggedInChanged)
public:
explicit Profile(LauncherCore &launcher, const QString &key, QObject *parent = nullptr);
enum class WineType { BuiltIn, Custom };
Q_ENUM(WineType)
enum class DalamudChannel { Stable, Staging };
Q_ENUM(DalamudChannel)
enum class DalamudInjectMethod { Entrypoint, DLLInject };
Q_ENUM(DalamudInjectMethod)
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString uuid() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString name() const;
void setName(const QString &name);
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString gamePath() const;
void setGamePath(const QString &path);
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString winePath() const;
void setWinePath(const QString &path);
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString winePrefixPath() const;
void setWinePrefixPath(const QString &path);
2023-09-17 08:51:26 -04:00
[[nodiscard]] WineType wineType() const;
void setWineType(WineType type);
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool gamescopeEnabled() const;
void setGamescopeEnabled(bool value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool gamemodeEnabled() const;
void setGamemodeEnabled(bool value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool directx9Enabled() const;
void setDirectX9Enabled(bool value);
2024-03-23 12:51:48 -04:00
[[nodiscard]] bool hasDirectx9() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool gamescopeFullscreen() const;
void setGamescopeFullscreen(bool value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool gamescopeBorderless() const;
void setGamescopeBorderless(bool value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] int gamescopeWidth() const;
void setGamescopeWidth(int value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] int gamescopeHeight() const;
void setGamescopeHeight(int value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] int gamescopeRefreshRate() const;
void setGamescopeRefreshRate(int value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool dalamudEnabled() const;
void setDalamudEnabled(bool value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] DalamudChannel dalamudChannel() const;
void setDalamudChannel(DalamudChannel channel);
[[nodiscard]] DalamudInjectMethod dalamudInjectMethod() const;
void setDalamudInjectMethod(DalamudInjectMethod value);
[[nodiscard]] int dalamudInjectDelay() const;
void setDalamudInjectDelay(int value);
2023-09-17 08:51:26 -04:00
[[nodiscard]] Account *account() const;
[[nodiscard]] QString accountUuid() const;
void setAccount(Account *account);
2023-10-08 19:14:17 -04:00
void readGameVersion();
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString expansionVersionText() const;
[[nodiscard]] QString dalamudVersionText() const;
[[nodiscard]] QString wineVersionText() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString dalamudChannelName() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] bool isGameInstalled() const;
[[nodiscard]] bool isWineInstalled() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString bootVersion() const;
[[nodiscard]] QString baseGameVersion() const;
[[nodiscard]] int numInstalledExpansions() const;
[[nodiscard]] QString expansionVersion(int index) const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] int dalamudAssetVersion() const;
void setDalamudAssetVersion(int version);
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString runtimeVersion() const;
2023-09-17 08:51:26 -04:00
[[nodiscard]] QString dalamudVersion() const;
void setDalamudVersion(const QString &version);
[[nodiscard]] QString compatibilityToolVersion() const;
void setCompatibilityToolVersion(const QString &version);
2023-09-17 08:51:26 -04:00
BootData *bootData();
GameData *gameData();
[[nodiscard]] bool loggedIn() const;
void setLoggedIn(bool value);
Q_SIGNALS:
void gameInstallChanged();
void nameChanged();
void gamePathChanged();
void winePathChanged();
void winePrefixPathChanged();
void wineTypeChanged();
void useGamescopeChanged();
void useGamemodeChanged();
void useDX9Changed();
void gamescopeFullscreenChanged();
void gamescopeBorderlessChanged();
void gamescopeWidthChanged();
void gamescopeHeightChanged();
void gamescopeRefreshRateChanged();
void dalamudEnabledChanged();
void dalamudChannelChanged();
void dalamudInjectMethodChanged();
void dalamudInjectDelayChanged();
void accountChanged();
void wineChanged();
void loggedInChanged();
private:
2023-10-08 19:14:17 -04:00
void readGameData();
void readWineInfo();
void readDalamudInfo();
QString m_uuid;
QString m_wineVersion;
ProfileConfig *m_config = nullptr;
Account *m_account = nullptr;
2023-09-17 08:51:26 -04:00
2023-12-17 11:07:34 -05:00
QList<QString> m_expansionNames;
2023-09-17 08:51:26 -04:00
BootData *m_bootData = nullptr;
GameData *m_gameData = nullptr;
physis_Repositories m_repositories = {};
const char *m_bootVersion = nullptr;
QString m_dalamudVersion;
int m_dalamudAssetVersion = -1;
QString m_runtimeVersion;
QString m_compatibilityToolVersion;
2023-09-17 08:51:26 -04:00
bool m_loggedIn = false;
LauncherCore &m_launcher;
};