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
|
2023-09-20 16:44:43 -04:00
|
|
|
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 {
|
2023-09-20 16:44:43 -04:00
|
|
|
id: root
|
|
|
|
|
2023-09-20 15:30:50 -04:00
|
|
|
title: i18nc("@title:window", "Accounts")
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2024-03-26 17:42:52 -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
|
2024-04-19 20:29:28 -04:00
|
|
|
visible: repeater.count !== 0
|
2023-08-19 10:49:00 -04:00
|
|
|
|
|
|
|
Repeater {
|
2024-04-19 20:29:28 -04:00
|
|
|
id: repeater
|
|
|
|
|
2023-08-19 10:49:00 -04:00
|
|
|
model: LauncherCore.accountManager
|
|
|
|
|
2023-10-08 20:24:35 -04:00
|
|
|
ColumnLayout {
|
2023-12-17 12:47:13 -05:00
|
|
|
id: layout
|
|
|
|
|
2023-08-19 10:49:00 -04:00
|
|
|
required property var account
|
2023-10-08 20:24:35 -04:00
|
|
|
required property int index
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2023-10-08 20:24:35 -04:00
|
|
|
spacing: 0
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2023-10-08 20:24:35 -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")
|
2023-10-08 20:24:35 -04:00
|
|
|
|
2024-04-19 20:29:28 -04:00
|
|
|
leading: Components.Avatar
|
|
|
|
{
|
2023-12-17 12:47:13 -05:00
|
|
|
name: layout.account.name
|
|
|
|
source: layout.account.avatarUrl
|
2023-10-08 20:24:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
leadingPadding: Kirigami.Units.largeSpacing * 2
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2023-10-08 20:24:35 -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-10-08 20:24:35 -04:00
|
|
|
})
|
|
|
|
}
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2023-10-08 20:24:35 -04:00
|
|
|
FormCard.FormDelegateSeparator {
|
2024-04-01 15:19:15 -04:00
|
|
|
visible: layout.index + 1 < LauncherCore.accountManager.numAccounts
|
2023-10-08 20:24:35 -04:00
|
|
|
}
|
2023-08-19 10:49:00 -04:00
|
|
|
}
|
|
|
|
}
|
2023-10-08 20:24:35 -04:00
|
|
|
}
|
2023-08-19 10:49:00 -04:00
|
|
|
}
|