1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-25 05:47:45 +00:00

Move add/remove buttons for profiles and accounts to the header

This commit is contained in:
Joshua Goins 2024-03-26 17:42:52 -04:00
parent c8a81af967
commit 7e58b60297
4 changed files with 67 additions and 88 deletions

View file

@ -18,6 +18,17 @@ FormCard.FormCardPage {
title: i18nc("@title:window", "Edit Account")
actions: [
Kirigami.Action {
text: i18n("Delete Account")
tooltip: !enabled ? i18n("Cannot delete the only account.") : ""
icon.name: "delete"
enabled: LauncherCore.accountManager.canDelete(page.account)
onTriggered: deletePrompt.open()
}
]
FormCard.FormHeader {
title: i18n("General")
}
@ -226,31 +237,17 @@ FormCard.FormCardPage {
}
}
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
Kirigami.PromptDialog {
id: deletePrompt
FormCard.FormButtonDelegate {
text: i18n("Delete Account")
description: !enabled ? i18n("Cannot delete the only account.") : ""
icon.name: "delete"
enabled: LauncherCore.accountManager.canDelete(page.account)
title: i18nc("@title", "Delete Account")
subtitle: i18nc("@label", "Are you sure you want to delete this account?")
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
showCloseButton: false
Kirigami.PromptDialog {
id: deletePrompt
title: i18nc("@title", "Delete Account")
subtitle: i18nc("@label", "Are you sure you want to delete this account?")
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
showCloseButton: false
onAccepted: {
LauncherCore.accountManager.deleteAccount(page.account);
page.Window.window.pageStack.layers.pop();
}
}
onClicked: deletePrompt.open()
onAccepted: {
LauncherCore.accountManager.deleteAccount(page.account);
page.Window.window.pageStack.layers.pop();
}
}
}

View file

@ -18,6 +18,22 @@ FormCard.FormCardPage {
title: i18nc("@title:window", "Accounts")
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"))
}
}
]
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
@ -55,30 +71,4 @@ FormCard.FormCardPage {
}
}
}
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormButtonDelegate {
id: addSquareEnixButton
text: i18n("Add Square Enix Account")
icon.name: "list-add-symbolic"
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSquareEnix"))
}
FormCard.FormDelegateSeparator {
above: addSquareEnixButton
below: addSapphireButton
}
FormCard.FormButtonDelegate {
id: addSapphireButton
text: i18n("Add Sapphire Account")
icon.name: "list-add-symbolic"
onClicked: root.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "AddSapphire"))
}
}
}

View file

@ -20,6 +20,17 @@ FormCard.FormCardPage {
title: i18nc("@window:title", "Edit Profile")
actions: [
Kirigami.Action {
text: i18n("Delete Profile")
icon.name: "delete"
enabled: LauncherCore.profileManager.canDelete(page.profile)
tooltip: !enabled ? i18n("Cannot delete the only profile.") : ""
onTriggered: deletePrompt.open()
}
]
FormCard.FormHeader {
title: i18n("General")
}
@ -267,31 +278,17 @@ FormCard.FormCardPage {
}
}
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.fillWidth: true
Kirigami.PromptDialog {
id: deletePrompt
FormCard.FormButtonDelegate {
text: i18n("Delete Profile")
description: !enabled ? i18n("Cannot delete the only profile.") : ""
icon.name: "delete"
enabled: LauncherCore.profileManager.canDelete(page.profile)
title: i18nc("@title", "Delete Profile")
subtitle: i18nc("@label", "Are you sure you want to delete this profile?")
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
showCloseButton: false
Kirigami.PromptDialog {
id: deletePrompt
title: i18nc("@title", "Delete Profile")
subtitle: i18nc("@label", "Are you sure you want to delete this profile?")
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
showCloseButton: false
onAccepted: {
LauncherCore.profileManager.deleteProfile(page.profile);
page.Window.window.pageStack.layers.pop();
}
}
onClicked: deletePrompt.open()
onAccepted: {
LauncherCore.profileManager.deleteProfile(page.profile);
page.Window.window.pageStack.layers.pop();
}
}
}

View file

@ -17,6 +17,17 @@ FormCard.FormCardPage {
title: i18nc("@title:window", "Profiles")
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
@ -47,20 +58,4 @@ FormCard.FormCardPage {
}
}
}
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormButtonDelegate {
id: addProfileButton
text: i18n("Add Profile")
icon.name: "list-add"
onClicked: {
page.Window.window.close();
LauncherCore.currentProfile = LauncherCore.profileManager.addProfile();
}
}
}
}