matrixion/resources/qml/StatusIndicator.qml

55 lines
1.4 KiB
QML
Raw Normal View History

// SPDX-FileCopyrightText: Nheko Contributors
//
2021-03-05 02:35:15 +03:00
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.5
import QtQuick.Controls 2.1
import im.nheko 1.0
2019-09-18 23:58:25 +03:00
ImageButton {
2020-10-08 22:11:21 +03:00
id: indicator
required property int status
required property string eventId
2020-10-08 22:11:21 +03:00
width: 16
height: 16
hoverEnabled: true
changeColorOnHover: (status == MtxEvent.Read)
cursor: (status == MtxEvent.Read) ? Qt.PointingHandCursor : Qt.ArrowCursor
ToolTip.visible: hovered && status != MtxEvent.Empty
2020-10-08 22:11:21 +03:00
ToolTip.text: {
switch (status) {
2020-10-08 22:11:21 +03:00
case MtxEvent.Failed:
return qsTr("Failed");
case MtxEvent.Sent:
return qsTr("Sent");
case MtxEvent.Received:
return qsTr("Received");
case MtxEvent.Read:
return qsTr("Read");
default:
return "";
}
}
onClicked: {
if (status == MtxEvent.Read)
room.showReadReceipts(eventId);
2020-10-08 22:11:21 +03:00
2021-01-18 14:43:27 +03:00
}
image: {
switch (status) {
case MtxEvent.Failed:
2021-11-14 04:23:10 +03:00
return ":/icons/icons/ui/dismiss.svg";
case MtxEvent.Sent:
2021-11-14 04:23:10 +03:00
return ":/icons/icons/ui/clock.svg";
case MtxEvent.Received:
2021-11-14 04:23:10 +03:00
return ":/icons/icons/ui/checkmark.svg";
case MtxEvent.Read:
2021-11-14 04:23:10 +03:00
return ":/icons/icons/ui/double-checkmark.svg";
default:
return "";
2020-10-08 22:11:21 +03:00
}
}
}