2018-07-09 14:00:27 +00:00
|
|
|
import QtQuick 2.11
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Controls.Material 2.4
|
|
|
|
|
|
|
|
Item {
|
2018-07-10 04:18:21 +00:00
|
|
|
id: messageDelegate
|
|
|
|
|
2018-07-09 14:00:27 +00:00
|
|
|
readonly property bool sentByMe: author === currentRoom.localUser
|
|
|
|
|
2018-07-10 04:18:21 +00:00
|
|
|
width: delegateLoader.width
|
|
|
|
height: delegateLoader.height
|
2018-07-09 14:00:27 +00:00
|
|
|
|
2018-07-10 04:18:21 +00:00
|
|
|
anchors.right: (eventType === "message" || eventType === "image") && sentByMe ? parent.right : undefined
|
|
|
|
anchors.horizontalCenter: (eventType === "state" || eventType === "emote") ? parent.horizontalCenter : undefined
|
2018-07-09 14:00:27 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
ToolTip.visible: pressed
|
|
|
|
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
|
|
|
|
ToolTip.text: time
|
|
|
|
}
|
|
|
|
|
2018-07-10 04:18:21 +00:00
|
|
|
Loader {
|
|
|
|
id: delegateLoader
|
|
|
|
|
|
|
|
source: {
|
|
|
|
switch (eventType) {
|
|
|
|
case "notice":
|
|
|
|
case "message":
|
|
|
|
return "MessageBubble.qml"
|
|
|
|
case "image":
|
|
|
|
return "ImageBubble.qml"
|
|
|
|
case "emote":
|
|
|
|
case "state":
|
|
|
|
return "StateBubble.qml"
|
2018-07-09 14:00:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|