1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-01 16:37:44 +00:00

Denote if Steam is not installed on the compatibility tool installer

This commit is contained in:
Joshua Goins 2025-04-29 15:12:07 -04:00
parent d7eff61882
commit b15c42ac4c
3 changed files with 18 additions and 2 deletions

View file

@ -14,6 +14,7 @@ class CompatibilityToolInstaller : public QObject
QML_UNCREATABLE("Use LauncherCore.createCompatInstaller") QML_UNCREATABLE("Use LauncherCore.createCompatInstaller")
Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY isInstalledChanged) Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY isInstalledChanged)
Q_PROPERTY(bool hasSteam READ hasSteam CONSTANT)
public: public:
explicit CompatibilityToolInstaller(LauncherCore &launcher, QObject *parent = nullptr); explicit CompatibilityToolInstaller(LauncherCore &launcher, QObject *parent = nullptr);
@ -22,6 +23,7 @@ public:
Q_INVOKABLE void removeCompatibilityTool(); Q_INVOKABLE void removeCompatibilityTool();
bool isInstalled() const; bool isInstalled() const;
bool hasSteam() const;
Q_SIGNALS: Q_SIGNALS:
void installFinished(); void installFinished();

View file

@ -126,4 +126,12 @@ bool CompatibilityToolInstaller::isInstalled() const
return astraToolDir.exists(); return astraToolDir.exists();
} }
bool CompatibilityToolInstaller::hasSteam() const
{
const QDir appDataDir = QStandardPaths::standardLocations(QStandardPaths::StandardLocation::HomeLocation)[0];
const QDir steamDir = appDataDir.absoluteFilePath(QStringLiteral(".steam"));
const QDir steamSteamDir = steamDir.absoluteFilePath(QStringLiteral("steam"));
return steamSteamDir.exists();
}
#include "moc_compatibilitytoolinstaller.cpp" #include "moc_compatibilitytoolinstaller.cpp"

View file

@ -34,7 +34,7 @@ FormCard.FormCardPage {
text: i18n("Install Tool") text: i18n("Install Tool")
icon.name: "install" icon.name: "install"
visible: !page.installer.isInstalled visible: page.installer.hasSteam && !page.installer.isInstalled
onClicked: page.installer.installCompatibilityTool() onClicked: page.installer.installCompatibilityTool()
} }
@ -43,9 +43,15 @@ FormCard.FormCardPage {
text: i18n("Remove Tool") text: i18n("Remove Tool")
icon.name: "delete" icon.name: "delete"
visible: page.installer.isInstalled visible: page.installer.hasSteam && page.installer.isInstalled
onClicked: page.installer.removeCompatibilityTool() onClicked: page.installer.removeCompatibilityTool()
} }
FormCard.FormTextDelegate {
text: i18n("Steam is not installed.")
visible: !page.installer.hasSteam
textItem.color: Kirigami.Theme.disabledTextColor
}
} }
readonly property Kirigami.PromptDialog errorDialog: Kirigami.PromptDialog { readonly property Kirigami.PromptDialog errorDialog: Kirigami.PromptDialog {