From e36b090c5b5365620e061c914559278af725e5c5 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 10:05:24 -0500 Subject: [PATCH 1/5] 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]() { From 0edd75949b07ba9753d0c9a416d33318c1d0f8e1 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 14:56:39 -0500 Subject: [PATCH 2/5] Lint code --- src/timeline/TimelineViewManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 6da8528e..655e6aa7 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -339,7 +339,9 @@ TimelineViewManager::toggleCameraView() void TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const { - if (mxcUrl.isEmpty() || mxcUrl.isNull()) { return; } + if (mxcUrl.isEmpty() || mxcUrl.isNull()) { + return; + } QQuickImageResponse *imgResponse = imgProvider->requestImageResponse(mxcUrl.remove("mxc://"), QSize()); connect(imgResponse, &QQuickImageResponse::finished, this, [this, eventId, imgResponse]() { From a48c6353bf186b791fc4f6d8148905a54bbeb5e5 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 14:58:37 -0500 Subject: [PATCH 3/5] Update resources/qml/Avatar.qml Co-authored-by: DeepBlueV7.X --- resources/qml/Avatar.qml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 4ca32286..150a0ee7 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -55,9 +55,7 @@ Rectangle { id: mouseArea anchors.fill: parent - onClicked: { - TimelineManager.openImageOverlay(usrUrl, TimelineManager.timeline.data.id) - } + onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id) } } From d4cece2f4d5e44e0563cec2084b98284ed8a1c0b Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 14:58:50 -0500 Subject: [PATCH 4/5] Update resources/qml/Avatar.qml Co-authored-by: DeepBlueV7.X --- resources/qml/Avatar.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 150a0ee7..076e84c0 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -9,8 +9,6 @@ Rectangle { property alias url: img.source property string userid property string displayName - - property string usrUrl: TimelineManager.timeline.avatarUrl(userid) width: 48 height: 48 From 69997a3d74996c0d58dac3d18b95c2a30ec8f499 Mon Sep 17 00:00:00 2001 From: kamathmanu Date: Mon, 30 Nov 2020 15:10:59 -0500 Subject: [PATCH 5/5] Lint code --- src/timeline/TimelineViewManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 655e6aa7..5d954f72 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -339,7 +339,7 @@ TimelineViewManager::toggleCameraView() void TimelineViewManager::openImageOverlay(QString mxcUrl, QString eventId) const { - if (mxcUrl.isEmpty() || mxcUrl.isNull()) { + if (mxcUrl.isEmpty()) { return; } QQuickImageResponse *imgResponse =