Commit 571265a8 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Make it possible to navigate screenshots from the overlay

Otherwise we had to close it and open the next one

BUG: 387402
parent e152796b
...@@ -35,6 +35,9 @@ Flow { ...@@ -35,6 +35,9 @@ Flow {
property QtObject page property QtObject page
visible: screenshotsModel.count>0 visible: screenshotsModel.count>0
property int currentIndex: -1
readonly property Item currentItem: root.currentIndex >= 0 ? rep.itemAt(root.currentIndex) : null
QQC2.Popup { QQC2.Popup {
id: overlay id: overlay
parent: applicationWindow().overlay parent: applicationWindow().overlay
...@@ -48,12 +51,46 @@ Flow { ...@@ -48,12 +51,46 @@ Flow {
Image { Image {
id: overlayImage id: overlayImage
anchors.fill: parent anchors.fill: parent
source: root.currentItem ? root.currentItem.imageSource : ""
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
smooth: true smooth: true
} }
Button {
anchors {
right: parent.left
verticalCenter: parent.verticalCenter
}
iconName: leftAction.iconName
onClicked: leftAction.triggered(null)
}
Button {
anchors {
left: parent.right
verticalCenter: parent.verticalCenter
}
iconName: rightAction.iconName
onClicked: rightAction.triggered(null)
}
Kirigami.Action {
id: leftAction
iconName: "arrow-left"
enabled: overlay.visible
onTriggered: root.currentIndex = (root.currentIndex-1 < 0) ? 0 : root.currentIndex-1
}
Kirigami.Action {
id: rightAction
iconName: "arrow-right"
enabled: overlay.visible
onTriggered: root.currentIndex = (root.currentIndex+1 >= rep.count) ? rep.count-1 : root.currentIndex+1
}
} }
Repeater { Repeater {
id: rep
model: ScreenshotsModel { model: ScreenshotsModel {
id: screenshotsModel id: screenshotsModel
} }
...@@ -65,6 +102,7 @@ Flow { ...@@ -65,6 +102,7 @@ Flow {
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
smooth: true smooth: true
opacity: mouse.containsMouse? 0.5 : 1 opacity: mouse.containsMouse? 0.5 : 1
readonly property url imageSource: large_image_url
Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 200 } } Behavior on opacity { NumberAnimation { easing.type: Easing.OutQuad; duration: 200 } }
...@@ -79,7 +117,7 @@ Flow { ...@@ -79,7 +117,7 @@ Flow {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
overlayImage.source = large_image_url root.currentIndex = index
overlay.open() overlay.open()
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment