moment/src/qml/SidePane/RoomDelegate.qml

62 lines
1.6 KiB
QML
Raw Normal View History

2019-03-22 14:28:14 +11:00
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../Base"
import "utils.js" as SidePaneJS
2019-03-22 14:28:14 +11:00
MouseArea {
id: roomDelegate
width: roomList.width
height: childrenRect.height
2019-03-22 14:28:14 +11:00
onClicked: pageStack.showRoom(roomList.userId, roomList.category, roomId)
HRowLayout {
width: parent.width
spacing: roomList.spacing
2019-03-22 14:28:14 +11:00
HAvatar {
id: roomAvatar
name: displayName
}
2019-03-22 14:28:14 +11:00
HColumnLayout {
Layout.fillWidth: true
Layout.maximumWidth:
parent.width - parent.totalSpacing - roomAvatar.width
HLabel {
2019-03-22 14:28:14 +11:00
id: roomLabel
text: displayName ? displayName : "<i>Empty room</i>"
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
Layout.maximumWidth: parent.width
2019-03-22 14:28:14 +11:00
}
HLabel {
function getText() {
2019-04-22 10:55:24 +10:00
return SidePaneJS.getLastRoomEventText(
roomId, roomList.userId
2019-04-22 10:55:24 +10:00
)
}
property var lastEvTime: lastEventDateTime
onLastEvTimeChanged: subtitleLabel.text = getText()
2019-03-22 14:28:14 +11:00
id: subtitleLabel
visible: text !== ""
text: getText()
textFormat: Text.StyledText
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
Layout.maximumWidth: parent.width
2019-03-22 14:28:14 +11:00
}
}
}
}