1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 19:57:45 +00:00
astra/launcher/ui/Settings/AccountsPage.qml

77 lines
2.2 KiB
QML
Raw Normal View History

2023-08-19 10:49:00 -04:00
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
2023-12-17 12:47:13 -05:00
pragma ComponentBehavior: Bound
2023-09-16 18:15:11 -04:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
2023-09-16 18:15:11 -04:00
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
2023-09-16 17:32:38 -04:00
import org.kde.kirigamiaddons.components as Components
2023-09-16 18:15:11 -04:00
import zone.xiv.astra
2023-08-19 10:49:00 -04:00
FormCard.FormCardPage {
id: root
2023-09-20 15:30:50 -04:00
title: i18nc("@title:window", "Accounts")
2023-08-19 10:49:00 -04:00
actions: [
Kirigami.Action {
text: i18n("Add Account…")
icon.name: "list-add-symbolic"
Kirigami.Action {
text: i18n("Square Enix")
onTriggered: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"))
}
Kirigami.Action {
text: i18n("Sapphire")
onTriggered: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"))
}
}
]
2023-08-19 10:49:00 -04:00
FormCard.FormCard {
2023-09-20 15:30:50 -04:00
Layout.topMargin: Kirigami.Units.largeSpacing
visible: repeater.count !== 0
2023-08-19 10:49:00 -04:00
Repeater {
id: repeater
2023-08-19 10:49:00 -04:00
model: LauncherCore.accountManager
ColumnLayout {
2023-12-17 12:47:13 -05:00
id: layout
2023-08-19 10:49:00 -04:00
required property var account
required property int index
2023-08-19 10:49:00 -04:00
spacing: 0
2023-08-19 10:49:00 -04:00
FormCard.FormButtonDelegate {
2023-12-17 12:47:13 -05:00
text: layout.account.name
description: layout.account.isSapphire ? i18n("Sapphire") : i18n("Square Enix")
leading: Components.Avatar
{
2023-12-17 12:47:13 -05:00
name: layout.account.name
source: layout.account.avatarUrl
}
leadingPadding: Kirigami.Units.largeSpacing * 2
2023-08-19 10:49:00 -04:00
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AccountSettings"), {
2023-12-17 12:47:13 -05:00
account: layout.account
})
}
2023-08-19 10:49:00 -04:00
FormCard.FormDelegateSeparator {
2024-04-01 15:19:15 -04:00
visible: layout.index + 1 < LauncherCore.accountManager.numAccounts
}
2023-08-19 10:49:00 -04:00
}
}
}
2023-08-19 10:49:00 -04:00
}