1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-22 12:47:44 +00:00
astra/launcher/ui/Settings/ProfilesPage.qml

103 lines
2.7 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
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 {
id: page
2023-09-20 15:30:50 -04:00
title: i18nc("@title:window", "Profiles")
2023-08-19 10:49:00 -04:00
actions: [
Kirigami.Action {
text: i18n("Add Profile…")
icon.name: "list-add"
onTriggered: {
page.Window.window.close();
LauncherCore.currentProfile = LauncherCore.profileManager.addProfile();
}
}
]
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
ColumnLayout {
2023-12-17 12:47:13 -05:00
id: layout
2023-08-19 10:49:00 -04:00
required property var profile
required property int index
2023-08-19 10:49:00 -04:00
spacing: 0
FormCard.FormButtonDelegate {
id: buttonDelegate
2023-12-17 12:47:13 -05:00
text: layout.profile.name
description: layout.profile.subtitle
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
2023-12-17 12:47:13 -05:00
profile: layout.profile
})
}
FormCard.FormDelegateSeparator {
visible: layout.index + 1 < LauncherCore.profileManager.numProfiles
}
2023-08-19 10:49:00 -04:00
}
}
}
2023-08-19 10:49:00 -04:00
}