moment/harmonyqml/components/Chat/RoomEventList/EventContent.qml
miruka 7004b4ea3f Reorganize Chat component files
- MessageList renamed to RoomEventList
- MessageDelegate renamed to RoomEventDelegate
- Banner and RoomEventList get their own folders
2019-04-28 14:34:29 -04:00

55 lines
1.6 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../utils.js" as ChatJS
RowLayout {
id: row
spacing: standardSpacing / 2
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
anchors.right: isOwn ? parent.right : undefined
readonly property string contentText:
isMessage ? "" : ChatJS.getEventText(type, dict)
Base.HAvatar {
id: avatar
name: displayName
hidden: combine
dimension: 28
}
Base.HLabel {
id: contentLabel
text: "<font color='" +
Qt.hsla(Backend.hueFromString(displayName.value || dict.sender),
Base.HStyle.chat.event.saturation,
Base.HStyle.chat.event.lightness,
1) +
"'>" +
(displayName.value || dict.sender) + " " +
contentText +
"&nbsp;&nbsp;" +
"<font size=" + Base.HStyle.fontSize.small + "px " +
"color=" + Base.HStyle.chat.event.date + ">" +
Qt.formatDateTime(dateTime, "hh:mm:ss") +
"</font> " +
"</font>"
textFormat: Text.RichText
background: Rectangle {color: Base.HStyle.chat.event.background}
wrapMode: Text.Wrap
leftPadding: horizontalPadding
rightPadding: horizontalPadding
topPadding: verticalPadding
bottomPadding: verticalPadding
Layout.maximumWidth: Math.min(
600, roomEventListView.width - avatar.width - row.spacing
)
}
}