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"
|
2019-10-08 21:55:09 +03:00
|
|
|
|
|
|
|
RowLayout {
|
2019-10-28 00:01:40 +03:00
|
|
|
property var view: chat
|
2019-10-08 21:55:09 +03:00
|
|
|
|
|
|
|
anchors.leftMargin: avatarSize + 4
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
2020-01-11 16:07:51 +03:00
|
|
|
//height: Math.max(model.replyTo ? reply.height + contentItem.height + 4 : contentItem.height, 16)
|
2019-10-08 21:55:09 +03:00
|
|
|
|
2019-11-05 19:16:04 +03:00
|
|
|
Column {
|
2019-10-08 21:55:09 +03:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop
|
2020-01-11 16:07:51 +03:00
|
|
|
spacing: 4
|
2019-11-05 19:16:04 +03:00
|
|
|
|
2020-01-11 16:07:51 +03:00
|
|
|
// fancy reply, if this is a reply
|
2020-01-28 21:08:16 +03:00
|
|
|
Reply {
|
2020-01-11 16:07:51 +03:00
|
|
|
visible: model.replyTo
|
2020-01-28 21:08:16 +03:00
|
|
|
modelData: chat.model.getDump(model.replyTo)
|
|
|
|
userColor: chat.model.userColor(modelData.userId, colors.window)
|
2020-01-11 16:07:51 +03:00
|
|
|
}
|
2019-11-05 19:16:04 +03:00
|
|
|
|
2020-01-11 16:07:51 +03:00
|
|
|
// actual message content
|
2019-11-05 19:16:04 +03:00
|
|
|
MessageDelegate {
|
2019-11-09 00:08:51 +03:00
|
|
|
id: contentItem
|
|
|
|
|
2019-11-05 19:16:04 +03:00
|
|
|
width: parent.width
|
2020-01-11 16:07:51 +03:00
|
|
|
|
|
|
|
modelData: model
|
2019-11-05 19:16:04 +03:00
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusIndicator {
|
|
|
|
state: model.state
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
}
|
|
|
|
|
|
|
|
EncryptionIndicator {
|
|
|
|
visible: model.isEncrypted
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
|
|
|
}
|
|
|
|
|
2019-11-03 04:09:36 +03:00
|
|
|
ImageButton {
|
2019-10-08 21:55:09 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
2019-11-03 04:09:36 +03:00
|
|
|
id: replyButton
|
2020-01-29 03:20:39 +03:00
|
|
|
hoverEnabled: true
|
|
|
|
|
2019-10-17 10:36:16 +03:00
|
|
|
|
2019-11-08 16:39:45 +03:00
|
|
|
image: ":/icons/icons/ui/mail-reply.png"
|
2019-10-17 10:36:16 +03:00
|
|
|
ToolTip {
|
|
|
|
visible: replyButton.hovered
|
|
|
|
text: qsTr("Reply")
|
|
|
|
palette: colors
|
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
|
|
|
|
onClicked: view.model.replyAction(model.id)
|
|
|
|
}
|
2019-11-03 04:09:36 +03:00
|
|
|
ImageButton {
|
2019-10-08 21:55:09 +03:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
Layout.preferredHeight: 16
|
2019-11-03 04:09:36 +03:00
|
|
|
id: optionsButton
|
2020-01-29 03:20:39 +03:00
|
|
|
hoverEnabled: true
|
2019-10-17 10:36:16 +03:00
|
|
|
|
2019-11-08 16:39:45 +03:00
|
|
|
image: ":/icons/icons/ui/vertical-ellipsis.png"
|
2019-10-17 10:36:16 +03:00
|
|
|
ToolTip {
|
|
|
|
visible: optionsButton.hovered
|
|
|
|
text: qsTr("Options")
|
|
|
|
palette: colors
|
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
|
|
|
|
onClicked: contextMenu.open()
|
|
|
|
|
|
|
|
Menu {
|
|
|
|
y: optionsButton.height
|
|
|
|
id: contextMenu
|
2019-10-17 10:36:16 +03:00
|
|
|
palette: colors
|
2019-10-08 21:55:09 +03:00
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Read receipts")
|
|
|
|
onTriggered: view.model.readReceiptsAction(model.id)
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Mark as read")
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("View raw message")
|
|
|
|
onTriggered: view.model.viewRawMessage(model.id)
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Redact message")
|
|
|
|
onTriggered: view.model.redactEvent(model.id)
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
visible: model.type == MtxEvent.ImageMessage || model.type == MtxEvent.VideoMessage || model.type == MtxEvent.AudioMessage || model.type == MtxEvent.FileMessage || model.type == MtxEvent.Sticker
|
|
|
|
text: qsTr("Save as")
|
2019-12-03 04:26:41 +03:00
|
|
|
onTriggered: timelineManager.timeline.saveMedia(model.id)
|
2019-10-08 21:55:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
|
|
|
text: model.timestamp.toLocaleTimeString("HH:mm")
|
|
|
|
color: inactiveColors.text
|
|
|
|
|
|
|
|
MouseArea{
|
|
|
|
id: ma
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
}
|
2019-10-17 10:36:16 +03:00
|
|
|
|
|
|
|
ToolTip {
|
|
|
|
visible: ma.containsMouse
|
|
|
|
text: Qt.formatDateTime(model.timestamp, Qt.DefaultLocaleLongDate)
|
|
|
|
palette: colors
|
|
|
|
}
|
2019-10-08 21:55:09 +03:00
|
|
|
}
|
|
|
|
}
|