moment/src/qml/Chat/RoomEventList/EventContent.qml

54 lines
1.5 KiB
QML
Raw Normal View History

2019-04-14 12:56:30 -04:00
import QtQuick 2.7
import QtQuick.Layouts 1.3
import "../../Base"
import "../utils.js" as ChatJS
2019-04-14 12:56:30 -04:00
Row {
2019-04-28 14:48:59 -04:00
id: eventContent
spacing: standardSpacing / 2
2019-04-14 12:56:30 -04:00
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
width: Math.min(
roomEventListView.width - avatar.width - eventContent.spacing,
HStyle.fontSize.normal * 0.5 * 75, // 600 with 16px font
contentLabel.implicitWidth
)
HAvatar {
2019-04-14 12:56:30 -04:00
id: avatar
name: sender.displayName || stripUserId(sender.userId)
2019-04-28 11:32:02 -04:00
hidden: combine
dimension: 28
2019-04-14 12:56:30 -04:00
}
HLabel {
width: parent.width
2019-04-14 12:56:30 -04:00
id: contentLabel
text: "<font color='" +
Qt.hsla(Backend.hueFromString(sender.displayName.value),
HStyle.chat.event.saturation,
HStyle.chat.event.lightness,
2019-04-28 11:01:38 -04:00
1) +
"'>" +
sender.displayName.value + " " +
2019-04-28 14:48:59 -04:00
ChatJS.getEventText(type, dict) +
2019-04-28 11:01:38 -04:00
"&nbsp;&nbsp;" +
"<font size=" + HStyle.fontSize.small + "px " +
"color=" + HStyle.chat.event.date + ">" +
Qt.formatDateTime(dateTime, "hh:mm:ss") +
2019-04-28 11:01:38 -04:00
"</font> " +
"</font>"
2019-04-14 12:56:30 -04:00
textFormat: Text.RichText
background: Rectangle {color: HStyle.chat.event.background}
2019-04-14 12:56:30 -04:00
wrapMode: Text.Wrap
leftPadding: horizontalPadding
rightPadding: horizontalPadding
topPadding: verticalPadding
bottomPadding: verticalPadding
}
}