1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 21:07:45 +00:00

Use the fancy categorized settings

This commit is contained in:
Joshua Goins 2023-08-19 10:49:00 -04:00
parent b716801165
commit c2fdf5961e
7 changed files with 209 additions and 170 deletions

View file

@ -11,11 +11,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
<file>ui/Pages/MainPage.qml</file> <file>ui/Pages/MainPage.qml</file>
<file>ui/Pages/NewsPage.qml</file> <file>ui/Pages/NewsPage.qml</file>
<file>ui/Pages/StatusPage.qml</file> <file>ui/Pages/StatusPage.qml</file>
<file>ui/Settings/AboutPage.qml</file>
<file>ui/Settings/AccountSettings.qml</file> <file>ui/Settings/AccountSettings.qml</file>
<file>ui/Settings/AccountsPage.qml</file>
<file>ui/Settings/CompatibilityToolSetup.qml</file> <file>ui/Settings/CompatibilityToolSetup.qml</file>
<file>ui/Settings/DeveloperSettings.qml</file> <file>ui/Settings/DeveloperSettings.qml</file>
<file>ui/Settings/GeneralSettings.qml</file> <file>ui/Settings/GeneralSettings.qml</file>
<file>ui/Settings/ProfileSettings.qml</file> <file>ui/Settings/ProfileSettings.qml</file>
<file>ui/Settings/ProfilesPage.qml</file>
<file>ui/Settings/SettingsPage.qml</file> <file>ui/Settings/SettingsPage.qml</file>
<file>ui/Setup/AccountSetup.qml</file> <file>ui/Setup/AccountSetup.qml</file>
<file>ui/Setup/AddSapphire.qml</file> <file>ui/Setup/AddSapphire.qml</file>

View file

@ -0,0 +1,14 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Window 2.15
import org.kde.kirigami 2.20 as Kirigami
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import zone.xiv.astra 1.0
FormCard.AboutPage {
aboutData: About
}

View file

@ -0,0 +1,66 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Window 2.15
import org.kde.kirigami 2.20 as Kirigami
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import zone.xiv.astra 1.0
FormCard.FormCardPage {
FormCard.FormHeader {
title: i18n("Accounts")
}
FormCard.FormCard {
Layout.fillWidth: true
Repeater {
model: LauncherCore.accountManager
FormCard.FormButtonDelegate {
required property var account
text: account.name
leading: Kirigami.Avatar
{
source: account.avatarUrl
}
leadingPadding: Kirigami.Units.largeSpacing * 2
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/AccountSettings.qml', {
account: account
})
}
}
FormCard.FormDelegateSeparator {
below: addSquareEnixButton
}
FormCard.FormButtonDelegate {
id: addSquareEnixButton
text: i18n("Add Square Enix Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSquareEnix.qml')
}
FormCard.FormDelegateSeparator {
above: addSquareEnixButton
below: addSapphireButton
}
FormCard.FormButtonDelegate {
id: addSapphireButton
text: i18n("Add Sapphire Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSapphire.qml')
}
}
}

View file

