You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/resources/qml/ReplyPopup.qml

87 lines
2.7 KiB

// SPDX-FileCopyrightText: Nheko Contributors
//
// 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
2 years ago
color: palette.window
// Height of child, plus margins, plus border
implicitHeight: (room && room.reply ? replyPreview.height : Math.max(closeEditButton.height, closeThreadButton.height)) + Nheko.paddingSmall
2 years ago
visible: room && (room.reply || room.edit || room.thread)
z: 3
Reply {
id: replyPreview
2 years ago
property var modelData: room ? room.getDump(room.reply, room.id) : {}
anchors.left: parent.left
2 years ago
anchors.leftMargin: replyPopup.width < 450 ? Nheko.paddingSmall : (CallManager.callsSupported ? 2 * (22 + 16) : 1 * (22 + 16))
anchors.right: parent.right
2 years ago
anchors.rightMargin: replyPopup.width < 450 ? 2 * (22 + 16) : 3 * (22 + 16)
anchors.top: parent.top
anchors.topMargin: Nheko.paddingSmall
eventId: room.reply ?? ""
2 years ago
userColor: TimelineManager.userColor(modelData.userId, palette.window)
visible: room && room.reply
maxWidth: parent.width - anchors.leftMargin - anchors.rightMargin
}
ImageButton {
id: closeReplyButton
2 years ago
ToolTip.text: qsTr("Close")
ToolTip.visible: closeReplyButton.hovered
anchors.margins: Nheko.paddingSmall
anchors.right: replyPreview.right
anchors.top: replyPreview.top
height: 16
2 years ago
hoverEnabled: true
image: ":/icons/icons/ui/dismiss.svg"
2 years ago
visible: room && room.reply
width: 16
onClicked: room.reply = undefined
}
ImageButton {
id: closeEditButton
2 years ago
ToolTip.text: qsTr("Cancel Edit")
ToolTip.visible: closeEditButton.hovered
anchors.margins: 8
2 years ago
anchors.right: closeThreadButton.left
anchors.top: parent.top
2 years ago
height: 22
hoverEnabled: true
image: ":/icons/icons/ui/dismiss_edit.svg"
2 years ago
visible: room && room.edit
width: 22
2 years ago
onClicked: room.edit = undefined
}
ImageButton {
id: closeThreadButton
2 years ago
ToolTip.text: qsTr("Cancel Thread")
ToolTip.visible: closeThreadButton.hovered
anchors.margins: 8
2 years ago
anchors.right: parent.right
anchors.top: parent.top
buttonTextColor: room ? TimelineManager.userColor(room.thread, palette.base) : palette.buttonText
2 years ago
height: 22
hoverEnabled: true
image: ":/icons/icons/ui/dismiss_thread.svg"
2 years ago
visible: room && room.thread
width: 22
2 years ago
onClicked: room.thread = undefined
}
}