2019-04-15 02:56:30 +10:00
|
|
|
import QtQuick 2.7
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Layouts 1.4
|
2019-04-29 04:34:29 +10:00
|
|
|
import "../../Base" as Base
|
|
|
|
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
|
2019-04-19 16:07:01 +10:00
|
|
|
spacing: standardSpacing / 2
|
2019-04-15 02:56:30 +10:00
|
|
|
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
|
|
|
|
anchors.right: isOwn ? parent.right : undefined
|
|
|
|
|
|
|
|
readonly property string contentText:
|
2019-04-21 07:36:21 +10:00
|
|
|
isMessage ? "" : ChatJS.getEventText(type, dict)
|
2019-04-15 02:56:30 +10:00
|
|
|
|
2019-04-29 01:21:19 +10:00
|
|
|
Base.HAvatar {
|
2019-04-15 02:56:30 +10:00
|
|
|
id: avatar
|
|
|
|
name: displayName
|
2019-04-29 01:32:02 +10:00
|
|
|
hidden: combine
|
|
|
|
dimension: 28
|
2019-04-15 02:56:30 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
Base.HLabel {
|
|
|
|
id: contentLabel
|
2019-04-15 04:09:54 +10:00
|
|
|
text: "<font color='" +
|
2019-04-29 01:01:38 +10:00
|
|
|
Qt.hsla(Backend.hueFromString(displayName.value || dict.sender),
|
|
|
|
Base.HStyle.chat.event.saturation,
|
|
|
|
Base.HStyle.chat.event.lightness,
|
|
|
|
1) +
|
|
|
|
"'>" +
|
|
|
|
(displayName.value || dict.sender) + " " +
|
2019-04-22 02:25:55 +10:00
|
|
|
contentText +
|
2019-04-29 01:01:38 +10:00
|
|
|
|
|
|
|
" " +
|
|
|
|
"<font size=" + Base.HStyle.fontSize.small + "px " +
|
|
|
|
"color=" + Base.HStyle.chat.event.date + ">" +
|
2019-04-21 07:36:21 +10:00
|
|
|
Qt.formatDateTime(dateTime, "hh:mm:ss") +
|
2019-04-29 01:01:38 +10:00
|
|
|
"</font> " +
|
|
|
|
"</font>"
|
|
|
|
|
2019-04-15 02:56:30 +10:00
|
|
|
textFormat: Text.RichText
|
2019-04-29 01:01:38 +10:00
|
|
|
background: Rectangle {color: Base.HStyle.chat.event.background}
|
2019-04-15 02:56:30 +10:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
leftPadding: horizontalPadding
|
|
|
|
rightPadding: horizontalPadding
|
|
|
|
topPadding: verticalPadding
|
|
|
|
bottomPadding: verticalPadding
|
|
|
|
|
|
|
|
Layout.maximumWidth: Math.min(
|
2019-04-29 04:34:29 +10:00
|
|
|
600, roomEventListView.width - avatar.width - row.spacing
|
2019-04-15 02:56:30 +10:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|