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
|
2024-03-28 16:58:39 -04:00
|
|
|
import QtQuick.Controls as QQC2
|
2023-09-16 18:15:11 -04:00
|
|
|
|
2023-09-20 15:30:50 -04:00
|
|
|
import org.kde.kirigami as Kirigami
|
2023-09-16 18:15:11 -04:00
|
|
|
import org.kde.kirigamiaddons.formcard as FormCard
|
|
|
|
|
|
|
|
import zone.xiv.astra
|
2023-08-19 10:49:00 -04:00
|
|
|
|
|
|
|
FormCard.FormCardPage {
|
2023-09-20 16:44:43 -04:00
|
|
|
id: page
|
|
|
|
|
2023-09-20 15:30:50 -04:00
|
|
|
title: i18nc("@title:window", "Profiles")
|
2023-08-19 10:49:00 -04:00
|
|
|
|
2024-03-26 17:42:52 -04:00
|
|
|
actions: [
|
|
|
|
Kirigami.Action {
|
|
|
|
text: i18n("Add Profile…")
|
|
|
|
icon.name: "list-add"
|
|
|
|
onTriggered: {
|
|
|
|
page.Window.window.close();
|
|
|
|
LauncherCore.currentProfile = LauncherCore.profileManager.addProfile();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2024-03-28 16:58:39 -04:00
|
|
|
FormCard.FormCard {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
|
|
|
|
|
|
|
FormCard.FormButtonDelegate {
|
|
|
|
text: i18n("Auto-login Profile")
|
|
|
|
description: LauncherCore.autoLoginProfile ? LauncherCore.autoLoginProfile.name : i18n("Disabled")
|
|
|
|
|
|
|
|
QQC2.Menu {
|
|
|
|
id: profileMenu
|
|
|
|
|
|
|
|
QQC2.MenuItem {
|
|
|
|
text: "Disabled"
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
LauncherCore.autoLoginProfile = null;
|
|
|
|
profileMenu.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: LauncherCore.profileManager
|
|
|
|
|
|
|
|
QQC2.MenuItem {
|
|
|
|
required property var profile
|
|
|
|
|
|
|
|
text: profile.name
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
LauncherCore.autoLoginProfile = profile;
|
|
|
|
profileMenu.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onClicked: profileMenu.popup()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-19 10:49:00 -04:00
|
|
|
FormCard.FormCard {
|
|
|
|
Layout.fillWidth: true
|
2023-09-20 15:30:50 -04:00
|
|
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
2023-08-19 10:49:00 -04:00
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: LauncherCore.profileManager
|
|
|
|
|
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 profile
|
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
|
|
|
|
|
|
|
|
FormCard.FormButtonDelegate {
|
|
|
|
id: buttonDelegate
|
|
|
|
|
2023-12-17 12:47:13 -05:00
|
|
|
text: layout.profile.name
|
2024-04-19 20:29:28 -04:00
|
|
|
description: layout.profile.subtitle
|
2023-10-08 20:24:35 -04:00
|
|
|
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
|
2023-12-17 12:47:13 -05:00
|
|
|
profile: layout.profile
|
2023-10-08 20:24:35 -04:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
FormCard.FormDelegateSeparator {
|
2024-03-23 12:44:34 -04:00
|
|
|
visible: layout.index + 1 < LauncherCore.profileManager.numProfiles
|
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
|
|
|
}
|