mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 03:37:47 +00:00
In the case where you accidentally uploaded the wrong data, or your data is hosed to begin with.
144 lines
3.6 KiB
QML
144 lines
3.6 KiB
QML
// SPDX-FileCopyrightText: 2024 Joshua Goins <josh@redstrate.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
import org.kde.kirigamiaddons.formcard as FormCard
|
|
|
|
import zone.xiv.astra
|
|
|
|
import "../Components"
|
|
|
|
FormCard.FormCardPage {
|
|
id: page
|
|
|
|
title: i18nc("@title:window", "Sync")
|
|
|
|
FormCard.FormCard {
|
|
id: infoCard
|
|
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
|
|
|
FormCard.FormTextDelegate {
|
|
id: infoDelegate
|
|
|
|
text: i18n("Sync character data between devices using <a href='https://matrix.org'>Matrix</a>.")
|
|
}
|
|
|
|
FormCard.FormDelegateSeparator {
|
|
above: infoDelegate
|
|
below: enableSyncDelegate
|
|
}
|
|
|
|
FormCard.FormCheckDelegate {
|
|
id: enableSyncDelegate
|
|
|
|
text: i18n("Enable Sync")
|
|
description: i18n("Syncing will occur before login, and after the game exits.")
|
|
checked: LauncherCore.settings.enableSync
|
|
onCheckedChanged: LauncherCore.settings.enableSync = checked
|
|
}
|
|
}
|
|
|
|
FormCard.FormCard {
|
|
id: loginCard
|
|
|
|
Layout.fillWidth: true
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
|
|
|
visible: !LauncherCore.syncManager.connected
|
|
enabled: LauncherCore.settings.enableSync
|
|
|
|
FormCard.FormTextFieldDelegate {
|
|
id: usernameDelegate
|
|
|
|
label: i18n("Username:")
|
|
placeholderText: "@username:domain.com"
|
|
}
|
|
|
|
FormCard.FormDelegateSeparator {
|
|
above: usernameDelegate
|
|
below: passwordDelegate
|
|
}
|
|
|
|
FormCard.FormTextFieldDelegate {
|
|
id: passwordDelegate
|
|
|
|
label: i18n("Password:")
|
|
echoMode: TextInput.Password
|
|
}
|
|
|
|
FormCard.FormDelegateSeparator {
|
|
above: passwordDelegate
|
|
below: loginButton
|
|
}
|
|
|
|
FormCard.FormButtonDelegate {
|
|
id: loginButton
|
|
|
|
text: i18n("Login")
|
|
|
|
onClicked: LauncherCore.syncManager.login(usernameDelegate.text, passwordDelegate.text)
|
|
}
|
|
}
|
|
|
|
FormCard.FormCard {
|
|
id: logoutCard
|
|
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
|
|
|
visible: LauncherCore.syncManager.connected
|
|
|
|
FormCard.FormTextDelegate {
|
|
id: usernameLabelDelegate
|
|
|
|
text: i18n("Logged in as %1", LauncherCore.syncManager.userId)
|
|
}
|
|
|
|
FormCard.FormDelegateSeparator {
|
|
above: usernameLabelDelegate
|
|
below: initialSyncDelegate
|
|
}
|
|
|
|
FormCard.FormCheckDelegate {
|
|
id: initialSyncDelegate
|
|
|
|
text: i18n("Overwrite existing data")
|
|
description: i18n("Temporarily overwrite any existing data on the server. This setting is not saved, and is reset when you log in.")
|
|
checked: LauncherCore.syncManager.initialSync
|
|
onCheckedChanged: LauncherCore.syncManager.initialSync = checked
|
|
}
|
|
|
|
FormCard.FormDelegateSeparator {
|
|
above: initialSyncDelegate
|
|
below: logoutDelegate
|
|
}
|
|
|
|
FormCard.FormButtonDelegate {
|
|
id: logoutDelegate
|
|
|
|
text: i18n("Log Out")
|
|
onClicked: LauncherCore.syncManager.logout()
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: LauncherCore.syncManager
|
|
|
|
function onLoginError(message: string): void {
|
|
errorDialog.subtitle = message;
|
|
errorDialog.open();
|
|
}
|
|
}
|
|
|
|
Kirigami.PromptDialog {
|
|
id: errorDialog
|
|
title: i18n("Login Error")
|
|
|
|
showCloseButton: false
|
|
standardButtons: Kirigami.Dialog.Ok
|
|
}
|
|
}
|