diff --git a/src/qml/Base/HImage.qml b/src/qml/Base/HImage.qml index a2ef427b..76b433e8 100644 --- a/src/qml/Base/HImage.qml +++ b/src/qml/Base/HImage.qml @@ -7,13 +7,18 @@ Image { asynchronous: true fillMode: Image.PreserveAspectFit - cache: ! loader.sourceComponent && + cache: ! (animate && animated) && (sourceSize.width + sourceSize.height) <= 512 property bool animate: true property color colorize: "transparent" + readonly property bool animated: + image.source.toString() + .split("/").splice(-1)[0].split("?")[0].toLowerCase() + .endsWith(".gif") + layer.enabled: ! Qt.colorEqual(colorize, "transparent") layer.effect: ColorOverlay { @@ -37,17 +42,19 @@ Image { verticalAlignment: image.verticalAlignment cache: true // Needed to allow GIFs to loop - paused: ! visible || window.hidden + paused: ! visible || window.hidden || userPaused + + property bool userPaused: false + + TapHandler { + onTapped: parent.userPaused = ! parent.userPaused + } } } HLoader { id: loader anchors.fill: parent - sourceComponent: - animate && - image.source.toString() - .split("/").splice(-1)[0].split("?")[0].toLowerCase() - .endsWith(".gif") ? animatedImage : null + sourceComponent: animate && animated ? animatedImage : null } } diff --git a/src/qml/Chat/Timeline/EventImage.qml b/src/qml/Chat/Timeline/EventImage.qml index ed8f3113..880c4f63 100644 --- a/src/qml/Chat/Timeline/EventImage.qml +++ b/src/qml/Chat/Timeline/EventImage.qml @@ -13,7 +13,8 @@ HImage { ) TapHandler { - onTapped: Qt.openUrlExternally(image.source) + onTapped: if (! image.animated) Qt.openUrlExternally(image.source) + onDoubleTapped: Qt.openUrlExternally(image.source) } HoverHandler { diff --git a/src/qml/Pages/EditAccount/Profile.qml b/src/qml/Pages/EditAccount/Profile.qml index 95b8ef24..d3a27a73 100644 --- a/src/qml/Pages/EditAccount/Profile.qml +++ b/src/qml/Pages/EditAccount/Profile.qml @@ -61,7 +61,6 @@ HGridLayout { avatarUrl: accountInfo.avatar_url imageUrl: fileDialog.selectedFile || fileDialog.file || defaultImageUrl toolTipImageUrl: "" - animate: true // note: matrix doesn't actually support gif avatars Layout.alignment: Qt.AlignHCenter