Newer
Older
// SPDX-FileCopyrightText: Nheko Contributors
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
Rectangle {
id: replyPopup
Layout.fillWidth: true
// Height of child, plus margins, plus border
implicitHeight: (room && room.reply ? replyPreview.height : Math.max(closeEditButton.height, closeThreadButton.height)) + Nheko.paddingSmall
z: 3
Reply {
id: replyPreview
property var modelData: room ? room.getDump(room.reply, room.id) : {}
anchors.left: parent.left
anchors.leftMargin: replyPopup.width < 450 ? Nheko.paddingSmall : (CallManager.callsSupported ? 2 * (22 + 16) : 1 * (22 + 16))
anchors.rightMargin: replyPopup.width < 450 ? 2 * (22 + 16) : 3 * (22 + 16)
anchors.top: parent.top
anchors.topMargin: Nheko.paddingSmall
eventId: room.reply ?? ""
userColor: TimelineManager.userColor(modelData.userId, palette.window)
visible: room && room.reply
maxWidth: parent.width - anchors.leftMargin - anchors.rightMargin
}
ImageButton {
id: closeReplyButton
ToolTip.text: qsTr("Close")
ToolTip.visible: closeReplyButton.hovered
anchors.margins: Nheko.paddingSmall
anchors.top: replyPreview.top
height: 16
image: ":/icons/icons/ui/dismiss.svg"
onClicked: room.reply = undefined
}
ToolTip.text: qsTr("Cancel Edit")
ToolTip.visible: closeEditButton.hovered
hoverEnabled: true
image: ":/icons/icons/ui/dismiss_edit.svg"
ToolTip.text: qsTr("Cancel Thread")
ToolTip.visible: closeThreadButton.hovered
buttonTextColor: room ? TimelineManager.userColor(room.thread, palette.base) : palette.buttonText