diff --git a/src/gui/MainPane/Account.qml b/src/gui/MainPane/Account.qml index 3b5725cb..b15fcc86 100644 --- a/src/gui/MainPane/Account.qml +++ b/src/gui/MainPane/Account.qml @@ -9,10 +9,14 @@ HTileDelegate { id: account backgroundColor: theme.mainPane.listView.account.background leftPadding: theme.spacing - rightPadding: 0 // the "add chat" button has padding + rightPadding: 0 // the right buttons have padding contentItem: ContentRow { tile: account + spacing: 0 + opacity: collapsed ? theme.mainPane.listView.account.collapsedOpacity : 1 + + Behavior on opacity { HNumberAnimation {} } HUserAvatar { id: avatar @@ -33,6 +37,8 @@ HTileDelegate { theme.mainPane.listView.account.name Behavior on color { HColorAnimation {} } + + Layout.leftMargin: theme.spacing } HButton { @@ -45,6 +51,9 @@ HTileDelegate { "AddChat/AddChat", {userId: model.id}, ) + leftPadding: theme.spacing + rightPadding: theme.spacing / 1.75 + Layout.fillHeight: true Layout.maximumWidth: account.width >= 100 * theme.uiScale ? implicitWidth : 0 @@ -55,6 +64,36 @@ HTileDelegate { onActivated: addChat.clicked() } } + + HButton { + id: expand + iconItem.small: true + icon.name: "expand" + backgroundColor: "transparent" + toolTip.text: collapsed ? qsTr("Expand") : qsTr("Collapse") + onClicked: account.toggleCollapse() + + leftPadding: theme.spacing / 1.75 + rightPadding: theme.spacing + + visible: Layout.maximumWidth > 0 + + Layout.fillHeight: true + Layout.maximumWidth: + ! filterActive && account.width >= 120 * theme.uiScale ? + implicitWidth : + 0 + + iconItem.transform: Rotation { + origin.x: expand.iconItem.width / 2 + origin.y: expand.iconItem.height / 2 + angle: expand.loading ? 0 : collapsed ? 180 : 90 + + Behavior on angle { HNumberAnimation {} } + } + + Behavior on Layout.maximumWidth { HNumberAnimation {} } + } } contextMenu: AccountContextMenu { userId: model.id } @@ -67,6 +106,21 @@ HTileDelegate { property bool isCurrent: false + property bool filterActive: false + + readonly property bool collapsed: + (window.uiState.collapseAccounts[model.id] || false) && + ! filterActive + + + function setCollapse(collapse) { + window.uiState.collapseAccounts[model.id] = collapse + window.uiStateChanged() + } + + function toggleCollapse() { + setCollapse(! collapsed) + } HShortcut { diff --git a/src/gui/MainPane/RoomList.qml b/src/gui/MainPane/RoomList.qml index 15d66fec..7af9b46e 100644 --- a/src/gui/MainPane/RoomList.qml +++ b/src/gui/MainPane/RoomList.qml @@ -15,7 +15,10 @@ HListView { DelegateChoice { roleValue: "Account" - Account { width: roomList.width } + Account { + width: roomList.width + filterActive: Boolean(filter) + } } DelegateChoice {