2019-03-21 23:28:14 -04:00
|
|
|
import QtQuick 2.7
|
2019-04-28 15:45:42 -04:00
|
|
|
import QtQuick.Layouts 1.3
|
2019-04-28 15:18:36 -04:00
|
|
|
import "../Base"
|
2019-04-14 14:09:54 -04:00
|
|
|
import "utils.js" as SidePaneJS
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-03-26 03:19:55 -04:00
|
|
|
MouseArea {
|
2019-04-28 12:40:18 -04:00
|
|
|
id: roomDelegate
|
2019-03-26 03:19:55 -04:00
|
|
|
width: roomList.width
|
2019-04-13 08:59:10 -04:00
|
|
|
height: roomList.childrenHeight
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-04-28 12:40:18 -04:00
|
|
|
onClicked: pageStack.showRoom(roomList.userId, roomId)
|
2019-03-26 03:19:55 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HRowLayout {
|
2019-03-21 23:28:14 -04:00
|
|
|
anchors.fill: parent
|
|
|
|
id: row
|
|
|
|
spacing: 1
|
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HAvatar {
|
2019-04-28 12:40:18 -04:00
|
|
|
id: roomAvatar
|
|
|
|
name: displayName
|
|
|
|
dimension: roomDelegate.height
|
|
|
|
}
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HColumnLayout {
|
|
|
|
HLabel {
|
2019-03-21 23:28:14 -04:00
|
|
|
id: roomLabel
|
2019-04-20 17:36:21 -04:00
|
|
|
text: displayName ? displayName : "<i>Empty room</i>"
|
2019-04-13 08:59:10 -04:00
|
|
|
textFormat: Text.StyledText
|
2019-03-21 23:28:14 -04:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
2019-04-28 12:40:18 -04:00
|
|
|
Layout.maximumWidth:
|
|
|
|
row.width - row.totalSpacing - roomAvatar.width
|
2019-03-21 23:28:14 -04:00
|
|
|
verticalAlignment: Qt.AlignVCenter
|
2019-03-25 18:29:46 -04:00
|
|
|
|
|
|
|
topPadding: -2
|
|
|
|
bottomPadding: subtitleLabel.visible ? 0 : topPadding
|
|
|
|
leftPadding: 5
|
|
|
|
rightPadding: leftPadding
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
2019-04-28 12:40:18 -04:00
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
HLabel {
|
2019-04-20 17:36:21 -04:00
|
|
|
function getText() {
|
2019-04-21 20:55:24 -04:00
|
|
|
return SidePaneJS.getLastRoomEventText(
|
2019-04-28 12:40:18 -04:00
|
|
|
roomId, roomList.userId
|
2019-04-21 20:55:24 -04:00
|
|
|
)
|
2019-04-14 14:32:51 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2019-04-20 17:36:21 -04:00
|
|
|
target: Backend.models.roomEvents.get(roomId)
|
|
|
|
onChanged: subtitleLabel.text = subtitleLabel.getText()
|
2019-04-14 14:32:51 -04:00
|
|
|
}
|
|
|
|
|
2019-03-21 23:28:14 -04:00
|
|
|
id: subtitleLabel
|
|
|
|
visible: text !== ""
|
2019-04-20 17:36:21 -04:00
|
|
|
text: getText()
|
2019-03-27 18:38:48 -04:00
|
|
|
textFormat: Text.StyledText
|
|
|
|
|
2019-04-28 15:18:36 -04:00
|
|
|
font.pixelSize: HStyle.fontSize.small
|
2019-03-21 23:28:14 -04:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
|
|
|
Layout.maximumWidth: roomLabel.Layout.maximumWidth
|
2019-03-25 18:29:46 -04:00
|
|
|
|
|
|
|
topPadding: -2
|
|
|
|
bottomPadding: topPadding
|
|
|
|
leftPadding: 5
|
|
|
|
rightPadding: leftPadding
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-28 15:22:53 -04:00
|
|
|
HSpacer {}
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
|
|
|
}
|