2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2021-03-07 07:57:56 +03:00
|
|
|
//
|
2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2020-10-26 16:57:54 +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
|
2020-10-26 16:57:54 +03:00
|
|
|
import im.nheko 1.0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: replyPopup
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
2021-02-01 04:22:53 +03:00
|
|
|
visible: room && (room.reply || room.edit)
|
2020-10-26 16:57:54 +03:00
|
|
|
// Height of child, plus margins, plus border
|
2021-02-01 04:22:53 +03:00
|
|
|
implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + 10
|
2021-05-13 09:23:56 +03:00
|
|
|
color: Nheko.colors.window
|
2020-10-26 16:57:54 +03:00
|
|
|
z: 3
|
|
|
|
|
|
|
|
Reply {
|
|
|
|
id: replyPreview
|
|
|
|
|
2021-02-02 20:54:45 +03:00
|
|
|
visible: room && room.reply
|
2020-10-26 16:57:54 +03:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 2 * 22 + 3 * 16
|
|
|
|
anchors.right: closeReplyButton.left
|
|
|
|
anchors.rightMargin: 2 * 22 + 3 * 16
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
modelData: room ? room.getDump(room.reply, room.id) : {
|
|
|
|
}
|
2021-05-13 09:23:56 +03:00
|
|
|
userColor: TimelineManager.userColor(modelData.userId, Nheko.colors.window)
|
2020-10-26 16:57:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ImageButton {
|
|
|
|
id: closeReplyButton
|
|
|
|
|
2021-02-02 20:54:45 +03:00
|
|
|
visible: room && room.reply
|
2020-10-26 16:57:54 +03:00
|
|
|
anchors.right: parent.right
|
2021-02-01 04:22:53 +03:00
|
|
|
anchors.rightMargin: 16
|
2020-10-26 16:57:54 +03:00
|
|
|
anchors.top: replyPreview.top
|
|
|
|
hoverEnabled: true
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
image: ":/icons/icons/ui/remove-symbol.png"
|
|
|
|
ToolTip.visible: closeReplyButton.hovered
|
|
|
|
ToolTip.text: qsTr("Close")
|
|
|
|
onClicked: room.reply = undefined
|
|
|
|
}
|
|
|
|
|
2021-02-01 04:22:53 +03:00
|
|
|
Button {
|
|
|
|
id: closeEditButton
|
|
|
|
|
2021-02-02 20:54:45 +03:00
|
|
|
visible: room && room.edit
|
2021-02-01 04:22:53 +03:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.rightMargin: 16
|
|
|
|
anchors.topMargin: 10
|
|
|
|
anchors.top: parent.top
|
|
|
|
//height: 16
|
2021-02-10 16:11:55 +03:00
|
|
|
text: qsTr("Cancel edit")
|
2021-02-01 04:22:53 +03:00
|
|
|
onClicked: room.edit = undefined
|
|
|
|
}
|
|
|
|
|
2020-10-26 16:57:54 +03:00
|
|
|
}
|