Debian Codegraph @

resources/qml/StatusIndicator.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import QtQuick 2.5
6 import QtQuick.Controls 2.1
7 import im.nheko 1.0
8
9 ImageButton {
10 id: indicator
11
12 required property string eventId
13 required property int status
14
15 ToolTip.text: {
16 switch (status) {
17 case MtxEvent.Failed:
18 return qsTr("Failed");
19 case MtxEvent.Sent:
20 return qsTr("Sent");
21 case MtxEvent.Received:
22 return qsTr("Received");
23 case MtxEvent.Read:
24 return qsTr("Read");
25 default:
26 return "";
27 }
28 }
29 ToolTip.visible: hovered && status != MtxEvent.Empty
30 changeColorOnHover: (status == MtxEvent.Read)
31 cursor: (status == MtxEvent.Read) ? Qt.PointingHandCursor : Qt.ArrowCursor
32 height: 16
33 hoverEnabled: true
34 image: {
35 switch (status) {
36 case MtxEvent.Failed:
37 return ":/icons/icons/ui/dismiss.svg";
38 case MtxEvent.Sent:
39 return ":/icons/icons/ui/clock.svg";
40 case MtxEvent.Received:
41 return ":/icons/icons/ui/checkmark.svg";
42 case MtxEvent.Read:
43 return ":/icons/icons/ui/double-checkmark.svg";
44 default:
45 return "";
46 }
47 }
48 width: 16
49
50 onClicked: {
51 if (status == MtxEvent.Read)
52 room.showReadReceipts(eventId);
53 }
54 }