summary refs log tree commit diff
path: root/resources/qml/ReplyPopup.qml
blob: c07c2c44f5c4fa52d44adc676f0a17c9a48be268 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import "./delegates/"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0

Rectangle {
    id: replyPopup

    property var room: TimelineManager.timeline

    Layout.fillWidth: true
    visible: room && (room.reply || room.edit)
    // Height of child, plus margins, plus border
    implicitHeight: (room && room.reply ? replyPreview.height : closeEditButton.height) + 10
    color: colors.window
    z: 3

    Reply {
        id: replyPreview

        visible: room && room.reply
        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) : {
        }
        userColor: TimelineManager.userColor(modelData.userId, colors.window)
    }

    ImageButton {
        id: closeReplyButton

        visible: room && room.reply
        anchors.right: parent.right
        anchors.rightMargin: 16
        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
    }

    Button {
        id: closeEditButton

        visible: room && room.edit
        anchors.left: parent.left
        anchors.rightMargin: 16
        anchors.topMargin: 10
        anchors.top: parent.top
        //height: 16
        text: qsTr("Cancel edit")
        onClicked: room.edit = undefined
    }

}