diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-09-18 22:58:25 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2019-11-23 20:06:14 +0100 |
commit | 240b3a566b8f73261bd6c48ae7480800136e3ec2 (patch) | |
tree | 5c8c4a6d4434fa5c458dfee293bfcac8d8f8a69b /resources | |
parent | 5200db17e9d2b816389b28f8587a03c6bf1b4059 (diff) |
Add send/received indicator
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/StatusIndicator.qml | 44 | ||||
-rw-r--r-- | resources/qml/TimelineView.qml | 5 | ||||
-rw-r--r-- | resources/res.qrc | 1 |
3 files changed, 50 insertions, 0 deletions
diff --git a/resources/qml/StatusIndicator.qml b/resources/qml/StatusIndicator.qml new file mode 100644 index 00000000..0b14e246 --- /dev/null +++ b/resources/qml/StatusIndicator.qml @@ -0,0 +1,44 @@ +import QtQuick 2.5 +import QtQuick.Controls 2.5 +import QtGraphicalEffects 1.0 +import com.github.nheko 1.0 + +Rectangle { + id: indicator + property int state: 0 + color: "transparent" + width: 16 + height: 16 + ToolTip.visible: ma.containsMouse + 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 qsTr("Empty") + } + MouseArea{ + id: ma + anchors.fill: parent + hoverEnabled: true + } + + Image { + id: stateImg + // Workaround, can't get icon.source working for now... + anchors.fill: parent + source: switch (indicator.state) { + case MtxEvent.Failed: return "qrc:/icons/icons/ui/remove-symbol.png" + case MtxEvent.Sent: return "qrc:/icons/icons/ui/clock.png" + case MtxEvent.Received: return "qrc:/icons/icons/ui/checkmark.png" + case MtxEvent.Read: return "qrc:/icons/icons/ui/double-tick-indicator.png" + default: return "" + } + } + ColorOverlay { + anchors.fill: stateImg + source: stateImg + color: colors.buttonText + } +} + diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index f82cf60a..5eb00b06 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -116,6 +116,11 @@ Rectangle { property variant eventData: model } + StatusIndicator { + state: model.state + Layout.alignment: Qt.AlignRight | Qt.AlignTop + Layout.preferredHeight: 16 + } Button { Layout.alignment: Qt.AlignRight | Qt.AlignTop diff --git a/resources/res.qrc b/resources/res.qrc index 6eb61e3d..a9cf885b 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -117,6 +117,7 @@ <qresource prefix="/"> <file>qml/TimelineView.qml</file> <file>qml/Avatar.qml</file> + <file>qml/StatusIndicator.qml</file> <file>qml/delegates/TextMessage.qml</file> <file>qml/delegates/NoticeMessage.qml</file> <file>qml/delegates/ImageMessage.qml</file> |