2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2022-04-16 03:13:01 +03:00
|
|
|
import "delegates"
|
2021-01-12 17:03:39 +03:00
|
|
|
import QtQuick 2.9
|
2020-10-26 16:57:54 +03:00
|
|
|
import QtQuick.Controls 2.3
|
2021-01-12 17:03:39 +03:00
|
|
|
import QtQuick.Layouts 1.2
|
2022-04-15 03:58:44 +03:00
|
|
|
import im.nheko
|
2020-10-26 16:57:54 +03:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: replyPopup
|
|
|
|
Layout.fillWidth: true
|
2022-04-16 03:13:01 +03:00
|
|
|
color: timelineRoot.palette.window
|
2020-10-26 16:57:54 +03:00
|
|
|
// Height of child, plus margins, plus border
|
2022-03-11 23:32:32 +03:00
|
|
|
implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + Nheko.paddingSmall
|
2022-04-16 03:13:01 +03:00
|
|
|
visible: room && (room.reply || room.edit)
|
2020-10-26 16:57:54 +03:00
|
|
|
z: 3
|
|
|
|
|
|
|
|
Reply {
|
|
|
|
id: replyPreview
|
|
|
|
|
2022-04-16 03:13:01 +03:00
|
|
|
property var modelData: room ? room.getDump(room.reply, room.id) : {}
|
2021-07-12 01:24:33 +03:00
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
anchors.left: parent.left
|
2022-04-16 03:13:01 +03:00
|
|
|
anchors.leftMargin: replyPopup.width < 450 ? Nheko.paddingSmall : (CallManager.callsSupported ? 2 * (22 + 16) : 1 * (22 + 16))
|
2022-03-11 23:32:32 +03:00
|
|
|
anchors.right: parent.right
|
2022-04-16 03:13:01 +03:00
|
|
|
anchors.rightMargin: replyPopup.width < 450 ? 2 * (22 + 16) : 3 * (22 + 16)
|
2022-03-11 23:32:32 +03:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Nheko.paddingSmall
|
2021-07-12 01:24:33 +03:00
|
|
|
blurhash: modelData.blurhash ?? ""
|
|
|
|
body: modelData.body ?? ""
|
2022-04-16 03:13:01 +03:00
|
|
|
encryptionError: modelData.encryptionError ?? 0
|
2021-07-12 01:24:33 +03:00
|
|
|
eventId: modelData.eventId ?? ""
|
|
|
|
filename: modelData.filename ?? ""
|
|
|
|
filesize: modelData.filesize ?? ""
|
2022-04-16 03:13:01 +03:00
|
|
|
formattedBody: modelData.formattedBody ?? ""
|
|
|
|
isOnlyEmoji: modelData.isOnlyEmoji ?? false
|
|
|
|
originalWidth: modelData.originalWidth ?? 0
|
2021-07-12 01:24:33 +03:00
|
|
|
proportionalHeight: modelData.proportionalHeight ?? 1
|
|
|
|
type: modelData.type ?? MtxEvent.UnknownMessage
|
|
|
|
typeString: modelData.typeString ?? ""
|
|
|
|
url: modelData.url ?? ""
|
2022-04-16 03:13:01 +03:00
|
|
|
userColor: TimelineManager.userColor(modelData.userId, timelineRoot.palette.window)
|
2021-07-12 01:24:33 +03:00
|
|
|
userId: modelData.userId ?? ""
|
|
|
|
userName: modelData.userName ?? ""
|
2022-04-16 03:13:01 +03:00
|
|
|
visible: room && room.reply
|
2022-02-12 00:02:30 +03:00
|
|
|
width: parent.width
|
2020-10-26 16:57:54 +03:00
|
|
|
}
|
|
|
|
ImageButton {
|
|
|
|
id: closeReplyButton
|
2022-04-16 03:13:01 +03:00
|
|
|
ToolTip.text: qsTr("Close")
|
|
|
|
ToolTip.visible: closeReplyButton.hovered
|
|
|
|
anchors.margins: Nheko.paddingSmall
|
2022-03-11 23:32:32 +03:00
|
|
|
anchors.right: replyPreview.right
|
2020-10-26 16:57:54 +03:00
|
|
|
anchors.top: replyPreview.top
|
|
|
|
height: 16
|
2022-04-16 03:13:01 +03:00
|
|
|
hoverEnabled: true
|
2021-11-14 04:23:10 +03:00
|
|
|
image: ":/icons/icons/ui/dismiss.svg"
|
2022-04-16 03:13:01 +03:00
|
|
|
visible: room && room.reply
|
|
|
|
width: 16
|
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
onClicked: room.reply = undefined
|
|
|
|
}
|
2022-03-11 23:32:32 +03:00
|
|
|
ImageButton {
|
2021-02-01 04:22:53 +03:00
|
|
|
id: closeEditButton
|
2022-04-16 03:13:01 +03:00
|
|
|
ToolTip.text: qsTr("Cancel Edit")
|
|
|
|
ToolTip.visible: closeEditButton.hovered
|
2022-03-11 23:32:32 +03:00
|
|
|
anchors.margins: 8
|
2022-04-16 03:13:01 +03:00
|
|
|
anchors.right: parent.right
|
2021-02-01 04:22:53 +03:00
|
|
|
anchors.top: parent.top
|
2022-04-16 03:13:01 +03:00
|
|
|
height: 22
|
2022-03-11 23:32:32 +03:00
|
|
|
hoverEnabled: true
|
|
|
|
image: ":/icons/icons/ui/dismiss_edit.svg"
|
2022-04-16 03:13:01 +03:00
|
|
|
visible: room && room.edit
|
2022-03-11 23:32:32 +03:00
|
|
|
width: 22
|
2022-04-16 03:13:01 +03:00
|
|
|
|
2021-02-01 04:22:53 +03:00
|
|
|
onClicked: room.edit = undefined
|
|
|
|
}
|
2020-10-26 16:57:54 +03:00
|
|
|
}
|