From 02d09f405a12a1096d09e8a75fbe870d7c8b8c22 Mon Sep 17 00:00:00 2001 From: miruka Date: Thu, 12 Mar 2020 23:17:23 -0400 Subject: [PATCH] Improve MainPane when reduced to minimumSize --- src/gui/MainPane/Account.qml | 19 +++++++++++++++++++ src/gui/MainPane/AccountRoomsList.qml | 8 +++++++- src/gui/MainPane/MainPane.qml | 12 ++++++++++-- src/gui/MainPane/Room.qml | 16 ++++++++++++++++ src/gui/MainPane/TopBar.qml | 1 + .../Pages/Chat/RoomPane/MemberDelegate.qml | 1 - src/themes/Glass.qpl | 3 ++- src/themes/Midnight.qpl | 3 ++- 8 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/gui/MainPane/Account.qml b/src/gui/MainPane/Account.qml index 295d3e0b..da77ffae 100644 --- a/src/gui/MainPane/Account.qml +++ b/src/gui/MainPane/Account.qml @@ -23,6 +23,9 @@ HTileDelegate { userId: model.id displayName: model.display_name mxc: model.avatar_url + rotation: mainPane.small ? -45 : 0 + + Behavior on rotation { HNumberAnimation {} } } contextMenu: HMenu { @@ -69,7 +72,23 @@ HTileDelegate { Behavior on title.color { HColorAnimation {} } Behavior on opacity { HNumberAnimation {} } + Behavior on leftPadding { HNumberAnimation {} } + Behavior on topPadding { HNumberAnimation {} } + Binding on leftPadding { + value: (mainPane.minimumSize - loadedImage.width) / 2 + when: mainPane.small + } + + Binding on topPadding { + value: theme.spacing + when: mainPane.small + } + + Binding on bottomPadding { + value: theme.spacing + when: mainPane.small + } HRowLayout { HButton { diff --git a/src/gui/MainPane/AccountRoomsList.qml b/src/gui/MainPane/AccountRoomsList.qml index 95e77dfe..f7ad7e48 100644 --- a/src/gui/MainPane/AccountRoomsList.qml +++ b/src/gui/MainPane/AccountRoomsList.qml @@ -7,6 +7,7 @@ import "../Base" HListView { id: mainPaneList model: ModelStore.get("accounts") + spacing: mainPane.small ? theme.spacing : 0 delegate: AccountRoomsDelegate { width: mainPaneList.width @@ -32,10 +33,14 @@ HListView { currentItem.roomList.currentItem.height : currentItem.account.height - color: theme.controls.listView.highlight + color: + mainPane.small ? + theme.controls.listView.smallPaneHighlight : + theme.controls.listView.highlight Behavior on y { HNumberAnimation { id: yAnimation } } Behavior on height { HNumberAnimation {} } + Behavior on color { HColorAnimation {} } Binding { target: mainPaneList @@ -69,6 +74,7 @@ HListView { model.findIndex(window.uiState.pageProperties.userId) : null + function previous() { detachedCurrentIndex = true diff --git a/src/gui/MainPane/MainPane.qml b/src/gui/MainPane/MainPane.qml index 38935fc4..22c611c6 100644 --- a/src/gui/MainPane/MainPane.qml +++ b/src/gui/MainPane/MainPane.qml @@ -8,16 +8,22 @@ HDrawer { id: mainPane saveName: "mainPane" color: theme.mainPane.background - minimumSize: theme.controls.avatar.size + theme.spacing * 2 + minimumSize: bottomBar.addAccountButton.width onHasFocusChanged: if (! hasFocus) mainPaneList.detachedCurrentIndex = false + + property alias filter: bottomBar.roomFilter + + readonly property bool small: + width < theme.controls.avatar.size + theme.spacing * 2 + readonly property bool hasFocus: bottomBar.filterField.activeFocus readonly property alias mainPaneList: mainPaneList + readonly property alias topBar: topBar readonly property alias bottomBar: bottomBar - property alias filter: bottomBar.roomFilter function toggleFocus() { @@ -46,6 +52,8 @@ HDrawer { anchors.fill: parent TopBar { + id: topBar + Layout.fillWidth: true Layout.fillHeight: false Layout.preferredHeight: theme.baseElementsHeight diff --git a/src/gui/MainPane/Room.qml b/src/gui/MainPane/Room.qml index 91690846..4689edf6 100644 --- a/src/gui/MainPane/Room.qml +++ b/src/gui/MainPane/Room.qml @@ -158,4 +158,20 @@ HTileDelegate { Behavior on opacity { HNumberAnimation {} } + Behavior on leftPadding { HNumberAnimation {} } + + Binding on leftPadding { + value: (mainPane.minimumSize - loadedImage.width) / 2 + when: mainPane.small + } + + Binding on topPadding { + value: leftPadding / 2 + when: mainPane.small + } + + Binding on bottomPadding { + value: leftPadding / 2 + when: mainPane.small + } } diff --git a/src/gui/MainPane/TopBar.qml b/src/gui/MainPane/TopBar.qml index 3b9ef0f5..b2903ab5 100644 --- a/src/gui/MainPane/TopBar.qml +++ b/src/gui/MainPane/TopBar.qml @@ -5,6 +5,7 @@ import QtQuick.Layouts 1.12 import "../Base" Rectangle { + clip: true color: theme.mainPane.topBar.background HRowLayout { diff --git a/src/gui/Pages/Chat/RoomPane/MemberDelegate.qml b/src/gui/Pages/Chat/RoomPane/MemberDelegate.qml index 4104a58b..19cc9482 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberDelegate.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberDelegate.qml @@ -42,7 +42,6 @@ HTileDelegate { Behavior on spacing { HNumberAnimation {} } Binding on spacing { - id: spacebind value: (roomPane.minimumSize - loadedImage.width) / 2 when: loadedImage && roomPane.width < loadedImage.width + theme.spacing * 2 diff --git a/src/themes/Glass.qpl b/src/themes/Glass.qpl index ececcfe8..d0312748 100644 --- a/src/themes/Glass.qpl +++ b/src/themes/Glass.qpl @@ -156,7 +156,8 @@ controls: color subtitle: colors.dimText listView: - color highlight: colors.strongBackground + color highlight: colors.strongBackground + color smallPaneHighlight: colors.accentBackground textField: color background: colors.strongBackground diff --git a/src/themes/Midnight.qpl b/src/themes/Midnight.qpl index 87d332cf..c3743996 100644 --- a/src/themes/Midnight.qpl +++ b/src/themes/Midnight.qpl @@ -156,7 +156,8 @@ controls: color subtitle: colors.dimText listView: - color highlight: colors.strongBackground + color highlight: colors.strongBackground + color smallPaneHighlight: colors.accentBackground textField: color background: colors.strongBackground