Download and show full picture for m.image GIFs

This commit is contained in:
miruka 2019-11-04 10:29:41 -04:00
parent 02c6ec4500
commit ca09effd6e
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,4 @@
import QtQuick 2.12
import "../utils.js" as Utils
HImage {
id: image
@ -13,6 +12,7 @@ HImage {
property string clientUserId
property string mxc
property string sourceOverride: ""
property bool thumbnail: true
property bool show: false
property string cachedPath: ""
@ -27,8 +27,6 @@ HImage {
return
}
let arg = [image.mxc, w, h]
if (! image) return // if it was destroyed
if (! image.mxc.startsWith("mxc://")) {
@ -37,8 +35,11 @@ HImage {
return
}
let method = image.thumbnail ? "get_thumbnail" : "get_media"
let args = image.thumbnail ? [image.mxc, w, h] : [image.mxc]
py.callClientCoro(
clientUserId, "media_cache.get_thumbnail", [mxc, w, h], path => {
clientUserId, "media_cache." + method, args, path => {
if (! image) return
image.cachedPath = path
show = image.visible

View File

@ -10,7 +10,8 @@ HMxcImage {
animated: loader.singleMediaInfo.media_mime === "image/gif" ||
Utils.urlExtension(loader.mediaUrl) === "gif"
clientUserId: chatPage.userId
mxc: animated ? openUrl : (loader.thumbnailMxc || loader.mediaUrl)
thumbnail: ! animated
mxc: thumbnail ? (loader.thumbnailMxc || loader.mediaUrl) : openUrl
property EventMediaLoader loader