matrixion/resources/qml/StatusIndicator.qml

57 lines
1.3 KiB
QML
Raw Normal View History

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
property int state: 0
property string eventId
2020-10-08 22:11:21 +03:00
width: 16
height: 16
hoverEnabled: true
ToolTip.visible: hovered && state != MtxEvent.Empty
2020-10-08 22:11:21 +03:00
ToolTip.text: {
switch (state) {
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 (state == MtxEvent.Read)
TimelineManager.timeline.readReceiptsAction(eventId);
2020-10-08 22:11:21 +03:00
}
image: {
switch (state) {
case MtxEvent.Failed:
return ":/icons/icons/ui/remove-symbol.png";
case MtxEvent.Sent:
return ":/icons/icons/ui/clock.png";
case MtxEvent.Received:
return ":/icons/icons/ui/checkmark.png";
case MtxEvent.Read:
return ":/icons/icons/ui/double-tick-indicator.png";
default:
return "";
2020-10-08 22:11:21 +03:00
}
}
changeColorOnHover: {
if (state == MtxEvent.Read)
return true;
else
return false;
}
2020-10-08 22:11:21 +03:00
}