Pause timeline GIF while image viewer is open

This commit is contained in:
miruka 2020-07-20 01:07:00 -04:00
parent 30ce271ebc
commit 15b1720775
3 changed files with 18 additions and 11 deletions

View File

@ -1,10 +1,9 @@
# TODO # TODO
- Image viewer: - Image viewer:
- fix gifs
- open externally in context menu in timeline thumbnail - open externally in context menu in timeline thumbnail
- hflickable support kinetic scrolling disabler and speed/decel settings - hflickable support kinetic scrolling disabler and speed/decel settings
- buttons - buttons (include a working GIF play/pause)
- keyboard controls - keyboard controls
- prevent drag-scrolling timeline when image opened - prevent drag-scrolling timeline when image opened

View File

@ -16,6 +16,7 @@ Image {
property alias radius: roundMask.radius property alias radius: roundMask.radius
property alias showProgressBar: progressBarLoader.active property alias showProgressBar: progressBarLoader.active
property bool pause: ! window.settings.media.autoPlayGIF
readonly property int circleRadius: readonly property int circleRadius:
Math.ceil(Math.max(image.width, image.height)) Math.ceil(Math.max(image.width, image.height))
@ -50,8 +51,6 @@ Image {
AnimatedImage { AnimatedImage {
id: animatedImage id: animatedImage
property bool userPaused: ! window.settings.media.autoPlayGIF
source: image.source source: image.source
autoTransform: image.autoTransform autoTransform: image.autoTransform
asynchronous: image.asynchronous asynchronous: image.asynchronous
@ -66,7 +65,7 @@ Image {
// Online GIFs won't be able to loop if cache is set to false, // Online GIFs won't be able to loop if cache is set to false,
// but caching GIFs is expansive. // but caching GIFs is expansive.
cache: ! Qt.resolvedUrl(source).startsWith("file://") cache: ! Qt.resolvedUrl(source).startsWith("file://")
paused: ! visible || window.hidden || userPaused paused: ! visible || window.hidden || image.pause
layer.enabled: image.radius !== 0 layer.enabled: image.radius !== 0
layer.effect: OpacityMask { maskSource: roundMask } layer.effect: OpacityMask { maskSource: roundMask }
@ -96,10 +95,10 @@ Image {
anchors.bottomMargin: theme.spacing / 2 anchors.bottomMargin: theme.spacing / 2
enableRadius: true enableRadius: true
icon.name: parent.userPaused ? "player-play" : "player-pause" icon.name: image.pause ? "player-play" : "player-pause"
iconItem.small: true iconItem.small: true
visible: parent.width > width * 2 && parent.height > height * 2 visible: parent.width > width * 2 && parent.height > height * 2
onClicked: parent.userPaused = ! parent.userPaused onClicked: image.pause = ! image.pause
} }
} }
} }

View File

@ -67,10 +67,19 @@ HMxcImage {
acceptedModifiers: Qt.NoModifier acceptedModifiers: Qt.NoModifier
gesturePolicy: TapHandler.ReleaseWithinBounds gesturePolicy: TapHandler.ReleaseWithinBounds
onTapped: onTapped: {
eventList.selectedCount ? if (eventList.selectedCount) {
eventDelegate.toggleChecked() : eventDelegate.toggleChecked()
eventList.openImageViewer(singleMediaInfo) return
}
const wasPaused = image.pause
image.pause = true
eventList.openImageViewer(singleMediaInfo, "", popup => {
popup.closed.connect(() => image.pause = wasPaused)
})
}
} }
TapHandler { TapHandler {