2019-04-15 02:56:30 +10:00
|
|
|
import QtQuick 2.7
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Layouts 1.4
|
|
|
|
import "../base" as Base
|
2019-04-15 04:09:54 +10:00
|
|
|
import "utils.js" as ChatJS
|
2019-04-15 02:56:30 +10:00
|
|
|
|
2019-04-15 04:16:38 +10:00
|
|
|
RowLayout {
|
2019-04-15 02:56:30 +10:00
|
|
|
id: row
|
|
|
|
spacing: standardSpacing
|
|
|
|
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
|
|
|
|
anchors.right: isOwn ? parent.right : undefined
|
|
|
|
|
|
|
|
readonly property string contentText:
|
2019-04-15 04:09:54 +10:00
|
|
|
isMessage ? "" : ChatJS.get_event_text(type, dict)
|
2019-04-15 02:56:30 +10:00
|
|
|
|
|
|
|
Base.Avatar {
|
|
|
|
id: avatar
|
|
|
|
name: displayName
|
|
|
|
invisible: combine
|
|
|
|
dimmension: 28
|
|
|
|
}
|
|
|
|
|
|
|
|
Base.HLabel {
|
|
|
|
id: contentLabel
|
2019-04-15 04:09:54 +10:00
|
|
|
text: "<font color='" +
|
|
|
|
(isUndecryptableEvent ? "darkred" : "gray") + "'>" +
|
2019-04-15 02:56:30 +10:00
|
|
|
displayName + " " + contentText +
|
2019-04-15 04:18:53 +10:00
|
|
|
" <font size=" + smallSize + "px color='gray'>" +
|
2019-04-15 02:56:30 +10:00
|
|
|
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
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|