matrixion/resources/qml/ReplyPopup.qml

103 lines
3.3 KiB
QML
Raw Normal View History

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