summary refs log tree commit diff
path: root/resources/qml/delegates
diff options
context:
space:
mode:
authorkamathmanu <manuriddle@gmail.com>2020-10-13 16:24:42 -0400
committerkamathmanu <manuriddle@gmail.com>2020-10-13 16:24:42 -0400
commita0c2a174eaf1446e8ed42a2e396c1bb9ce885b7e (patch)
treeae238fab6244eab742603e4e3561a7672d5bfd15 /resources/qml/delegates
parentUpdate translations (diff)
downloadnheko-a0c2a174eaf1446e8ed42a2e396c1bb9ce885b7e.tar.xz
Display filename on mouse hover
Diffstat (limited to 'resources/qml/delegates')
-rw-r--r--resources/qml/delegates/ImageMessage.qml31
1 files changed, 30 insertions, 1 deletions
diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml
index e2c78fbe..8307bdd6 100644
--- a/resources/qml/delegates/ImageMessage.qml
+++ b/resources/qml/delegates/ImageMessage.qml
@@ -31,11 +31,40 @@ Item {
         fillMode: Image.PreserveAspectFit
 
         MouseArea {
+            id: mouseArea
             enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready
+            hoverEnabled: true
             anchors.fill: parent
             onClicked: TimelineManager.openImageOverlay(model.data.url, model.data.id)
         }
 
-    }
+        Item {
+            id: overlay
+        
+            anchors.fill: parent
+            visible: mouseArea.containsMouse
+            
+            Rectangle {
+                id: container
+                width: parent.width
+                implicitHeight: imgcaption.implicitHeight
+                anchors.bottom: overlay.bottom 
+                color: "black"
+                opacity: 0.75
+
+                Text {
+                    id: imgcaption
 
+                    anchors.fill: parent
+                    elide: Text.ElideMiddle
+                    horizontalAlignment: Text.AlignHCenter
+                    verticalAlignment: Text.AlignVCenter
+                    // See this MSC: https://github.com/matrix-org/matrix-doc/pull/2530
+                    text: model.data.filename ? model.data.filename : model.data.body
+                    font.pointSize: 11
+                    color: "white"
+                }
+            }
+        }
+    }
 }