2019-03-22 14:28:14 +11:00
|
|
|
import QtQuick 2.7
|
2019-04-29 05:45:42 +10:00
|
|
|
import QtQuick.Layouts 1.3
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../Base"
|
2019-04-15 04:09:54 +10:00
|
|
|
import "utils.js" as SidePaneJS
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-03-26 18:19:55 +11:00
|
|
|
MouseArea {
|
2019-04-29 02:40:18 +10:00
|
|
|
id: roomDelegate
|
2019-03-26 18:19:55 +11:00
|
|
|
width: roomList.width
|
2019-05-03 04:20:21 +10:00
|
|
|
height: childrenRect.height
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
onClicked: pageStack.showRoom(roomList.userId, roomList.category, roomId)
|
2019-03-26 18:19:55 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRowLayout {
|
2019-05-03 04:20:21 +10:00
|
|
|
width: parent.width
|
|
|
|
spacing: roomList.spacing
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HAvatar {
|
2019-04-29 02:40:18 +10:00
|
|
|
id: roomAvatar
|
|
|
|
name: displayName
|
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HColumnLayout {
|
2019-05-03 04:20:21 +10:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.maximumWidth:
|
|
|
|
parent.width - parent.totalSpacing - roomAvatar.width
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-03-22 14:28:14 +11:00
|
|
|
id: roomLabel
|
2019-04-21 07:36:21 +10:00
|
|
|
text: displayName ? displayName : "<i>Empty room</i>"
|
2019-04-13 22:59:10 +10:00
|
|
|
textFormat: Text.StyledText
|
2019-03-22 14:28:14 +11:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
Layout.maximumWidth: parent.width
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
2019-04-29 02:40:18 +10:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-04-21 07:36:21 +10:00
|
|
|
function getText() {
|
2019-04-22 10:55:24 +10:00
|
|
|
return SidePaneJS.getLastRoomEventText(
|
2019-04-29 02:40:18 +10:00
|
|
|
roomId, roomList.userId
|
2019-04-22 10:55:24 +10:00
|
|
|
)
|
2019-04-15 04:32:51 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2019-05-03 04:31:47 +10:00
|
|
|
target: Backend.roomEvents.get(roomId)
|
2019-04-21 07:36:21 +10:00
|
|
|
onChanged: subtitleLabel.text = subtitleLabel.getText()
|
2019-04-15 04:32:51 +10:00
|
|
|
}
|
|
|
|
|
2019-03-22 14:28:14 +11:00
|
|
|
id: subtitleLabel
|
|
|
|
visible: text !== ""
|
2019-04-21 07:36:21 +10:00
|
|
|
text: getText()
|
2019-03-28 09:38:48 +11:00
|
|
|
textFormat: Text.StyledText
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
font.pixelSize: HStyle.fontSize.small
|
2019-03-22 14:28:14 +11:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-05-03 04:20:21 +10:00
|
|
|
Layout.maximumWidth: parent.width
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|