9import QtQuick.Controls as QQC2
12import org.kde.kirigami as Kirigami
17 property alias screenshotsModel: screenshotsRep.model
18 readonly property alias count: screenshotsRep.count
19 property int currentIndex: -1
20 property Item currentItem: screenshotsRep.itemAt(currentIndex)
22 Layout.preferredHeight: Kirigami.Units.gridUnit * 13
24 contentWidth: screenshotsLayout.width
28 parent: applicationWindow().QQC2.Overlay.overlay
32 x: (parent.width - width) / 2
33 y: (parent.height - height) / 2
35 readonly property real proportion: overlayImage.sourceSize.width > 1
36 ? overlayImage.sourceSize.height / overlayImage.sourceSize.width
39 height: overlayImage.status === Image.Loading
40 ? Kirigami.Units.gridUnit * 5
41 : Math.min(parent.height * 0.9, (parent.width * 0.9) * proportion, overlayImage.sourceSize.height)
42 width: height / proportion
47 running: overlayImage.status === Image.Loading
55 source: root.currentItem ? root.currentItem.imageSource : ""
56 fillMode: Image.PreserveAspectFit
63 verticalCenter: parent.verticalCenter
66 visible: leftAction.visible
72 verticalCenter: parent.verticalCenter
75 visible: rightAction.visible
80 icon.name: "arrow-
left"
81 enabled: overlay.visible && visible
82 visible: root.currentIndex >= 1 && !indicator.running
83 onTriggered: source => {
84 root.currentIndex = (root.currentIndex - 1) % root.count;
90 icon.name: "arrow-
right"
91 enabled: overlay.visible && visible
92 visible: root.currentIndex < (root.count - 1) && !indicator.running
93 onTriggered: source => {
94 root.currentIndex = (root.currentIndex + 1) % root.count;
100 id: screenshotsLayout
101 height: root.contentHeight
102 spacing: Kirigami.Units.largeSpacing
104 rightPadding: spacing
105 focus: overlay.visible
107 Keys.onLeftPressed: event => {
108 if (leftAction.visible) {
109 leftAction.trigger();
112 Keys.onRightPressed: event => {
113 if (rightAction.visible) {
114 rightAction.trigger();
121 delegate: MouseArea {
122 readonly property url imageSource: modelData
123 readonly property real proportion: thumbnail.sourceSize.width > 1
124 ? thumbnail.sourceSize.height / thumbnail.sourceSize.width
127 anchors.verticalCenter: parent.verticalCenter
128 width: Math.max(50, height / proportion)
129 height: screenshotsLayout.height - 2 * Kirigami.Units.largeSpacing
132 cursorShape: Qt.PointingHandCursor
134 onClicked: mouse => {
135 root.currentIndex = index
139 Kirigami.ShadowedRectangle {
140 visible: thumbnail.status === Image.Ready
141 anchors.fill: thumbnail
142 Kirigami.Theme.colorSet: Kirigami.Theme.View
143 shadow.size: Kirigami.Units.largeSpacing
144 shadow.color: Qt.rgba(0, 0, 0, 0.3)
148 running: thumbnail.status === Image.Loading
149 anchors.centerIn: parent
155 height: parent.height
156 fillMode: Image.PreserveAspectFit
163 readonly property var leftShadow: Shadow {
168 bottom: parent.bottom
171 width: Math.max(0, Math.min(root.width / 5, root.contentX))
174 readonly property var rightShadow: Shadow {
179 bottom: parent.bottom
182 width: Math.max(0, Math.min(root.contentWidth - root.contentX - root.width) / 5)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)