2018-07-12 01:44:41 +00:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Controls.Material 2.2
|
2018-07-10 04:18:21 +00:00
|
|
|
|
2018-07-10 06:34:17 +00:00
|
|
|
AvatarContainer {
|
2018-07-10 04:18:21 +00:00
|
|
|
readonly property bool isNotice: eventType === "notice"
|
|
|
|
|
|
|
|
id: messageRow
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: messageRect
|
|
|
|
|
2018-07-10 06:34:17 +00:00
|
|
|
width: Math.min(messageText.implicitWidth + 24, messageListView.width - (!sentByMe ? 40 + messageRow.spacing : 0))
|
2018-07-10 04:18:21 +00:00
|
|
|
height: messageText.implicitHeight + 24
|
|
|
|
|
2018-07-20 04:14:02 +00:00
|
|
|
color: isNotice ? "transparent" : !sentByMe ? Material.accent : background
|
2018-07-10 04:18:21 +00:00
|
|
|
border.color: Material.accent
|
|
|
|
border.width: isNotice ? 2 : 0
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: messageText
|
|
|
|
text: display
|
2018-07-20 04:14:02 +00:00
|
|
|
color: isNotice || sentByMe ? Material.foreground : "white"
|
2018-07-10 04:18:21 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 12
|
|
|
|
wrapMode: Label.Wrap
|
2018-07-20 04:14:02 +00:00
|
|
|
linkColor: isNotice || sentByMe ? Material.accent : "white"
|
2018-07-12 11:40:16 +00:00
|
|
|
// textFormat: contentType === "text/html" ? Text.RichText : Text.StyledText
|
|
|
|
textFormat: Text.StyledText
|
2018-07-20 14:36:19 +00:00
|
|
|
onLinkActivated: Qt.openUrlExternally(link)
|
2018-07-10 04:18:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|