Clean up MessageDelegate.
Include a generic component for text bubbles. Fixes #11.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user