From e36b090c5b5365620e061c914559278af725e5c5 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 10:05:24 -0500 Subject: [PATCH] Add support for viewing avatar images in full size --- resources/qml/Avatar.qml | 10 ++++++++++ src/timeline/TimelineViewManager.cpp | 1 + 2 files changed, 11 insertions(+) diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 4adff572..4ca32286 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -9,6 +9,8 @@ Rectangle { property alias url: img.source property string userid property string displayName + + property string usrUrl: TimelineManager.timeline.avatarUrl(userid) width: 48 height: 48 @@ -49,6 +51,14 @@ Rectangle { } + MouseArea { + id: mouseArea + + anchors.fill: parent + onClicked: { + TimelineManager.openImageOverlay(usrUrl, TimelineManager.timeline.data.id) + } + } } Rectangle { diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 3b80d020..6da8528e 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -339,6 +339,7 @@ TimelineViewManager::toggleCameraView() void TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const { + if (mxcUrl.isEmpty() || mxcUrl.isNull()) { return; } QQuickImageResponse *imgResponse = imgProvider->requestImageResponse(mxcUrl.remove("mxc://"), QSize()); connect(imgResponse, &QQuickImageResponse::finished, this, [this, eventId, imgResponse]() {