Add a basic member list pane to rooms
This commit is contained in:
37
harmonyqml/components/Chat/RoomSidePane/MemberDelegate.qml
Normal file
37
harmonyqml/components/Chat/RoomSidePane/MemberDelegate.qml
Normal file
@@ -0,0 +1,37 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
import "../../Base"
|
||||
|
||||
MouseArea {
|
||||
id: memberDelegate
|
||||
width: memberList.width
|
||||
height: childrenRect.height
|
||||
|
||||
property var member: Backend.users.get(modelData)
|
||||
|
||||
HRowLayout {
|
||||
width: parent.width
|
||||
spacing: memberList.spacing
|
||||
|
||||
HAvatar {
|
||||
id: memberAvatar
|
||||
name: member.displayName.value
|
||||
}
|
||||
|
||||
HColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth:
|
||||
parent.width - parent.totalSpacing - memberAvatar.width
|
||||
|
||||
HLabel {
|
||||
id: memberName
|
||||
text: member.displayName.value
|
||||
elide: Text.ElideRight
|
||||
maximumLineCount: 1
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
|
||||
Layout.maximumWidth: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
harmonyqml/components/Chat/RoomSidePane/MembersView.qml
Normal file
30
harmonyqml/components/Chat/RoomSidePane/MembersView.qml
Normal file
@@ -0,0 +1,30 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
import "../../Base"
|
||||
|
||||
Column {
|
||||
property int normalSpacing: 8
|
||||
property bool collapsed:
|
||||
width < roomSidePane.Layout.minimumWidth + normalSpacing
|
||||
|
||||
leftPadding: collapsed ? 0 : normalSpacing
|
||||
rightPadding: leftPadding
|
||||
|
||||
ListView {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
id: memberList
|
||||
|
||||
spacing: collapsed ? 0 : normalSpacing
|
||||
topMargin: spacing
|
||||
bottomMargin: topMargin
|
||||
|
||||
Behavior on spacing {
|
||||
NumberAnimation { duration: 150 }
|
||||
}
|
||||
|
||||
model: chatPage.roomInfo.members
|
||||
delegate: MemberDelegate {}
|
||||
}
|
||||
}
|
16
harmonyqml/components/Chat/RoomSidePane/RoomSidePane.qml
Normal file
16
harmonyqml/components/Chat/RoomSidePane/RoomSidePane.qml
Normal file
@@ -0,0 +1,16 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3
|
||||
import "../../Base"
|
||||
|
||||
HRectangle {
|
||||
id: roomSidePane
|
||||
|
||||
HColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
MembersView {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user