import QtQuick 2.7 import QtQuick.Layouts 1.3 import "../Base" import "../utils.js" as Utils MouseArea { id: roomDelegate width: roomList.width height: childrenRect.height onClicked: pageStack.showRoom(roomList.userId, roomList.category, model.roomId) HRowLayout { width: parent.width spacing: sidePane.normalSpacing HAvatar { id: roomAvatar name: Utils.stripRoomName(model.displayName) } HColumnLayout { Layout.fillWidth: true Layout.maximumWidth: parent.width - parent.totalSpacing - roomAvatar.width HLabel { id: roomLabel text: model.displayName || "Empty room" textFormat: model.displayName? Text.PlainText : Text.StyledText elide: Text.ElideRight maximumLineCount: 1 verticalAlignment: Qt.AlignVCenter Layout.maximumWidth: parent.width } HRichLabel { id: subtitleLabel visible: Boolean(text) textFormat: Text.StyledText text: { var ev = models.timelines.lastEventOf(model.roomId) if (! ev) { return "" } if (! Utils.eventIsMessage(ev)) { return Utils.translatedEventContent(ev) } return Utils.coloredNameHtml( models.users.getUser(ev.senderId).displayName, ev.senderId ) + ": " + py.callSync("inlinify", [ev.content]) } font.pixelSize: HStyle.fontSize.small elide: Text.ElideRight maximumLineCount: 1 Layout.maximumWidth: parent.width } } } }