1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-01 08:27:45 +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")
Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY isInstalledChanged)
Q_PROPERTY(bool hasSteam READ hasSteam CONSTANT)
public:
explicit CompatibilityToolInstaller(LauncherCore &launcher, QObject *parent = nullptr);
@ -22,6 +23,7 @@ public:
Q_INVOKABLE void removeCompatibilityTool();
bool isInstalled() const;
bool hasSteam() const;
Q_SIGNALS:
void installFinished();

View file

@ -126,4 +126,12 @@ bool CompatibilityToolInstaller::isInstalled() const
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"

View file

@ -34,7 +34,7 @@ FormCard.FormCardPage {
text: i18n("Install Tool")
icon.name: "install"
visible: !page.installer.isInstalled
visible: page.installer.hasSteam && !page.installer.isInstalled
onClicked: page.installer.installCompatibilityTool()
}
@ -43,9 +43,15 @@ FormCard.FormCardPage {
text: i18n("Remove Tool")
icon.name: "delete"
visible: page.installer.isInstalled
visible: page.installer.hasSteam && page.installer.isInstalled
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 {