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-07-04 12:31:29 +10:00
|
|
|
import "../utils.js" as Utils
|
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-07-04 12:31:29 +10:00
|
|
|
onClicked:
|
|
|
|
pageStack.showRoom(roomList.userId, roomList.category, model.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
|
2019-07-06 06:55:25 +10:00
|
|
|
spacing: sidePane.collapsed ? 0 : sidePane.normalSpacing
|
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
|
2019-07-04 12:31:29 +10:00
|
|
|
name: Utils.stripRoomName(model.displayName)
|
2019-04-29 02:40:18 +10:00
|
|
|
}
|
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-07-04 12:31:29 +10:00
|
|
|
text: model.displayName || "<i>Empty room</i>"
|
|
|
|
textFormat: model.displayName? Text.PlainText : 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-07-04 14:24:21 +10:00
|
|
|
HRichLabel {
|
2019-07-05 06:01:44 +10:00
|
|
|
function getText(ev) {
|
2019-07-04 14:24:21 +10:00
|
|
|
if (! ev) { return "" }
|
|
|
|
|
|
|
|
if (! Utils.eventIsMessage(ev)) {
|
|
|
|
return Utils.translatedEventContent(ev)
|
|
|
|
}
|
|
|
|
|
|
|
|
return Utils.coloredNameHtml(
|
2019-07-05 06:01:44 +10:00
|
|
|
users.getUser(ev.senderId).displayName,
|
2019-07-04 14:24:21 +10:00
|
|
|
ev.senderId
|
|
|
|
) + ": " + py.callSync("inlinify", [ev.content])
|
|
|
|
}
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2019-07-05 09:21:07 +10:00
|
|
|
// Have to do it like this to avoid binding loop
|
|
|
|
property var lastEv: timelines.lastEventOf(model.roomId)
|
|
|
|
onLastEvChanged: text = getText(lastEv)
|
|
|
|
|
2019-07-05 06:01:44 +10:00
|
|
|
id: subtitleLabel
|
|
|
|
visible: Boolean(text)
|
|
|
|
textFormat: Text.StyledText
|
|
|
|
|
2019-07-07 07:50:55 +10:00
|
|
|
font.pixelSize: theme.fontSize.small
|
2019-07-04 12:31:29 +10:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2019-07-04 12:31:29 +10:00
|
|
|
Layout.maximumWidth: parent.width
|
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|