2019-12-03 07:29:29 +11:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
2020-02-04 07:19:42 +11:00
|
|
|
import SortFilterProxyModel 0.2
|
2019-12-03 07:29:29 +11:00
|
|
|
import ".."
|
|
|
|
import "../Base"
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: delegate
|
2020-02-04 07:19:42 +11:00
|
|
|
// visible: account.opacity > 0
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
|
|
|
|
property string userId: model.id
|
|
|
|
readonly property HListView view: ListView.view
|
2020-02-04 07:19:42 +11:00
|
|
|
readonly property bool hide:
|
|
|
|
mainPane.filter &&
|
|
|
|
roomList.model.count < 1 &&
|
|
|
|
! utils.filterMatches(mainPane.filter, model.display_name)
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-13 08:58:24 +11:00
|
|
|
readonly property alias account: account
|
|
|
|
readonly property alias collapsed: account.collapsed
|
|
|
|
readonly property alias roomList: roomList
|
|
|
|
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
Account {
|
|
|
|
id: account
|
|
|
|
width: parent.width
|
|
|
|
view: delegate.view
|
2020-02-04 07:19:42 +11:00
|
|
|
|
|
|
|
opacity: hide ?
|
|
|
|
0 :
|
|
|
|
collapsed && ! mainPane.filter ?
|
|
|
|
theme.mainPane.account.collapsedOpacity :
|
|
|
|
1
|
|
|
|
scale: hide ? opacity : 1
|
|
|
|
height: implicitHeight * (hide ? opacity : 1)
|
|
|
|
|
|
|
|
Behavior on opacity { HNumberAnimation {} }
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
HListView {
|
|
|
|
id: roomList
|
|
|
|
width: parent.width
|
2020-02-04 07:19:42 +11:00
|
|
|
height: hide ? 0 : contentHeight
|
|
|
|
visible: ! hide
|
2019-12-03 07:29:29 +11:00
|
|
|
interactive: false
|
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
model: SortFilterProxyModel {
|
|
|
|
sourceModel: ModelStore.get(delegate.userId, "rooms")
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
filters: [
|
|
|
|
ExpressionFilter {
|
|
|
|
expression: ! account.collapsed
|
|
|
|
enabled: ! mainPane.filter
|
|
|
|
},
|
2019-12-03 07:29:29 +11:00
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
ExpressionFilter {
|
|
|
|
expression: utils.filterMatches(
|
|
|
|
mainPane.filter, model.display_name,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-12-03 07:29:29 +11:00
|
|
|
|
|
|
|
delegate: Room {
|
|
|
|
width: roomList.width
|
|
|
|
userId: delegate.userId
|
|
|
|
}
|
|
|
|
|
2020-02-13 08:58:24 +11:00
|
|
|
highlight: null // managed by the AccountRoomsList
|
|
|
|
|
2020-02-04 07:19:42 +11:00
|
|
|
Behavior on height { HNumberAnimation {} }
|
2019-12-03 07:29:29 +11:00
|
|
|
}
|
|
|
|
}
|