moment/harmonyqml/components/chat/EventContent.qml
miruka 1d0cce402e Proper display name retrieval implementation
For any name not found in rooms data, rely on new
nio.HttpClient.get_displayname() function to get and cache it,
e.g. for our own name if no room is joined and past events from users
who left the room.

@futurize now returns PyQtFuture objects, wrapper for the
concurrent.futures.Future objects that can be used from QML,
to ensure name retrieval does not block the GUI.
2019-04-19 02:26:29 -04:00

45 lines
1.3 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../base" as Base
import "utils.js" as ChatJS
RowLayout {
id: row
spacing: standardSpacing / 2
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
anchors.right: isOwn ? parent.right : undefined
readonly property string contentText:
isMessage ? "" : ChatJS.get_event_text(type, dict)
Base.Avatar {
id: avatar
name: displayName
invisible: combine
dimmension: 28
}
Base.HLabel {
id: contentLabel
text: "<font color='" +
(isUndecryptableEvent ? "darkred" : "gray") + "'>" +
(displayName.value || dict.sender) + " " + contentText +
"&nbsp;&nbsp;<font size=" + smallSize + "px color='gray'>" +
Qt.formatDateTime(date_time, "hh:mm:ss") +
"</font></font>"
textFormat: Text.RichText
background: Rectangle {color: "#DDD"}
wrapMode: Text.Wrap
leftPadding: horizontalPadding
rightPadding: horizontalPadding
topPadding: verticalPadding
bottomPadding: verticalPadding
Layout.maximumWidth: Math.min(
600, messageListView.width - avatar.width - row.spacing
)
}
}