From 6228ba7e16058a4dc9db37b69f7f79d463fd1abd Mon Sep 17 00:00:00 2001 From: cutefishd Date: Sun, 18 Apr 2021 16:20:19 +0800 Subject: [PATCH] Perfect user page UI --- src/qml/AccountsPage.qml | 29 ++++++++++++--------------- src/qml/AppearancePage.qml | 7 ++++++- src/qml/DisplayPage.qml | 8 ++++++-- src/qml/SideBar.qml | 9 +++++---- src/qml/UserPage/UserDelegateItem.qml | 29 ++++++++++----------------- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/qml/AccountsPage.qml b/src/qml/AccountsPage.qml index f53ad33..d149b73 100644 --- a/src/qml/AccountsPage.qml +++ b/src/qml/AccountsPage.qml @@ -31,14 +31,14 @@ ItemPage { ColumnLayout { id: layout anchors.fill: parent + spacing: FishUI.Units.largeSpacing RoundedItem { - ListView { id: _userView model: userModel Layout.fillWidth: true - spacing: FishUI.Units.largeSpacing + spacing: FishUI.Units.largeSpacing * 2 interactive: false Layout.preferredHeight: { @@ -46,7 +46,7 @@ ItemPage { for (var i = 0; i < _userView.visibleChildren.length; ++i) { totalHeight += _userView.visibleChildren[i].height } - totalHeight += (_userView.count - 1) * _userView.spacing + // totalHeight += (_userView.count - 1) * _userView.spacing return totalHeight } @@ -56,20 +56,17 @@ ItemPage { width: _userView.width } } + } - Item { - height: FishUI.Units.smallSpacing - } - - Button { - id: _addUserButton - text: qsTr("Add user") - onClicked: { - var component = Qt.createComponent("AddUserDialog.qml") - if (component.status === Component.Ready) { - var dialog = component.createObject(rootWindow) - dialog.open() - } + Button { + id: _addUserButton + text: qsTr("Add user") + Layout.fillWidth: true + onClicked: { + var component = Qt.createComponent("AddUserDialog.qml") + if (component.status === Component.Ready) { + var dialog = component.createObject(rootWindow) + dialog.open() } } } diff --git a/src/qml/AppearancePage.qml b/src/qml/AppearancePage.qml index 3c9665d..98daace 100644 --- a/src/qml/AppearancePage.qml +++ b/src/qml/AppearancePage.qml @@ -191,7 +191,8 @@ ItemPage { rows: 3 columns: 2 - columnSpacing: FishUI.Units.largeSpacing * 2 + columnSpacing: FishUI.Units.largeSpacing * 1.5 + rowSpacing: FishUI.Units.largeSpacing Label { text: qsTr("General Font") @@ -203,6 +204,8 @@ ItemPage { model: fontsModel.generalFonts enabled: true Layout.fillWidth: true + topInset: 0 + bottomInset: 0 onActivated: appearance.setGenericFontFamily(currentText) } @@ -216,6 +219,8 @@ ItemPage { model: fontsModel.fixedFonts enabled: true Layout.fillWidth: true + topInset: 0 + bottomInset: 0 onActivated: appearance.setFixedFontFamily(currentText) } diff --git a/src/qml/DisplayPage.qml b/src/qml/DisplayPage.qml index a3ad007..11f4594 100644 --- a/src/qml/DisplayPage.qml +++ b/src/qml/DisplayPage.qml @@ -125,8 +125,8 @@ ItemPage { GridLayout { columns: 2 - columnSpacing: FishUI.Units.largeSpacing - rowSpacing: FishUI.Units.smallSpacing + columnSpacing: FishUI.Units.largeSpacing * 1.5 + rowSpacing: FishUI.Units.largeSpacing Label { text: qsTr("Resolution") @@ -135,6 +135,8 @@ ItemPage { ComboBox { Layout.fillWidth: true model: element.resolutions + topInset: 0 + bottomInset: 0 currentIndex: element.resolutionIndex !== undefined ? element.resolutionIndex : -1 onActivated: { @@ -151,6 +153,8 @@ ItemPage { id: refreshRate Layout.fillWidth: true model: element.refreshRates + topInset: 0 + bottomInset: 0 currentIndex: element.refreshRateIndex ? element.refreshRateIndex : 0 onActivated: { diff --git a/src/qml/SideBar.qml b/src/qml/SideBar.qml index 9be7aa8..c01e1db 100644 --- a/src/qml/SideBar.qml +++ b/src/qml/SideBar.qml @@ -144,10 +144,11 @@ Item { } radius: FishUI.Theme.mediumRadius - color: mouseArea.containsMouse ? Qt.rgba(FishUI.Theme.textColor.r, - FishUI.Theme.textColor.g, - FishUI.Theme.textColor.b, - 0.1) : "transparent" + color: mouseArea.containsMouse && !isCurrent ? Qt.rgba(FishUI.Theme.textColor.r, + FishUI.Theme.textColor.g, + FishUI.Theme.textColor.b, + 0.1) : "transparent" + smooth: true } diff --git a/src/qml/UserPage/UserDelegateItem.qml b/src/qml/UserPage/UserDelegateItem.qml index a4684a6..d8b004a 100644 --- a/src/qml/UserPage/UserDelegateItem.qml +++ b/src/qml/UserPage/UserDelegateItem.qml @@ -63,6 +63,12 @@ Item { source: iconFileName ? "file:///" + iconFileName : "image://icontheme/default-user" visible: status === Image.Ready + MouseArea { + anchors.fill: parent + onClicked: fileDialog.open() + cursorShape: Qt.PointingHandCursor + } + layer.enabled: true layer.effect: OpacityMask { maskSource: Item { @@ -120,33 +126,22 @@ Item { } } } - } } - - Item { - height: FishUI.Units.largeSpacing } Hideable { id: additionalSettings + Item { + height: FishUI.Units.largeSpacing + } + GridLayout { Layout.fillWidth: true Layout.bottomMargin: FishUI.Units.smallSpacing rowSpacing: FishUI.Units.largeSpacing columns: 2 - Label { - text: qsTr("Avatar") - Layout.fillWidth: true - } - - Button { - text: qsTr("Choose") - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - onClicked: fileDialog.open() - } - Label { text: qsTr("Automatic login") Layout.fillWidth: true @@ -158,7 +153,6 @@ Item { leftPadding: 0 rightPadding: 0 onCheckedChanged: currentUser.automaticLogin = checked - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Component.onCompleted: { @@ -171,9 +165,8 @@ Item { text: qsTr("Delete this user") enabled: model.userId !== loggedUser.userId onClicked: accountsManager.deleteUser(userId, true) + Layout.fillWidth: true } - - HorizontalDivider {} } } }