Fix image events opened/copied url
This commit is contained in:
parent
ca09effd6e
commit
de8d0b5823
|
@ -138,6 +138,11 @@ class Backend:
|
|||
return hsluv.hsluv_to_rgb([hue, saturation, lightness])
|
||||
|
||||
|
||||
@staticmethod
|
||||
async def mxc_to_http(mxc: str) -> Optional[str]:
|
||||
return nio.Api.mxc_to_http(mxc)
|
||||
|
||||
|
||||
@staticmethod
|
||||
async def check_exported_keys_passphrase(file_path: str, passphrase: str,
|
||||
) -> Union[bool, Tuple[str, bool]]:
|
||||
|
|
|
@ -3,10 +3,18 @@ import QtQuick 2.12
|
|||
HImage {
|
||||
id: image
|
||||
source: sourceOverride || (show ? cachedPath : "")
|
||||
onMxcChanged: Qt.callLater(update)
|
||||
onWidthChanged: Qt.callLater(update)
|
||||
onHeightChanged: Qt.callLater(update)
|
||||
onVisibleChanged: Qt.callLater(update)
|
||||
onMxcChanged: {
|
||||
Qt.callLater(update)
|
||||
|
||||
if (mxc.startsWith("mxc://")) {
|
||||
py.callCoro("mxc_to_http", [mxc], http => { httpUrl = http || "" })
|
||||
} else {
|
||||
httpUrl = mxc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
property string clientUserId
|
||||
|
@ -16,6 +24,7 @@ HImage {
|
|||
|
||||
property bool show: false
|
||||
property string cachedPath: ""
|
||||
property string httpUrl: ""
|
||||
|
||||
|
||||
function update() {
|
||||
|
|
|
@ -11,23 +11,24 @@ HMxcImage {
|
|||
Utils.urlExtension(loader.mediaUrl) === "gif"
|
||||
clientUserId: chatPage.userId
|
||||
thumbnail: ! animated
|
||||
mxc: thumbnail ? (loader.thumbnailMxc || loader.mediaUrl) : openUrl
|
||||
mxc: thumbnail ?
|
||||
(loader.thumbnailMxc || loader.mediaUrl) :
|
||||
(loader.mediaUrl || loader.thumbnailMxc)
|
||||
|
||||
|
||||
property EventMediaLoader loader
|
||||
readonly property url openUrl: loader.mediaUrl || loader.thumbnailMxc
|
||||
|
||||
|
||||
TapHandler {
|
||||
onTapped: if (! image.animated) Qt.openUrlExternally(openUrl)
|
||||
onDoubleTapped: Qt.openUrlExternally(openUrl)
|
||||
onTapped: if (! image.animated) Qt.openUrlExternally(image.httpUrl)
|
||||
onDoubleTapped: Qt.openUrlExternally(image.httpUrl)
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hover
|
||||
onHoveredChanged:
|
||||
eventDelegate.hoveredMediaTypeUrl =
|
||||
hovered ? [EventDelegate.Media.Image, openUrl] : []
|
||||
hovered ? [EventDelegate.Media.Image, image.httpUrl] : []
|
||||
}
|
||||
|
||||
EventImageTextBubble {
|
||||
|
|
Loading…
Reference in New Issue
Block a user