2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2021-03-07 07:57:56 +03:00
|
|
|
//
|
2021-03-05 02:35:15 +03:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-01-12 17:03:39 +03:00
|
|
|
import QtQuick 2.5
|
|
|
|
import QtQuick.Controls 2.1
|
2019-11-30 03:43:39 +03:00
|
|
|
import im.nheko 1.0
|
2019-09-18 23:58:25 +03:00
|
|
|
|
2021-01-16 18:02:55 +03:00
|
|
|
ImageButton {
|
2020-10-08 22:11:21 +03:00
|
|
|
id: indicator
|
|
|
|
|
2021-07-12 01:24:33 +03:00
|
|
|
required property int status
|
|
|
|
required property string eventId
|
|
|
|
|
2020-10-08 22:11:21 +03:00
|
|
|
width: 16
|
|
|
|
height: 16
|
2021-01-16 18:02:55 +03:00
|
|
|
hoverEnabled: true
|
2021-07-12 01:24:33 +03:00
|
|
|
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: {
|
2021-07-12 01:24:33 +03:00
|
|
|
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 "";
|
|
|
|
}
|
|
|
|
}
|
2021-01-16 18:02:55 +03:00
|
|
|
onClicked: {
|
2021-07-12 01:24:33 +03:00
|
|
|
if (status == MtxEvent.Read)
|
2021-07-24 01:11:33 +03:00
|
|
|
room.showReadReceipts(eventId);
|
2020-10-08 22:11:21 +03:00
|
|
|
|
2021-01-18 14:43:27 +03:00
|
|
|
}
|
2021-01-16 18:02:55 +03:00
|
|
|
image: {
|
2021-07-12 01:24:33 +03:00
|
|
|
switch (status) {
|
2021-01-16 18:02:55 +03:00
|
|
|
case MtxEvent.Failed:
|
2021-11-14 04:23:10 +03:00
|
|
|
return ":/icons/icons/ui/dismiss.svg";
|
2021-01-16 18:02:55 +03:00
|
|
|
case MtxEvent.Sent:
|
2021-11-14 04:23:10 +03:00
|
|
|
return ":/icons/icons/ui/clock.svg";
|
2021-01-16 18:02:55 +03:00
|
|
|
case MtxEvent.Received:
|
2021-11-14 04:23:10 +03:00
|
|
|
return ":/icons/icons/ui/checkmark.svg";
|
2021-01-16 18:02:55 +03:00
|
|
|
case MtxEvent.Read:
|
2021-11-14 04:23:10 +03:00
|
|
|
return ":/icons/icons/ui/double-checkmark.svg";
|
2021-01-16 18:02:55 +03:00
|
|
|
default:
|
|
|
|
return "";
|
2020-10-08 22:11:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|