2019-07-08 13:52:41 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../Base"
|
2019-04-21 20:56:59 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
Column {
|
|
|
|
id: roomCategoryDelegate
|
|
|
|
width: roomCategoriesList.width
|
2019-05-07 11:37:34 +10:00
|
|
|
|
|
|
|
property int normalHeight: childrenRect.height // avoid binding loop
|
|
|
|
|
2019-05-18 05:39:00 +10:00
|
|
|
opacity: roomList.model.count > 0 ? 1 : 0
|
|
|
|
height: normalHeight * opacity
|
|
|
|
visible: opacity > 0
|
|
|
|
|
2019-07-07 07:42:04 +10:00
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
2019-04-21 20:56:59 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
property string roomListUserId: userId
|
|
|
|
property bool expanded: true
|
2019-04-21 20:56:59 +10:00
|
|
|
|
2019-07-21 23:35:52 +10:00
|
|
|
Component.onCompleted: {
|
|
|
|
if (! window.uiState.collapseCategories[model.userId]) {
|
|
|
|
window.uiState.collapseCategories[model.userId] = {}
|
|
|
|
window.uiStateChanged()
|
|
|
|
}
|
|
|
|
|
|
|
|
expanded = !window.uiState.collapseCategories[model.userId][model.name]
|
|
|
|
}
|
|
|
|
|
|
|
|
onExpandedChanged: {
|
|
|
|
window.uiState.collapseCategories[model.userId][model.name] = !expanded
|
|
|
|
window.uiStateChanged()
|
|
|
|
}
|
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
HRowLayout {
|
|
|
|
width: parent.width
|
2019-04-21 20:56:59 +10:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
HLabel {
|
|
|
|
id: roomCategoryLabel
|
2019-07-21 23:35:52 +10:00
|
|
|
text: model.name
|
2019-05-03 04:20:21 +10:00
|
|
|
font.weight: Font.DemiBold
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
Layout.leftMargin: sidePane.currentSpacing
|
2019-05-03 04:20:21 +10:00
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
2019-05-07 10:37:41 +10:00
|
|
|
ExpandButton {
|
|
|
|
expandableItem: roomCategoryDelegate
|
2019-05-17 05:53:17 +10:00
|
|
|
iconDimension: 12
|
2019-05-03 04:20:21 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RoomList {
|
|
|
|
id: roomList
|
|
|
|
visible: height > 0
|
|
|
|
width: roomCategoriesList.width - accountList.Layout.leftMargin
|
2019-05-18 05:39:00 +10:00
|
|
|
opacity: roomCategoryDelegate.expanded ? 1 : 0
|
|
|
|
height: childrenRect.height * opacity
|
|
|
|
clip: listHeightAnimation.running
|
2019-05-03 04:20:21 +10:00
|
|
|
|
|
|
|
userId: roomListUserId
|
|
|
|
category: name
|
|
|
|
|
2019-05-18 05:39:00 +10:00
|
|
|
Behavior on opacity {
|
2019-07-07 07:42:04 +10:00
|
|
|
HNumberAnimation { id: listHeightAnimation }
|
2019-05-03 04:20:21 +10:00
|
|
|
}
|
|
|
|
}
|
2019-04-21 20:56:59 +10:00
|
|
|
}
|