ca04e4c4a4
- Rectangle > Column > Labels instead of ColumnLayout > Labels with rectangle backgrounds hack - Use basic Row and Column instead of Layouts, for simplicity and performance - Get rid of a binding loop that happened sometimes when local echo icon disappeared - Max bubble width when lots of screen space available now depends on font size, instead of always being 600
54 lines
1.5 KiB
QML
54 lines
1.5 KiB
QML
import QtQuick 2.7
|
|
import QtQuick.Layouts 1.3
|
|
import "../../Base"
|
|
import "../utils.js" as ChatJS
|
|
|
|
Row {
|
|
id: eventContent
|
|
spacing: standardSpacing / 2
|
|
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 {
|
|
id: avatar
|
|
name: displayName
|
|
hidden: combine
|
|
dimension: 28
|
|
}
|
|
|
|
HLabel {
|
|
width: parent.width
|
|
|
|
id: contentLabel
|
|
text: "<font color='" +
|
|
Qt.hsla(Backend.hueFromString(displayName.value || dict.sender),
|
|
HStyle.chat.event.saturation,
|
|
HStyle.chat.event.lightness,
|
|
1) +
|
|
"'>" +
|
|
(displayName.value || dict.sender) + " " +
|
|
ChatJS.getEventText(type, dict) +
|
|
|
|
" " +
|
|
"<font size=" + HStyle.fontSize.small + "px " +
|
|
"color=" + HStyle.chat.event.date + ">" +
|
|
Qt.formatDateTime(dateTime, "hh:mm:ss") +
|
|
"</font> " +
|
|
"</font>"
|
|
|
|
textFormat: Text.RichText
|
|
background: Rectangle {color: HStyle.chat.event.background}
|
|
wrapMode: Text.Wrap
|
|
|
|
leftPadding: horizontalPadding
|
|
rightPadding: horizontalPadding
|
|
topPadding: verticalPadding
|
|
bottomPadding: verticalPadding
|
|
}
|
|
}
|