moment/src/qml/Chat/RoomSidePane/MembersView.qml

61 lines
1.5 KiB
QML
Raw Normal View History

2019-07-08 13:52:41 +10:00
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
2019-05-13 03:17:42 +10:00
import QtQuick 2.7
import QtQuick.Layouts 1.3
2019-07-07 19:25:03 +10:00
import SortFilterProxyModel 0.2
2019-05-13 03:17:42 +10:00
import "../../Base"
2019-07-07 19:49:02 +10:00
import "../../utils.js" as Utils
2019-05-13 03:17:42 +10:00
HColumnLayout {
2019-05-18 05:46:49 +10:00
property bool collapsed: false
property int normalSpacing: collapsed ? 0 : 8
Behavior on normalSpacing { HNumberAnimation {} }
2019-05-13 03:17:42 +10:00
2019-05-14 03:15:03 +10:00
HListView {
2019-05-13 03:17:42 +10:00
id: memberList
spacing: normalSpacing
2019-05-18 05:46:49 +10:00
topMargin: normalSpacing
bottomMargin: normalSpacing
Layout.leftMargin: normalSpacing
Layout.rightMargin: normalSpacing
2019-05-13 03:17:42 +10:00
2019-07-07 19:25:03 +10:00
model: HListModel {
sourceModel: chatPage.roomInfo.members
proxyRoles: ExpressionRole {
name: "displayName"
2019-07-08 12:41:32 +10:00
expression: users.find(userId).displayName || userId
2019-07-07 19:25:03 +10:00
}
sorters: StringSorter {
roleName: "displayName"
}
2019-07-07 19:49:02 +10:00
filters: ExpressionFilter {
function filterIt(filter, text) {
return Utils.filterMatches(filter, text)
}
expression: filterIt(filterField.text, displayName)
}
2019-07-07 19:25:03 +10:00
}
2019-05-13 03:17:42 +10:00
delegate: MemberDelegate {}
Layout.fillWidth: true
Layout.fillHeight: true
2019-05-13 03:17:42 +10:00
}
HTextField {
id: filterField
placeholderText: qsTr("Filter members")
backgroundColor: theme.sidePane.filterRooms.background
Layout.fillWidth: true
Layout.preferredHeight: theme.bottomElementsHeight
}
2019-05-13 03:17:42 +10:00
}