Bring back account collapsing UI stuff

Not functional yet
This commit is contained in:
miruka 2020-05-13 14:16:37 -04:00
parent bd3c78a73a
commit 7192a402b6
2 changed files with 59 additions and 2 deletions

View File

@ -9,10 +9,14 @@ HTileDelegate {
id: account id: account
backgroundColor: theme.mainPane.listView.account.background backgroundColor: theme.mainPane.listView.account.background
leftPadding: theme.spacing leftPadding: theme.spacing
rightPadding: 0 // the "add chat" button has padding rightPadding: 0 // the right buttons have padding
contentItem: ContentRow { contentItem: ContentRow {
tile: account tile: account
spacing: 0
opacity: collapsed ? theme.mainPane.listView.account.collapsedOpacity : 1
Behavior on opacity { HNumberAnimation {} }
HUserAvatar { HUserAvatar {
id: avatar id: avatar
@ -33,6 +37,8 @@ HTileDelegate {
theme.mainPane.listView.account.name theme.mainPane.listView.account.name
Behavior on color { HColorAnimation {} } Behavior on color { HColorAnimation {} }
Layout.leftMargin: theme.spacing
} }
HButton { HButton {
@ -45,6 +51,9 @@ HTileDelegate {
"AddChat/AddChat", {userId: model.id}, "AddChat/AddChat", {userId: model.id},
) )
leftPadding: theme.spacing
rightPadding: theme.spacing / 1.75
Layout.fillHeight: true Layout.fillHeight: true
Layout.maximumWidth: Layout.maximumWidth:
account.width >= 100 * theme.uiScale ? implicitWidth : 0 account.width >= 100 * theme.uiScale ? implicitWidth : 0
@ -55,6 +64,36 @@ HTileDelegate {
onActivated: addChat.clicked() 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 } contextMenu: AccountContextMenu { userId: model.id }
@ -67,6 +106,21 @@ HTileDelegate {
property bool isCurrent: false 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 { HShortcut {

View File

@ -15,7 +15,10 @@ HListView {
DelegateChoice { DelegateChoice {
roleValue: "Account" roleValue: "Account"
Account { width: roomList.width } Account {
width: roomList.width
filterActive: Boolean(filter)
}
} }
DelegateChoice { DelegateChoice {