Clean up MessageDelegate.

Include a generic component for text bubbles.
Fixes #11.
This commit is contained in:
Black Hat
2018-08-05 18:06:57 +08:00
parent cfa7049c5e
commit 97cedcc785
5 changed files with 74 additions and 70 deletions

View File

@@ -2,25 +2,10 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls.Material 2.2
Rectangle {
readonly property bool isEmote: eventType === "emote"
TextDelegate {
maximumWidth: messageListView.width
highlighted: eventType === "emote"
timeLabelVisible: false
id: stateRect
width: Math.min(stateText.implicitWidth + 24, messageListView.width)
height: stateText.implicitHeight + 24
color: isEmote ? Material.accent : background
Label {
id: stateText
text: "<b>" + author.displayName + "</b> " + display
color: isEmote ? "white" : Material.foreground
linkColor: isEmote || darkTheme ? "white" : Material.accent
anchors.fill: parent
anchors.margins: 12
wrapMode: Label.Wrap
textFormat: Text.StyledText
onLinkActivated: Qt.openUrlExternally(link)
}
displayText: "<b>" + author.displayName + "</b> " + display
}