blob: 82658f58ea9ee0088a3cc24d8628db55f133415f (
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
63
64
65
66
67
|
// SPDX-FileCopyrightText: Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
Rectangle {
id: warningRoot
property color bubbleColor: Nheko.theme.error
required property string text
property bool showRemove: false
signal removeClicked();
Layout.fillWidth: true
color: palette.window // required to hide the timeline behind this warning
height: implicitHeight
implicitHeight: visible ? warningDisplay.implicitHeight + 4 * Nheko.paddingSmall : 0
Rectangle {
id: warningRect
anchors.fill: parent
anchors.margins: visible ? Nheko.paddingSmall : 0
border.color: bubbleColor
border.width: 1
// TODO: Qt.alpha() would make more sense but it wasn't working...
color: Qt.rgba(bubbleColor.r, bubbleColor.g, bubbleColor.b, 0.3)
radius: 3
visible: warningRoot.visible
z: 3
Label {
id: warningDisplay
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Nheko.paddingSmall
anchors.rightMargin: warningRoot.showRemove ? (Nheko.paddingSmall*3 + removeButton.width) : Nheko.paddingSmall
anchors.verticalCenter: parent.verticalCenter
text: warningRoot.text
textFormat: Text.PlainText
}
ImageButton {
id: removeButton
visible: warningRoot.showRemove
anchors.right: parent.right
anchors.margins: Nheko.paddingSmall
anchors.verticalCenter: parent.verticalCenter
image: ":/icons/icons/ui/dismiss.svg"
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Don't mention them in this message")
onClicked: {
warningRoot.removeClicked();
}
}
}
}
|