1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-05-14 13:27:46 +00:00
astra/launcher/ui/Pages/StatusPage.qml
Joshua Goins 8c2a591279 Make Astra more useful when offline
When you're offline, all of the asset update checks fail (of course) and
thus can prevent you from logging in. While it's possible to work around
this already by toggling certain things off such as Dalamud, the
built-in Wine etc - we should still be able to play if we have all of
that downloaded.

Now there is buttons in the network fail prompts that allow you to
continue if you understand the risks. This would also make Astra more
resilient to issues like GitHub being temporarily unavailable.
2025-05-07 20:18:38 -04:00

156 lines
4.3 KiB
QML

// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick
import QtQuick.Window
import org.kde.kirigami as Kirigami
import zone.xiv.astra
Kirigami.Page {
id: root
property var gameInstaller
title: i18n("Logging in...")
onBackRequested: (event) => {
if (LauncherCore.isPatching()) {
// Prevent going back
applicationWindow().showPassiveNotification(i18n("Please do not quit while patching!"));
event.accepted = true;
}
}
Kirigami.LoadingPlaceholder {
id: placeholder
text: "Logging in..."
anchors.centerIn: parent
}
Kirigami.PromptDialog {
id: errorDialog
showCloseButton: false
standardButtons: Kirigami.Dialog.Ok
onAccepted: applicationWindow().checkSetup()
onRejected: applicationWindow().checkSetup()
}
Kirigami.PromptDialog {
id: dalamudErrorDialog
title: i18n("Dalamud Error")
showCloseButton: false
standardButtons: Kirigami.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
icon.name: "edit-none-symbolic"
text: i18n("Disable Dalamud")
onTriggered: {
LauncherCore.currentProfile.config.dalamudEnabled = false;
dalamudErrorDialog.accept();
}
},
Kirigami.Action {
icon.name: "checkmark-symbolic"
text: i18n("Continue Anyway")
onTriggered: dalamudErrorDialog.accept()
}
]
onAccepted: LauncherCore.dalamudDecided(true)
onRejected: {
LauncherCore.dalamudDecided(false);
applicationWindow().checkSetup();
}
}
Kirigami.PromptDialog {
id: updateDialog
showCloseButton: false
standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel
onAccepted: LauncherCore.updateDecided(true)
onRejected: {
LauncherCore.updateDecided(false);
applicationWindow().checkSetup();
}
}
Kirigami.PromptDialog {
id: assetDialog
showCloseButton: false
standardButtons: Kirigami.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
icon.name: "checkmark-symbolic"
text: i18n("Continue Anyway")
onTriggered: assetDialog.accept()
}
]
onAccepted: LauncherCore.assetDecided(true)
onRejected: {
LauncherCore.assetDecided(false);
applicationWindow().checkSetup();
}
}
Connections {
target: LauncherCore
function onStageChanged(message: string, explanation: string): void {
placeholder.text = message;
placeholder.explanation = explanation;
}
function onStageIndeterminate(): void {
placeholder.determinate = false;
}
function onStageDeterminate(min: int, max: int, value: int): void {
placeholder.determinate = true;
placeholder.progressBar.value = value;
placeholder.progressBar.from = min;
placeholder.progressBar.to = max;
}
function onLoginError(message: string): void {
errorDialog.title = i18n("Login Error");
errorDialog.subtitle = message;
errorDialog.open();
}
function onMiscError(message: string): void {
errorDialog.title = i18n("Error");
errorDialog.subtitle = message;
errorDialog.open();
}
function onDalamudError(message: string): void {
dalamudErrorDialog.subtitle = i18n("An error occurred while updating Dalamud:\n\n%1.\n\nWould you like to disable Dalamud?", message);
dalamudErrorDialog.open();
}
function onRequiresUpdate(message: string): void {
updateDialog.title = i18n("Update Required");
updateDialog.subtitle = message;
updateDialog.open();
}
function onAssetError(message: string): void {
assetDialog.title = i18n("Error");
assetDialog.subtitle = message;
assetDialog.open();
}
}
}