2019-04-15 02:56:30 +10:00
|
|
|
import QtQuick 2.7
|
2019-04-29 05:45:42 +10:00
|
|
|
import QtQuick.Layouts 1.3
|
2019-04-29 05:18:36 +10:00
|
|
|
import "../../Base"
|
2019-04-15 02:56:30 +10:00
|
|
|
|
|
|
|
Row {
|
|
|
|
id: row
|
2019-04-30 13:58:17 +10:00
|
|
|
spacing: standardSpacing / 2
|
2019-04-15 02:56:30 +10:00
|
|
|
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HAvatar { id: avatar; hidden: combine; name: displayName }
|
2019-04-15 02:56:30 +10:00
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HColumnLayout {
|
2019-04-15 02:56:30 +10:00
|
|
|
spacing: 0
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-04-15 02:56:30 +10:00
|
|
|
visible: ! combine
|
|
|
|
id: nameLabel
|
2019-04-19 16:07:01 +10:00
|
|
|
text: displayName.value || dict.sender
|
2019-04-29 05:18:36 +10:00
|
|
|
background: Rectangle {color: HStyle.chat.message.background}
|
2019-04-29 01:01:38 +10:00
|
|
|
color: Qt.hsla(Backend.hueFromString(text),
|
2019-04-29 05:18:36 +10:00
|
|
|
HStyle.displayName.saturation,
|
|
|
|
HStyle.displayName.lightness,
|
2019-04-29 01:01:38 +10:00
|
|
|
1)
|
2019-04-15 02:56:30 +10:00
|
|
|
elide: Text.ElideRight
|
|
|
|
maximumLineCount: 1
|
|
|
|
Layout.preferredWidth: contentLabel.width
|
|
|
|
horizontalAlignment: isOwn ? Text.AlignRight : Text.AlignLeft
|
|
|
|
|
|
|
|
leftPadding: horizontalPadding
|
|
|
|
rightPadding: horizontalPadding
|
|
|
|
topPadding: verticalPadding
|
|
|
|
}
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HRichLabel {
|
2019-04-15 02:56:30 +10:00
|
|
|
id: contentLabel
|
2019-04-18 00:49:54 +10:00
|
|
|
text: (dict.formatted_body ?
|
2019-04-18 03:44:04 +10:00
|
|
|
Backend.htmlFilter.filter(dict.formatted_body) :
|
2019-04-18 00:49:54 +10:00
|
|
|
dict.body) +
|
2019-04-29 05:18:36 +10:00
|
|
|
" <font size=" + HStyle.fontSize.small +
|
|
|
|
"px color=" + HStyle.chat.message.date + ">" +
|
2019-04-21 07:36:21 +10:00
|
|
|
Qt.formatDateTime(dateTime, "hh:mm:ss") +
|
2019-04-19 03:46:39 +10:00
|
|
|
"</font>" +
|
2019-04-21 07:36:21 +10:00
|
|
|
(isLocalEcho ?
|
2019-04-29 05:18:36 +10:00
|
|
|
" <font size=" + HStyle.fontSize.small +
|
2019-04-27 06:02:20 +10:00
|
|
|
"px>⏳</font>" : "")
|
2019-04-15 02:56:30 +10:00
|
|
|
textFormat: Text.RichText
|
2019-04-29 05:18:36 +10:00
|
|
|
background: Rectangle {color: HStyle.chat.message.background}
|
|
|
|
color: HStyle.chat.message.body
|
2019-04-15 02:56:30 +10:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
leftPadding: horizontalPadding
|
|
|
|
rightPadding: horizontalPadding
|
2019-04-18 06:43:18 +10:00
|
|
|
topPadding: nameLabel.visible ? 0 : verticalPadding
|
2019-04-15 02:56:30 +10:00
|
|
|
bottomPadding: verticalPadding
|
|
|
|
|
|
|
|
Layout.minimumWidth: nameLabel.implicitWidth
|
|
|
|
Layout.maximumWidth: Math.min(
|
2019-04-29 05:45:42 +10:00
|
|
|
600, roomEventListView.width - avatar.width - row.spacing
|
2019-04-15 02:56:30 +10:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|