diff --git a/src/backend/user_files.py b/src/backend/user_files.py index 42ec3321..96873328 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -284,6 +284,7 @@ class UISettings(JSONDataFile): "autoPlayGIF": True, "autoHideOSDAfterMsec": 3000, "defaultVolume": 100, + "openExternallyOnClick": False, "startMuted": False, }, "keys": { diff --git a/src/gui/Pages/Chat/Timeline/EventImage.qml b/src/gui/Pages/Chat/Timeline/EventImage.qml index 3d9a5922..af62e859 100644 --- a/src/gui/Pages/Chat/Timeline/EventImage.qml +++ b/src/gui/Pages/Chat/Timeline/EventImage.qml @@ -42,6 +42,19 @@ HMxcImage { Math.max(maxHeight, theme.chat.message.thumbnailMinSize.height), ) + function openInternally() { + eventList.openImageViewer( + singleMediaInfo, + loader.mediaUrl.startsWith("mxc://") ? "" : loader.mediaUrl, + ) + } + + function openExternally() { + loader.isMedia ? + eventList.openMediaExternally(singleMediaInfo) : + Qt.openUrlExternally(loader.mediaUrl) + } + width: fitSize.width height: fitSize.height @@ -78,10 +91,9 @@ HMxcImage { return } - eventList.openImageViewer( - singleMediaInfo, - loader.mediaUrl.startsWith("mxc://") ? "" : loader.mediaUrl, - ) + window.settings.media.openExternallyOnClick ? + image.openExternally() : + image.openInternally() } } @@ -89,11 +101,10 @@ HMxcImage { acceptedButtons: Qt.MiddleButton acceptedModifiers: Qt.NoModifier gesturePolicy: TapHandler.ReleaseWithinBounds - onTapped: { - loader.isMedia ? - eventList.openMediaExternally(singleMediaInfo) : - Qt.openUrlExternally(loader.mediaUrl) - } + onTapped: + window.settings.media.openExternallyOnClick ? + image.openInternally() : + image.openExternally() } TapHandler {