2019-07-08 13:52:41 +10:00
|
|
|
// Copyright 2019 miruka
|
|
|
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
import QtQuick 2.12
|
2019-07-13 19:39:01 +10:00
|
|
|
import QtQuick.Layouts 1.12
|
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-07-13 07:06:37 +10:00
|
|
|
HHighlightRectangle {
|
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-13 07:06:37 +10:00
|
|
|
TapHandler {
|
|
|
|
onTapped: pageStack.showRoom(
|
|
|
|
roomList.userId, roomList.category, model.roomId
|
|
|
|
)
|
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
Row {
|
2019-07-13 08:15:06 +10:00
|
|
|
width: parent.width - leftPadding * 2
|
2019-07-13 07:06:37 +10:00
|
|
|
padding: sidePane.currentSpacing / 2
|
|
|
|
leftPadding: sidePane.currentSpacing
|
|
|
|
rightPadding: 0
|
2019-05-03 04:20:21 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
HRowLayout {
|
|
|
|
width: parent.width
|
|
|
|
spacing: sidePane.currentSpacing
|
2019-03-26 09:29:46 +11:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
HRoomAvatar {
|
|
|
|
id: roomAvatar
|
|
|
|
roomId: model.roomId
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
2019-04-29 02:40:18 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
HColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
2019-07-04 14:24:21 +10:00
|
|
|
|
2019-07-13 07:06:37 +10: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 14:24:21 +10:00
|
|
|
|
2019-07-16 19:08:27 +10:00
|
|
|
Layout.fillWidth: true
|
2019-07-04 14:24:21 +10:00
|
|
|
}
|
2019-07-03 03:59:52 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
HRichLabel {
|
|
|
|
function getText(ev) {
|
|
|
|
if (! ev) { return "" }
|
2019-07-05 09:21:07 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
if (! Utils.eventIsMessage(ev)) {
|
|
|
|
return Utils.translatedEventContent(ev)
|
|
|
|
}
|
2019-07-05 06:01:44 +10:00
|
|
|
|
2019-07-13 07:06:37 +10: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-03 03:59:52 +10:00
|
|
|
|
2019-07-13 07:06:37 +10:00
|
|
|
font.pixelSize: theme.fontSize.small
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
2019-07-16 19:08:27 +10:00
|
|
|
Layout.fillWidth: true
|
2019-07-13 07:06:37 +10:00
|
|
|
}
|
2019-07-04 12:31:29 +10:00
|
|
|
}
|
2019-03-22 14:28:14 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|