Display room messages and other events
This commit is contained in:
45
harmonyqml/components/chat/EventContent.qml
Normal file
45
harmonyqml/components/chat/EventContent.qml
Normal file
@@ -0,0 +1,45 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.4
|
||||
import "../base" as Base
|
||||
import "get_event_text.js" as GetEventTextJS
|
||||
|
||||
Row {
|
||||
id: row
|
||||
spacing: standardSpacing
|
||||
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
|
||||
anchors.right: isOwn ? parent.right : undefined
|
||||
|
||||
readonly property string contentText:
|
||||
(isMessage || isUndecryptableEvent) ?
|
||||
"" :
|
||||
GetEventTextJS.get_event_text(type, dict)
|
||||
|
||||
Base.Avatar {
|
||||
id: avatar
|
||||
name: displayName
|
||||
invisible: combine
|
||||
dimmension: 28
|
||||
}
|
||||
|
||||
Base.HLabel {
|
||||
id: contentLabel
|
||||
text: "<font color=gray>" +
|
||||
displayName + " " + contentText +
|
||||
" <font size=" + smallSize + "px>" +
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user