mirror of
https://github.com/redstrate/Astra.git
synced 2025-05-01 16:37:44 +00:00
Improve the compatibility tool installer UX
Now there's confirmation dialogs when the installation/removal is successful, instead of nothing happening.
This commit is contained in:
parent
1708aabb14
commit
377f10408c
3 changed files with 18 additions and 18 deletions
|
@ -22,6 +22,7 @@ public:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void installFinished();
|
void installFinished();
|
||||||
void error(QString message);
|
void error(QString message);
|
||||||
|
void removalFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LauncherCore &m_launcher;
|
LauncherCore &m_launcher;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void CompatibilityToolInstaller::removeCompatibilityTool()
|
||||||
astraToolDir.removeRecursively();
|
astraToolDir.removeRecursively();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT installFinished();
|
Q_EMIT removalFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_compatibilitytoolinstaller.cpp"
|
#include "moc_compatibilitytoolinstaller.cpp"
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtQuick.Controls as QQC2
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import org.kde.kirigamiaddons.formcard as FormCard
|
import org.kde.kirigamiaddons.formcard as FormCard
|
||||||
|
@ -12,7 +13,7 @@ import zone.xiv.astra
|
||||||
FormCard.FormCardPage {
|
FormCard.FormCardPage {
|
||||||
id: page
|
id: page
|
||||||
|
|
||||||
property var installer: null
|
readonly property CompatibilityToolInstaller installer: LauncherCore.createCompatInstaller()
|
||||||
|
|
||||||
title: i18nc("@title:window", "Compatibility Tool")
|
title: i18nc("@title:window", "Compatibility Tool")
|
||||||
|
|
||||||
|
@ -33,10 +34,7 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
text: i18n("Install Tool")
|
text: i18n("Install Tool")
|
||||||
icon.name: "install"
|
icon.name: "install"
|
||||||
onClicked: {
|
onClicked: page.installer.installCompatibilityTool()
|
||||||
page.installer = LauncherCore.createCompatInstaller();
|
|
||||||
page.installer.installCompatibilityTool();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormDelegateSeparator {
|
FormCard.FormDelegateSeparator {
|
||||||
|
@ -49,34 +47,35 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
text: i18n("Remove Tool")
|
text: i18n("Remove Tool")
|
||||||
icon.name: "delete"
|
icon.name: "delete"
|
||||||
onClicked: {
|
onClicked: page.installer.removeCompatibilityTool()
|
||||||
page.installer = LauncherCore.createCompatInstaller();
|
|
||||||
page.installer.removeCompatibilityTool();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property Kirigami.PromptDialog errorDialog: Kirigami.PromptDialog {
|
readonly property Kirigami.PromptDialog errorDialog: Kirigami.PromptDialog {
|
||||||
title: i18n("Install error")
|
|
||||||
|
|
||||||
showCloseButton: false
|
showCloseButton: false
|
||||||
standardButtons: Kirigami.Dialog.Ok
|
standardButtons: Kirigami.Dialog.Ok
|
||||||
|
parent: page.QQC2.Overlay.overlay
|
||||||
onAccepted: applicationWindow().pageStack.layers.pop()
|
|
||||||
onRejected: applicationWindow().pageStack.layers.pop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data: Connections {
|
data: Connections {
|
||||||
enabled: page.installer !== null
|
|
||||||
target: page.installer
|
target: page.installer
|
||||||
|
|
||||||
function onInstallFinished(): void {
|
function onInstallFinished(): void {
|
||||||
applicationWindow().pageStack.layers.pop();
|
page.errorDialog.title = i18n("Install Success");
|
||||||
|
page.errorDialog.subtitle = i18n("Compatibility tool successfully installed!");
|
||||||
|
page.errorDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onError(message: string): void {
|
function onError(message: string): void {
|
||||||
|
page.errorDialog.title = i18n("Install Error");
|
||||||
page.errorDialog.subtitle = message;
|
page.errorDialog.subtitle = message;
|
||||||
page.errorDialog.open();
|
page.errorDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onRemovalFinished(): void {
|
||||||
|
page.errorDialog.title = i18n("Removal Success");
|
||||||
|
page.errorDialog.subtitle = i18n("Compatibility tool successfully removed!");
|
||||||
|
page.errorDialog.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue