2023-08-18 23:27:29 -04:00
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
2023-09-16 18:15:11 -04:00
import QtQuick
import QtQuick . Layouts
2025-04-29 15:12:07 -04:00
import QtQuick . Controls as QQC2
2023-09-16 18:15:11 -04:00
import org . kde . kirigami as Kirigami
import org . kde . kirigamiaddons . formcard as FormCard
import zone . xiv . astra
2023-08-18 23:27:29 -04:00
2023-08-19 10:30:52 -04:00
FormCard . FormCardPage {
2023-08-18 23:27:29 -04:00
id: page
2025-04-29 15:12:07 -04:00
readonly property CompatibilityToolInstaller installer: LauncherCore . createCompatInstaller ( )
2023-08-18 23:27:29 -04:00
2023-09-20 15:30:50 -04:00
title: i18nc ( "@title:window" , "Compatibility Tool" )
2023-08-19 10:30:52 -04:00
FormCard . FormCard {
Layout.fillWidth: true
2025-02-01 10:05:01 -05:00
Layout.topMargin: Kirigami . Units . largeSpacing * 4
2023-08-19 10:30:52 -04:00
FormCard . FormTextDelegate {
2025-05-05 16:34:56 -04:00
text: i18n ( "Installing Astra as a Compatibility Tool in Steam lets you bypass the official launcher.\n\nThis is needed to use Astra with a Steam service account." )
textItem.wrapMode: Text . WordWrap
2023-08-19 10:30:52 -04:00
}
2025-04-29 15:12:07 -04:00
}
2023-08-19 10:30:52 -04:00
2025-04-29 15:12:07 -04:00
FormCard . FormCard {
Layout.topMargin: Kirigami . Units . largeSpacing
2023-08-19 10:30:52 -04:00
FormCard . FormButtonDelegate {
id: installToolButton
2025-05-05 16:34:56 -04:00
text: i18n ( "Install Compatibility Tool" )
2023-08-19 10:30:52 -04:00
icon.name: "install"
2025-04-29 15:12:07 -04:00
visible: page . installer . hasSteam && ! page . installer . isInstalled
2025-04-29 15:12:07 -04:00
onClicked: page . installer . installCompatibilityTool ( )
2023-08-19 10:30:52 -04:00
}
FormCard . FormButtonDelegate {
id: removeToolButton
2025-05-05 16:34:56 -04:00
text: i18n ( "Remove Compatibility Tool" )
2023-08-19 10:30:52 -04:00
icon.name: "delete"
2025-04-29 15:12:07 -04:00
visible: page . installer . hasSteam && page . installer . isInstalled
2025-04-29 15:12:07 -04:00
onClicked: page . installer . removeCompatibilityTool ( )
2023-08-18 23:27:29 -04:00
}
2025-04-29 15:12:07 -04:00
FormCard . FormTextDelegate {
text: i18n ( "Steam is not installed." )
visible: ! page . installer . hasSteam
textItem.color: Kirigami . Theme . disabledTextColor
}
2023-08-18 23:27:29 -04:00
}
2025-04-29 15:12:07 -04:00
readonly property Kirigami . PromptDialog errorDialog: Kirigami . PromptDialog {
2023-08-18 23:27:29 -04:00
showCloseButton: false
standardButtons: Kirigami . Dialog . Ok
2025-05-04 19:29:53 -04:00
parent: page . QQC2 . Overlay . overlay
2023-08-18 23:27:29 -04:00
}
2023-08-19 10:30:52 -04:00
data: Connections {
2023-08-18 23:27:29 -04:00
target: page . installer
2025-02-01 10:13:05 -05:00
function onInstallFinished ( ) : void {
2025-05-05 16:34:56 -04:00
page . errorDialog . title = i18n ( "Successful Installation" ) ;
page . errorDialog . subtitle = i18n ( "You need to relaunch Steam for Astra to show up as a Compatibility Tool." ) ;
2025-04-29 15:12:07 -04:00
page . errorDialog . open ( ) ;
2023-08-18 23:27:29 -04:00
}
2025-02-01 10:13:05 -05:00
function onError ( message: string ) : void {
2025-05-05 16:34:56 -04:00
page . errorDialog . title = i18n ( "Installation Error" ) ;
2023-12-17 12:47:13 -05:00
page . errorDialog . subtitle = message ;
page . errorDialog . open ( ) ;
2023-08-18 23:27:29 -04:00
}
2025-04-29 15:12:07 -04:00
function onRemovalFinished ( ) : void {
2025-05-05 16:34:56 -04:00
page . errorDialog . title = i18n ( "Successful Removal" ) ;
page . errorDialog . subtitle = i18n ( "You need to relaunch Steam for Astra to stop showing up as a Compatibility Tool." ) ;
2025-04-29 15:12:07 -04:00
page . errorDialog . open ( ) ;
}
2023-08-18 23:27:29 -04:00
}
2025-02-01 10:05:01 -05:00
}