From 69aea0e37fa9ea280aa1967b2c967206a8b1e158 Mon Sep 17 00:00:00 2001 From: miruka Date: Sat, 14 Sep 2019 01:03:56 -0400 Subject: [PATCH] EventImage: open/copy original image on clicks --- TODO.md | 2 ++ src/qml/Chat/Timeline/EventImage.qml | 11 ++++++++--- src/qml/Chat/Timeline/EventMediaLoader.qml | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 26c399a8..676169fd 100644 --- a/TODO.md +++ b/TODO.md @@ -1,10 +1,12 @@ - Media - Caching - Downloading + - Uploading (+local echo) - GIF thumbnails: load the real animated image - Files, links, video, audio - Encrypted media - Loading animation + - Copy thumbnail URL in context menu? - RoomMessageNotice diff --git a/src/qml/Chat/Timeline/EventImage.qml b/src/qml/Chat/Timeline/EventImage.qml index 880c4f63..67453709 100644 --- a/src/qml/Chat/Timeline/EventImage.qml +++ b/src/qml/Chat/Timeline/EventImage.qml @@ -12,15 +12,20 @@ HImage { theme.chat.message.thumbnailWidth, ) + + // source = thumbnail, fullSource = full original image + property url fullSource: source + + TapHandler { - onTapped: if (! image.animated) Qt.openUrlExternally(image.source) - onDoubleTapped: Qt.openUrlExternally(image.source) + onTapped: if (! image.animated) Qt.openUrlExternally(image.fullSource) + onDoubleTapped: Qt.openUrlExternally(image.fullSource) } HoverHandler { id: hover onHoveredChanged: - eventContent.hoveredImage = hovered ? image.source : "" + eventContent.hoveredImage = hovered ? image.fullSource : "" } MouseArea { diff --git a/src/qml/Chat/Timeline/EventMediaLoader.qml b/src/qml/Chat/Timeline/EventMediaLoader.qml index 508a3187..cf3a0563 100644 --- a/src/qml/Chat/Timeline/EventMediaLoader.qml +++ b/src/qml/Chat/Timeline/EventMediaLoader.qml @@ -55,7 +55,7 @@ HLoader { onPreviewUrlChanged: { if (type === EventMediaLoader.Type.Image) { var file = "EventImage.qml" - var props = { source: previewUrl } + var props = { source: previewUrl, fullSource: mediaUrl } } else { return }