1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-01 08:27:45 +00:00
astra/launcher/ui/Settings/CompatibilityToolSetup.qml
Joshua Goins 377f10408c Improve the compatibility tool installer UX
Now there's confirmation dialogs when the installation/removal is
successful, instead of nothing happening.
2025-04-29 15:14:45 -04:00

81 lines
2.3 KiB
QML

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import zone.xiv.astra
FormCard.FormCardPage {
id: page
readonly property CompatibilityToolInstaller installer: LauncherCore.createCompatInstaller()
title: i18nc("@title:window", "Compatibility Tool")
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing * 4
FormCard.FormTextDelegate {
text: i18n("Press the button below to install the compatibility tool for Steam.")
}
FormCard.FormDelegateSeparator {
below: installToolButton
}
FormCard.FormButtonDelegate {
id: installToolButton
text: i18n("Install Tool")
icon.name: "install"
onClicked: page.installer.installCompatibilityTool()
}
FormCard.FormDelegateSeparator {
above: installToolButton
below: removeToolButton
}
FormCard.FormButtonDelegate {
id: removeToolButton
text: i18n("Remove Tool")
icon.name: "delete"
onClicked: page.installer.removeCompatibilityTool()
}
}
readonly property Kirigami.PromptDialog errorDialog: Kirigami.PromptDialog {
showCloseButton: false
standardButtons: Kirigami.Dialog.Ok
parent: page.QQC2.Overlay.overlay
}
data: Connections {
target: page.installer
function onInstallFinished(): void {
page.errorDialog.title = i18n("Install Success");
page.errorDialog.subtitle = i18n("Compatibility tool successfully installed!");
page.errorDialog.open();
}
function onError(message: string): void {
page.errorDialog.title = i18n("Install Error");
page.errorDialog.subtitle = message;
page.errorDialog.open();
}
function onRemovalFinished(): void {
page.errorDialog.title = i18n("Removal Success");
page.errorDialog.subtitle = i18n("Compatibility tool successfully removed!");
page.errorDialog.open();
}
}
}