2019-10-08 21:55:09 +03:00
|
|
|
import QtQuick 2.6
|
2019-10-17 10:36:16 +03:00
|
|
|
import QtQuick.Controls 2.3
|
2019-10-08 21:55:09 +03:00
|
|
|
import QtQuick.Layouts 1.2
|
|
|
|
import QtQuick.Window 2.2
|
|
|
|
|
2019-11-30 03:43:39 +03:00
|
|
|
import im.nheko 1.0
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2019-10-28 00:01:40 +03:00
|
|
|
import "./delegates"
|
2020-05-13 07:35:26 +03:00
|
|
|
import "./emoji"
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-07-26 03:06:38 +03:00
|
|
|
Item {
|
2019-10-08 21:55:09 +03:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2020-02-27 01:43:15 +03:00
|
|
|
height: row.height
|
2020-07-26 03:06:38 +03:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
propagateComposedEvents: true
|
|
|
|
preventStealing: true
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
acceptedButtons: Qt.AllButtons
|
|
|
|
onClicked: {
|
|
|
|
if (mouse.button === Qt.RightButton)
|
|
|
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
|
|
|
}
|
|
|
|
onPressAndHold: {
|
|
|
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row, mapToItem(timelineRoot, mouse.x, mouse.y))
|
|
|
|
}
|
2020-02-27 01:43:15 +03:00
|
|
|
}
|
2020-05-16 00:27:41 +03:00
|
|
|
Rectangle {
|
2020-06-24 17:24:22 +03:00
|
|
|
color: (Settings.messageHoverHighlight && parent.containsMouse) ? colors.base : "transparent"
|
2020-05-16 00:27:41 +03:00
|
|
|
anchors.fill: row
|
|
|
|
}
|
2020-02-27 01:43:15 +03:00
|
|
|
RowLayout {
|
|
|
|
id: row
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-05-26 23:27:05 +03:00
|
|
|
anchors.leftMargin: avatarSize + 16
|
2020-02-27 01:43:15 +03:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-01-29 03:20:39 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
Column {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
spacing: 4
|
2019-10-17 10:36:16 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
// fancy reply, if this is a reply
|
|
|
|
Reply {
|
|
|
|
visible: model.replyTo
|
2020-06-24 17:24:22 +03:00
|
|
|
modelData: chat.model.getDump(model.replyTo)
|
|
|
|
userColor: TimelineManager.userColor(modelData.userId, colors.window)
|
2020-02-27 01:43:15 +03:00
|
|
|
}
|
2020-02-02 02:27:28 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
// actual message content
|
|
|
|
MessageDelegate {
|
|
|
|
id: contentItem
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
width: parent.width
|
2019-10-17 10:36:16 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
modelData: model
|
|
|
|
}
|
2020-05-04 01:59:05 +03:00
|
|
|
|
|
|
|
Reactions {
|
2020-05-22 04:21:35 +03:00
|
|
|
id: reactionRow
|
2020-05-04 14:14:54 +03:00
|
|
|
reactions: model.reactions
|
2020-05-22 04:21:35 +03:00
|
|
|
roomId: model.roomId
|
|
|
|
eventId: model.id
|
2020-05-04 01:59:05 +03:00
|
|
|
}
|
2020-02-27 01:43:15 +03:00
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-03-28 21:12:00 +03:00
|
|
|
StatusIndicator {
|
|
|
|
state: model.state
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
width: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
EncryptionIndicator {
|
2020-05-15 03:35:29 +03:00
|
|
|
visible: model.isRoomEncrypted
|
|
|
|
encrypted: model.isEncrypted
|
2020-03-28 21:12:00 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
width: 16
|
|
|
|
}
|
2020-05-13 07:35:26 +03:00
|
|
|
EmojiButton {
|
2020-06-24 17:24:22 +03:00
|
|
|
visible: Settings.buttonsInTimeline
|
2020-05-08 03:53:24 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
width: 16
|
|
|
|
id: reactButton
|
|
|
|
hoverEnabled: true
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("React")
|
2020-05-14 03:19:15 +03:00
|
|
|
emojiPicker: emojiPopup
|
2020-05-16 22:52:51 +03:00
|
|
|
event_id: model.id
|
2020-05-08 03:53:24 +03:00
|
|
|
}
|
2020-02-27 01:43:15 +03:00
|
|
|
ImageButton {
|
2020-06-24 17:24:22 +03:00
|
|
|
visible: Settings.buttonsInTimeline
|
2020-02-27 01:43:15 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
width: 16
|
|
|
|
id: replyButton
|
|
|
|
hoverEnabled: true
|
2020-02-02 02:27:28 +03:00
|
|
|
|
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
image: ":/icons/icons/ui/mail-reply.png"
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Reply")
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2020-02-27 01:43:15 +03:00
|
|
|
onClicked: chat.model.replyAction(model.id)
|
|
|
|
}
|
|
|
|
ImageButton {
|
2020-06-24 17:24:22 +03:00
|
|
|
visible: Settings.buttonsInTimeline
|
2020-02-27 01:43:15 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
width: 16
|
|
|
|
id: optionsButton
|
2019-10-08 21:55:09 +03:00
|
|
|
hoverEnabled: true
|
2020-02-27 01:43:15 +03:00
|
|
|
|
|
|
|
image: ":/icons/icons/ui/vertical-ellipsis.png"
|
|
|
|
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.text: qsTr("Options")
|
|
|
|
|
2020-04-21 23:32:45 +03:00
|
|
|
onClicked: messageContextMenu.show(model.id, model.type, model.isEncrypted, optionsButton)
|
2020-02-27 01:43:15 +03:00
|
|
|
}
|
|
|
|
|
2020-03-28 21:12:00 +03:00
|
|
|
Label {
|
2020-02-27 01:43:15 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
text: model.timestamp.toLocaleTimeString("HH:mm")
|
|
|
|
color: inactiveColors.text
|
|
|
|
|
|
|
|
MouseArea{
|
|
|
|
id: ma
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
2020-03-10 02:30:45 +03:00
|
|
|
propagateComposedEvents: true
|
2020-02-27 01:43:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ToolTip.visible: ma.containsMouse
|
|
|
|
ToolTip.text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)
|
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
}
|
|
|
|
}
|