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:
parent
c8a81af967
commit
7e58b60297
4 changed files with 67 additions and 88 deletions
|
@ -18,6 +18,17 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
title: i18nc("@title:window", "Edit Account")
|
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 {
|
FormCard.FormHeader {
|
||||||
title: i18n("General")
|
title: i18n("General")
|
||||||
}
|
}
|
||||||
|
@ -226,31 +237,17 @@ FormCard.FormCardPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormCard {
|
Kirigami.PromptDialog {
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
id: deletePrompt
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
title: i18nc("@title", "Delete Account")
|
||||||
text: i18n("Delete Account")
|
subtitle: i18nc("@label", "Are you sure you want to delete this account?")
|
||||||
description: !enabled ? i18n("Cannot delete the only account.") : ""
|
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
|
||||||
icon.name: "delete"
|
showCloseButton: false
|
||||||
enabled: LauncherCore.accountManager.canDelete(page.account)
|
|
||||||
|
|
||||||
Kirigami.PromptDialog {
|
onAccepted: {
|
||||||
id: deletePrompt
|
LauncherCore.accountManager.deleteAccount(page.account);
|
||||||
|
page.Window.window.pageStack.layers.pop();
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,6 +18,22 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
title: i18nc("@title:window", "Accounts")
|
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 {
|
FormCard.FormCard {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
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"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -20,6 +20,17 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
title: i18nc("@window:title", "Edit Profile")
|
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 {
|
FormCard.FormHeader {
|
||||||
title: i18n("General")
|
title: i18n("General")
|
||||||
}
|
}
|
||||||
|
@ -267,31 +278,17 @@ FormCard.FormCardPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FormCard.FormCard {
|
Kirigami.PromptDialog {
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
id: deletePrompt
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
FormCard.FormButtonDelegate {
|
title: i18nc("@title", "Delete Profile")
|
||||||
text: i18n("Delete Profile")
|
subtitle: i18nc("@label", "Are you sure you want to delete this profile?")
|
||||||
description: !enabled ? i18n("Cannot delete the only profile.") : ""
|
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
|
||||||
icon.name: "delete"
|
showCloseButton: false
|
||||||
enabled: LauncherCore.profileManager.canDelete(page.profile)
|
|
||||||
|
|
||||||
Kirigami.PromptDialog {
|
onAccepted: {
|
||||||
id: deletePrompt
|
LauncherCore.profileManager.deleteProfile(page.profile);
|
||||||
|
page.Window.window.pageStack.layers.pop();
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,6 +17,17 @@ FormCard.FormCardPage {
|
||||||
|
|
||||||
title: i18nc("@title:window", "Profiles")
|
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 {
|
FormCard.FormCard {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue