2019-07-07 23:52:41 -04:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
import QtQuick 2.12
|
2019-07-13 05:39:01 -04:00
|
|
|
import QtQuick.Layouts 1.12
|
2019-04-28 15:18:36 -04:00
|
|
|
import "../Base"
|
2019-07-03 22:31:29 -04:00
|
|
|
import "../utils.js" as Utils
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-07-18 01:56:58 -04:00
|
|
|
HInteractiveRectangle {
|
2019-04-28 12:40:18 -04:00
|
|
|
id: roomDelegate
|
2019-03-26 03:19:55 -04:00
|
|
|
width: roomList.width
|
2019-05-02 14:20:21 -04:00
|
|
|
height: childrenRect.height
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
TapHandler {
|
|
|
|
onTapped: pageStack.showRoom(
|
|
|
|
roomList.userId, roomList.category, model.roomId
|
|
|
|
)
|
|
|
|
}
|
2019-03-21 23:28:14 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
Row {
|
2019-07-12 18:15:06 -04:00
|
|
|
width: parent.width - leftPadding * 2
|
2019-07-12 17:06:37 -04:00
|
|
|
padding: sidePane.currentSpacing / 2
|
|
|
|
leftPadding: sidePane.currentSpacing
|
|
|
|
rightPadding: 0
|
2019-05-02 14:20:21 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
HRowLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: sidePane.currentSpacing
|
2019-03-25 18:29:46 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
HRoomAvatar {
|
|
|
|
id: roomAvatar
|
|
|
|
roomId: model.roomId
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
2019-04-28 12:40:18 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
HColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
2019-07-04 00:24:21 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
HLabel {
|
|
|
|
id: roomLabel
|
|
|
|
text: model.displayName || "<i>Empty room</i>"
|
|
|
|
textFormat:
|
|
|
|
model.displayName? Text.PlainText : Text.StyledText
|
|
|
|
elide: Text.ElideRight
|
|
|
|
verticalAlignment: Qt.AlignVCenter
|
2019-07-04 00:24:21 -04:00
|
|
|
|
2019-07-16 05:08:27 -04:00
|
|
|
Layout.fillWidth: true
|
2019-07-04 00:24:21 -04:00
|
|
|
}
|
2019-07-02 13:59:52 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
HRichLabel {
|
|
|
|
function getText(ev) {
|
|
|
|
if (! ev) { return "" }
|
2019-07-04 19:21:07 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
if (! Utils.eventIsMessage(ev)) {
|
|
|
|
return Utils.translatedEventContent(ev)
|
|
|
|
}
|
2019-07-04 16:01:44 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
return Utils.coloredNameHtml(
|
|
|
|
users.find(ev.senderId).displayName,
|
|
|
|
ev.senderId
|
|
|
|
) + ": " + py.callSync("inlinify", [ev.content])
|
|
|
|
}
|
|
|
|
|
|
|
|
// Have to do it like this to avoid binding loop
|
|
|
|
property var lastEv: timelines.lastEventOf(model.roomId)
|
|
|
|
onLastEvChanged: text = getText(lastEv)
|
|
|
|
|
|
|
|
id: subtitleLabel
|
|
|
|
visible: Boolean(text)
|
|
|
|
textFormat: Text.StyledText
|
2019-07-02 13:59:52 -04:00
|
|
|
|
2019-07-12 17:06:37 -04:00
|
|
|
font.pixelSize: theme.fontSize.small
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
2019-07-16 05:08:27 -04:00
|
|
|
Layout.fillWidth: true
|
2019-07-12 17:06:37 -04:00
|
|
|
}
|
2019-07-03 22:31:29 -04:00
|
|
|
}
|
2019-03-21 23:28:14 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|