@ -11,11 +11,15 @@ import zone.xiv.astra 1.0
import "../Components" import "../Components"
Kirigami.ScrollablePage { FormCard.FormCardPage {
id: page id: page
title: i18n("Developer Settings") title: i18n("Developer Settings")
FormCard.FormHeader {
title: i18n("Patching")
}
FormCard.FormCard { FormCard.FormCard {
Layout.fillWidth: true Layout.fillWidth: true
@ -27,11 +31,14 @@ Kirigami.ScrollablePage {
checked: LauncherCore.keepPatches checked: LauncherCore.keepPatches
onCheckedChanged: LauncherCore.keepPatches = checked onCheckedChanged: LauncherCore.keepPatches = checked
} }
}
FormCard.FormDelegateSeparator { FormCard.FormHeader {
above: keepPatchesDelegate title: i18n("Servers")
below: dalamudServerDelegate }
}
FormCard.FormCard {
Layout.fillWidth: true
FormCard.FormTextFieldDelegate { FormCard.FormTextFieldDelegate {
id: dalamudServerDelegate id: dalamudServerDelegate

View file

@ -9,25 +9,33 @@ import QtQuick.Layouts 1.15
import org.kde.kirigamiaddons.formcard 1.0 as FormCard import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import zone.xiv.astra 1.0 import zone.xiv.astra 1.0
FormCard.FormCard { FormCard.FormCardPage {
FormCard.FormCheckDelegate { title: i18n("General")
id: closeAstraDelegate
text: i18n("Close Astra when game is launched") FormCard.FormHeader {
checked: LauncherCore.closeWhenLaunched title: i18n("General settings")
onCheckedChanged: LauncherCore.closeWhenLaunched = checked
} }
FormCard.FormDelegateSeparator { FormCard.FormCard {
above: closeAstraDelegate FormCard.FormCheckDelegate {
below: showNewsDelegate id: closeAstraDelegate
}
FormCard.FormCheckDelegate { text: i18n("Close Astra when game is launched")
id: showNewsDelegate checked: LauncherCore.closeWhenLaunched
onCheckedChanged: LauncherCore.closeWhenLaunched = checked
}
text: i18n("Enable and show news") FormCard.FormDelegateSeparator {
checked: LauncherCore.showNews above: closeAstraDelegate
onCheckedChanged: LauncherCore.showNews = checked below: showNewsDelegate
}
FormCard.FormCheckDelegate {
id: showNewsDelegate
text: i18n("Enable and show news")
checked: LauncherCore.showNews
onCheckedChanged: LauncherCore.showNews = checked
}
} }
} }

View file

@ -0,0 +1,50 @@
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Window 2.15
import org.kde.kirigami 2.20 as Kirigami
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import zone.xiv.astra 1.0
FormCard.FormCardPage {
title: i18n("General")
FormCard.FormHeader {
title: i18n("Profiles")
}
FormCard.FormCard {
Layout.fillWidth: true
Repeater {
model: LauncherCore.profileManager
FormCard.FormButtonDelegate {
required property var profile
text: profile.name
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/ProfileSettings.qml', {
profile: profile
})
}
}
FormCard.FormDelegateSeparator {
below: addProfileButton
}
FormCard.FormButtonDelegate {
id: addProfileButton
text: i18n("Add Profile")
icon.name: "list-add"
onClicked: {
applicationWindow().currentSetupProfile = LauncherCore.profileManager.addProfile()
applicationWindow().checkSetup()
}
}
}
}

View file

@ -2,159 +2,50 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Window 2.15 import org.kde.kirigami 2.18 as Kirigami
import org.kde.kirigami 2.20 as Kirigami import org.kde.kirigamiaddons.settings 1.0 as KirigamiSettings
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import zone.xiv.astra 1.0
FormCard.FormCardPage { KirigamiSettings.CategorizedSettings {
id: page id: settingsPage
title: i18n("Settings")
FormCard.FormHeader {
title: i18n("General")
}
GeneralSettings {
Layout.fillWidth: true
}
FormCard.FormHeader {
title: i18n("Profiles")
}
FormCard.FormCard {
Layout.fillWidth: true
Repeater {
model: LauncherCore.profileManager
FormCard.FormButtonDelegate {
required property var profile
text: profile.name
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/ProfileSettings.qml', {
profile: profile
})
}
}
FormCard.FormDelegateSeparator {
below: addProfileButton
}
FormCard.FormButtonDelegate {
id: addProfileButton
text: i18n("Add Profile")
icon.name: "list-add"
onClicked: {
applicationWindow().currentSetupProfile = LauncherCore.profileManager.addProfile()
applicationWindow().checkSetup()
}
}
}
FormCard.FormHeader {
title: i18n("Accounts")
}
FormCard.FormCard {
Layout.fillWidth: true
Repeater {
model: LauncherCore.accountManager
FormCard.FormButtonDelegate {
required property var account
text: account.name
leading: Kirigami.Avatar
{
source: account.avatarUrl
}
leadingPadding: Kirigami.Units.largeSpacing * 2
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/AccountSettings.qml', {
account: account
})
}
}
FormCard.FormDelegateSeparator {
below: addSquareEnixButton
}
FormCard.FormButtonDelegate {
id: addSquareEnixButton
text: i18n("Add Square Enix Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSquareEnix.qml')
}
FormCard.FormDelegateSeparator {
above: addSquareEnixButton
below: addSapphireButton
}
FormCard.FormButtonDelegate {
id: addSapphireButton
text: i18n("Add Sapphire Account")
icon.name: "list-add-symbolic"
onClicked: pageStack.layers.push('qrc:/ui/Setup/AddSapphire.qml')
}
}
FormCard.FormCard {
Layout.fillWidth: true
FormCard.FormButtonDelegate {
id: setupCompatToolButton
text: i18n("Setup Compatibility Tool")
icon.name: "install"
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/CompatibilityToolSetup.qml')
}
FormCard.FormDelegateSeparator {
above: setupCompatToolButton
below: developerSettingsButton
}
FormCard.FormButtonDelegate {
id: developerSettingsButton
objectName: "settingsPage"
actions: [
KirigamiSettings.SettingAction {
actionName: "general"
text: i18n("General")
icon.name: "zone.xiv.astra"
page: Qt.resolvedUrl("GeneralSettings.qml")
},
KirigamiSettings.SettingAction {
actionName: "profiles"
text: i18n("Profiles")
icon.name: "preferences-desktop-gaming"
page: Qt.resolvedUrl("ProfilesPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "accounts"
text: i18n("Accounts")
icon.name: "preferences-system-users"
page: Qt.resolvedUrl("AccountsPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "compattool"
text: i18n("Compatibility Tool")
icon.name: "system-run"
page: Qt.resolvedUrl("CompatibilityToolSetup.qml")
},
KirigamiSettings.SettingAction {
actionName: "devtool"
text: i18n("Developer Settings") text: i18n("Developer Settings")
icon.name: "configure" icon.name: "preferences-others"
onClicked: applicationWindow().pageStack.layers.push('qrc:/ui/Settings/DeveloperSettings.qml') page: Qt.resolvedUrl("DeveloperSettings.qml")
} },
KirigamiSettings.SettingAction {
FormCard.FormDelegateSeparator { actionName: "about"
above: developerSettingsButton
below: aboutButton
}
FormCard.FormButtonDelegate {
id: aboutButton
text: i18n("About Astra") text: i18n("About Astra")
icon.name: "help-about-symbolic" icon.name: "help-about"
page: Qt.resolvedUrl("AboutPage.qml")
Component {
id: aboutPage
FormCard.AboutPage {
aboutData: About
}
}
onClicked: applicationWindow().pageStack.layers.push(aboutPage)
} }
} ]
} }