1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00

Improve look and spacing of login, accounts, and profiles pages

This commit is contained in:
Joshua Goins 2023-10-08 20:24:35 -04:00
parent 24f256338d
commit 77a85fcafc
10 changed files with 72 additions and 22 deletions

View file

@ -37,7 +37,8 @@ public:
Q_INVOKABLE bool canDelete(Account *account) const; Q_INVOKABLE bool canDelete(Account *account) const;
Q_INVOKABLE void deleteAccount(Account *account); Q_INVOKABLE void deleteAccount(Account *account);
Q_INVOKABLE bool hasAnyAccounts() const; Q_INVOKABLE [[nodiscard]] bool hasAnyAccounts() const;
Q_INVOKABLE [[nodiscard]] int numAccounts() const;
private: private:
void insertAccount(Account *account); void insertAccount(Account *account);

View file

@ -37,6 +37,7 @@ public:
Q_INVOKABLE void deleteProfile(Profile *profile); Q_INVOKABLE void deleteProfile(Profile *profile);
[[nodiscard]] QVector<Profile *> profiles() const; [[nodiscard]] QVector<Profile *> profiles() const;
[[nodiscard]] Q_INVOKABLE int numProfiles() const;
Q_INVOKABLE bool canDelete(Profile *account) const; Q_INVOKABLE bool canDelete(Profile *account) const;

View file

@ -116,3 +116,8 @@ bool AccountManager::hasAnyAccounts() const
{ {
return !m_accounts.empty(); return !m_accounts.empty();
} }
int AccountManager::numAccounts() const
{
return m_accounts.count();
}

View file

@ -158,3 +158,8 @@ bool ProfileManager::hasAnyExistingInstallations() const
return false; return false;
} }
int ProfileManager::numProfiles() const
{
return m_profiles.count();
}

View file

@ -20,7 +20,11 @@ FormCard.AbstractFormDelegate {
onClicked: dialog.open() onClicked: dialog.open()
contentItem: RowLayout { contentItem: RowLayout {
spacing: Kirigami.Units.mediumSpacing
ColumnLayout { ColumnLayout {
spacing: Kirigami.Units.mediumSpacing
Layout.fillWidth: true Layout.fillWidth: true
QQC2.Label { QQC2.Label {

View file

@ -99,7 +99,11 @@ QQC2.Control {
contentItem: ColumnLayout { contentItem: ColumnLayout {
width: parent.width width: parent.width
spacing: Kirigami.Units.largeSpacing
FormCard.FormCard { FormCard.FormCard {
maximumWidth: Kirigami.Units.gridUnit * 25
Layout.fillWidth: true Layout.fillWidth: true
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
@ -132,6 +136,8 @@ QQC2.Control {
} }
FormCard.FormCard { FormCard.FormCard {
maximumWidth: Kirigami.Units.gridUnit * 25
Layout.fillWidth: true Layout.fillWidth: true
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
@ -255,6 +261,8 @@ QQC2.Control {
} }
FormCard.FormCard { FormCard.FormCard {
maximumWidth: Kirigami.Units.gridUnit * 25
Layout.fillWidth: true Layout.fillWidth: true
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {

View file

@ -24,6 +24,8 @@ Kirigami.Page {
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
spacing: Kirigami.Units.largeSpacing
Loader { Loader {
active: LauncherCore.showNews active: LauncherCore.showNews
@ -44,7 +46,7 @@ Kirigami.Page {
id: loginPage id: loginPage
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.minimumWidth: LauncherCore.showNews ? Kirigami.Units.gridUnit * 25 : 0 Layout.minimumWidth: LauncherCore.showNews ? Kirigami.Units.gridUnit * 26 : 0
Layout.fillWidth: !LauncherCore.showNews Layout.fillWidth: !LauncherCore.showNews
} }
} }

View file

@ -50,6 +50,8 @@ QQC2.Control {
readonly property real maximumWidth: Kirigami.Units.gridUnit * 50 readonly property real maximumWidth: Kirigami.Units.gridUnit * 50
spacing: Kirigami.Units.largeSpacing
Image { Image {
id: bannerImage id: bannerImage

View file

@ -23,9 +23,13 @@ FormCard.FormCardPage {
Repeater { Repeater {
model: LauncherCore.accountManager model: LauncherCore.accountManager
FormCard.FormButtonDelegate { ColumnLayout {
required property var account required property var account
required property int index
spacing: 0
FormCard.FormButtonDelegate {
text: account.name text: account.name
leading: Components.Avatar { leading: Components.Avatar {
@ -38,11 +42,17 @@ FormCard.FormCardPage {
account: account account: account
}) })
} }
}
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
below: addSquareEnixButton visible: index + 1 < LauncherCore.accountManager.numAccounts()
} }
}
}
}
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: addSquareEnixButton id: addSquareEnixButton

View file

@ -22,19 +22,31 @@ FormCard.FormCardPage {
Repeater { Repeater {
model: LauncherCore.profileManager model: LauncherCore.profileManager
FormCard.FormButtonDelegate { ColumnLayout {
required property var profile required property var profile
required property int index
spacing: 0
FormCard.FormButtonDelegate {
id: buttonDelegate
text: profile.name text: profile.name
onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), { onClicked: page.Window.window.pageStack.layers.push(Qt.createComponent("zone.xiv.astra", "ProfileSettings"), {
profile: profile profile: profile
}) })
} }
}
FormCard.FormDelegateSeparator { FormCard.FormDelegateSeparator {
below: addProfileButton visible: index + 1 < LauncherCore.profileManager.numProfiles()
} }
}
}
}
FormCard.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormButtonDelegate { FormCard.FormButtonDelegate {
id: addProfileButton id: addProfileButton