From a0c2a174eaf1446e8ed42a2e396c1bb9ce885b7e Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Tue, 13 Oct 2020 16:24:42 -0400 Subject: Display filename on mouse hover --- resources/qml/delegates/ImageMessage.qml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'resources/qml/delegates/ImageMessage.qml') 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" + } + } + } + } } -- cgit 1.5.1 From e3c665661393b7495d275bc23fb68a158c5df3fb Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Wed, 14 Oct 2020 18:07:09 -0400 Subject: Avoid hardcoded font size --- resources/qml/delegates/ImageMessage.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'resources/qml/delegates/ImageMessage.qml') diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index 8307bdd6..3f6d9951 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -61,10 +61,10 @@ Item { 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" } } } + } } -- cgit 1.5.1 From e1c4f7d516b2096c5b133fb7610a8a83755503a0 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Thu, 15 Oct 2020 11:52:49 -0400 Subject: Make Text element a sibling of the Rectangle to avoid the text from depending on the rectangle's opacity property. Switch to Nheko theme colors --- resources/qml/delegates/ImageMessage.qml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'resources/qml/delegates/ImageMessage.qml') diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index 3f6d9951..6ac5ee15 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -43,28 +43,28 @@ Item { anchors.fill: parent visible: mouseArea.containsMouse - + Rectangle { id: container + width: parent.width implicitHeight: imgcaption.implicitHeight anchors.bottom: overlay.bottom - color: "black" + color: colors.window 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 - color: "white" - } + Text { + id: imgcaption + + anchors.fill: container + 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 + color: colors.text } } - } } -- cgit 1.5.1 From b3a7f0b88807a1d3e2a4d7acf121db0aedfc157f Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 18 Oct 2020 22:30:42 +0200 Subject: Hide room name, if not loaded yet --- resources/qml/TimelineView.qml | 2 +- resources/qml/delegates/ImageMessage.qml | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'resources/qml/delegates/ImageMessage.qml') diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index ab0148e9..1f5f406a 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -159,6 +159,7 @@ Page { } ColumnLayout { + visible: TimelineManager.timeline != null anchors.fill: parent Rectangle { @@ -287,7 +288,6 @@ Page { property int delegateMaxWidth: (Settings.timelineMaxWidth > 100 && (parent.width - Settings.timelineMaxWidth) > scrollbar.width * 2) ? Settings.timelineMaxWidth : (parent.width - scrollbar.width * 2) - visible: TimelineManager.timeline != null cacheBuffer: 400 Layout.fillWidth: true Layout.fillHeight: true diff --git a/resources/qml/delegates/ImageMessage.qml b/resources/qml/delegates/ImageMessage.qml index 6ac5ee15..5c3dac95 100644 --- a/resources/qml/delegates/ImageMessage.qml +++ b/resources/qml/delegates/ImageMessage.qml @@ -32,6 +32,7 @@ Item { MouseArea { id: mouseArea + enabled: model.data.type == MtxEvent.ImageMessage && img.status == Image.Ready hoverEnabled: true anchors.fill: parent @@ -40,23 +41,23 @@ Item { Item { id: overlay - + anchors.fill: parent visible: mouseArea.containsMouse Rectangle { id: container - + width: parent.width implicitHeight: imgcaption.implicitHeight - anchors.bottom: overlay.bottom + anchors.bottom: overlay.bottom color: colors.window opacity: 0.75 } Text { id: imgcaption - + anchors.fill: container elide: Text.ElideMiddle horizontalAlignment: Text.AlignHCenter @@ -65,6 +66,9 @@ Item { text: model.data.filename ? model.data.filename : model.data.body color: colors.text } + } + } + } -- cgit 1.5.1