moment/harmonyqml/components/Chat/RoomEventList/EventContent.qml

51 lines
1.4 KiB
QML
Raw Normal View History

2019-04-15 02:56:30 +10:00
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../../Base"
import "../utils.js" as ChatJS
2019-04-15 02:56:30 +10:00
HRowLayout {
2019-04-29 04:48:59 +10:00
id: eventContent
spacing: standardSpacing / 2
2019-04-15 02:56:30 +10:00
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
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
}
HLabel {
2019-04-15 02:56:30 +10:00
id: contentLabel
text: "<font color='" +
2019-04-29 01:01:38 +10:00
Qt.hsla(Backend.hueFromString(displayName.value || dict.sender),
HStyle.chat.event.saturation,
HStyle.chat.event.lightness,
2019-04-29 01:01:38 +10:00
1) +
"'>" +
(displayName.value || dict.sender) + " " +
2019-04-29 04:48:59 +10:00
ChatJS.getEventText(type, dict) +
2019-04-29 01:01:38 +10:00
"&nbsp;&nbsp;" +
"<font size=" + HStyle.fontSize.small + "px " +
"color=" + HStyle.chat.event.date + ">" +
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
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
Layout.maximumWidth: Math.min(
2019-04-29 04:48:59 +10:00
600,
roomEventListView.width - avatar.width - eventContent.totalSpacing
2019-04-15 02:56:30 +10:00
)
}
}