2018-07-12 01:44:41 +00:00
|
|
|
import QtQuick 2.9
|
|
|
|
import QtQuick.Controls 2.2
|
|
|
|
import QtQuick.Controls.Material 2.2
|
2018-07-09 14:00:27 +00:00
|
|
|
|
|
|
|
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-12 11:40:16 +00:00
|
|
|
anchors.right: (eventType === "message" || eventType === "image" || eventType === "file" || eventType === "video" || eventType === "audio" || eventType === "notice") && sentByMe ? parent.right : undefined
|
2018-07-10 04:18:21 +00:00
|
|
|
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-10 06:34:17 +00:00
|
|
|
case "video":
|
|
|
|
case "audio":
|
|
|
|
case "file":
|
|
|
|
return "FileBubble.qml"
|
2018-07-09 14:00:27 +00:00
|
|
|
}
|
2018-07-10 06:34:17 +00:00
|
|
|
return ""
|
2018-07-09 14:00:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|