From b61bf2a46b7fbda40aa092d23925558f98117019 Mon Sep 17 00:00:00 2001 From: John Gibbon Date: Tue, 19 Jan 2021 22:38:53 +0100 Subject: [PATCH] Implement TDLibPhoto qml element --- harbour-fernschreiber.pro | 2 ++ qml/components/TDLibPhoto.qml | 28 ++++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/harbour-fernschreiber.pro b/harbour-fernschreiber.pro index 82b4a20..9112867 100644 --- a/harbour-fernschreiber.pro +++ b/harbour-fernschreiber.pro @@ -62,6 +62,8 @@ DISTFILES += qml/harbour-fernschreiber.qml \ qml/components/StickerPicker.qml \ qml/components/PhotoTextsListItem.qml \ qml/components/TDLibImage.qml \ + qml/components/TDLibMinithumbnail.qml \ + qml/components/TDLibPhoto.qml \ qml/components/TDLibThumbnail.qml \ qml/components/VoiceNoteOverlay.qml \ qml/components/chatInformationPage/ChatInformationEditArea.qml \ diff --git a/qml/components/TDLibPhoto.qml b/qml/components/TDLibPhoto.qml index 567f129..f5cb838 100644 --- a/qml/components/TDLibPhoto.qml +++ b/qml/components/TDLibPhoto.qml @@ -19,6 +19,7 @@ import QtQuick 2.6 import WerkWolf.Fernschreiber 1.0 import Sailfish.Silica 1.0 +import QtGraphicalEffects 1.0 Item { id: tdLibPhoto @@ -31,6 +32,7 @@ Item { onPhotoChanged: setImageFile() function setImageFile() { + console.log("TDLibPhoto minithumb?", !!tdLibPhoto.photo.minithumbnail, minithumbnailLoader.active) if (photo) { var photoSize; for (var i = 0; i < photo.sizes.length; i++) { @@ -45,25 +47,15 @@ Item { } } - Loader { - anchors.fill: parent - active: !!tdLibPhoto.photo.minithumbnail - asynchronous: true - sourceComponent: Component { - Image { - id: minithumbnail - source: "data:image/jpg;base64,"+tdLibPhoto.photo.minithumbnail.data - asynchronous: true - fillMode: tdLibImage.fillMode - smooth: false - cache: false + TDLibMinithumbnail { + id: minithumbnailLoader + active: !!minithumbnail && tdLibImage.opacity < 1.0 + minithumbnail: tdLibPhoto.photo.minithumbnail + highlighted: parent.highlighted + } - layer { - enabled: tdLibPhoto.highlighted - effect: PressEffect { source: minithumbnail } - } - } - } + BackgroundImage { + visible: tdLibImage.opacity < 1.0 } TDLibImage {