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-29 04:34:29 +10:00
|
|
|
import "../utils.js" as ChatJS
|
2019-04-15 02:56:30 +10:00
|
|
|
|
2019-05-09 01:18:22 +10:00
|
|
|
Row {
|
2019-04-29 04:48:59 +10:00
|
|
|
id: eventContent
|
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
|
|
|
|
|
2019-05-09 01:18:22 +10:00
|
|
|
width: Math.min(
|
|
|
|
roomEventListView.width - avatar.width - eventContent.spacing,
|
|
|
|
HStyle.fontSize.normal * 0.5 * 75, // 600 with 16px font
|
|
|
|
contentLabel.implicitWidth
|
|
|
|
)
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HAvatar {
|
2019-04-15 02:56:30 +10:00
|
|
|
id: avatar
|
2019-05-12 05:52:56 +10:00
|
|
|
name: sender.displayName.value
|
2019-04-29 01:32:02 +10:00
|
|
|
hidden: combine
|
|
|
|
dimension: 28
|
2019-04-15 02:56:30 +10:00
|
|
|
}
|
|
|
|
|
2019-04-29 05:18:36 +10:00
|
|
|
HLabel {
|
2019-05-09 01:18:22 +10:00
|
|
|
width: parent.width
|
|
|
|
|
2019-04-15 02:56:30 +10:00
|
|
|
id: contentLabel
|
2019-04-15 04:09:54 +10:00
|
|
|
text: "<font color='" +
|
2019-05-12 05:52:56 +10:00
|
|
|
Qt.hsla(Backend.hueFromString(sender.displayName.value),
|
2019-04-29 05:18:36 +10:00
|
|
|
HStyle.chat.event.saturation,
|
|
|
|
HStyle.chat.event.lightness,
|
2019-04-29 01:01:38 +10:00
|
|
|
1) +
|
|
|
|
"'>" +
|
2019-05-12 05:52:56 +10:00
|
|
|
sender.displayName.value + " " +
|
2019-04-29 04:48:59 +10:00
|
|
|
ChatJS.getEventText(type, dict) +
|
2019-04-29 01:01:38 +10:00
|
|
|
|
|
|
|
" " +
|
2019-04-29 05:18:36 +10:00
|
|
|
"<font size=" + HStyle.fontSize.small + "px " +
|
|
|
|
"color=" + 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 05:18:36 +10:00
|
|
|
background: Rectangle {color: HStyle.chat.event.background}
|
2019-04-15 02:56:30 +10:00
|
|
|
wrapMode: Text.Wrap
|
|
|
|
|
|
|
|
leftPadding: horizontalPadding
|
|
|
|
rightPadding: horizontalPadding
|
|
|
|
topPadding: verticalPadding
|
|
|
|
bottomPadding: verticalPadding
|
|
|
|
}
|
|
|
|
}
|