5import QtQuick.Controls as QQC2
7import Qt.labs.qmlmodels
9import org.kde.kirigami as Kirigami
10import org.kde.kirigamiaddons.components as KirigamiComponents
47AbstractMaximizeComponent {
62 property int initialIndex: -1
67 property bool showCaption: true
72 property bool hideCaption: false
81 property bool autoLoad: true
86 property bool autoPlay: true
99 property DownloadAction downloadAction
107 property Kirigami.Action playAction
115 property Kirigami.Action pauseAction
120 property alias currentItem: view.currentItem
125 signal itemRightClicked()
137 text: i18nd("kirigami-addons6",
"Zoom in")
139 onTriggered: view.currentItem.scaleFactor = Math.min(view.currentItem.scaleFactor + 0.25, 3)
142 text:
i18nd(
"kirigami-addons6",
"Zoom out")
143 icon.name:
"zoom-out"
144 onTriggered: view.currentItem.scaleFactor = Math.max(view.currentItem.scaleFactor - 0.25, 0.25)
148 text:
i18nd(
"kirigami-addons6",
"Rotate left")
149 icon.name:
"object-rotate-left"
150 onTriggered: view.currentItem.rotationAngle = view.currentItem.rotationAngle - 90
154 text:
i18nd(
"kirigami-addons6",
"Rotate right")
155 icon.name:
"object-rotate-right"
156 onTriggered: view.currentItem.rotationAngle = view.currentItem.rotationAngle + 90
159 text: hideCaption ?
i18ndc(
"kirigami-addons6",
"@action:intoolbar",
"Show caption") :
i18ndc(
"kirigami-addons6",
"@action:intoolbar",
"Hide caption")
160 icon.name:
"add-subtitle"
161 visible: root.showCaption && view.currentItem.caption
162 onTriggered: hideCaption = !hideCaption
165 text:
i18nd(
"kirigami-addons6",
"Save as")
166 icon.name:
"document-save"
167 onTriggered: saveItem()
173 Layout.fillWidth: true
174 Layout.fillHeight: true
175 interactive: !hoverHandler.hovered && count > 1
176 snapMode: ListView.SnapOneItem
177 highlightRangeMode: ListView.StrictlyEnforceRange
178 highlightMoveDuration: 0
180 keyNavigationEnabled: true
181 keyNavigationWraps: false
183 orientation: ListView.Horizontal
185 delegate: DelegateChooser {
189 ImageMaximizeDelegate {
190 width: ListView.view.width
191 height: ListView.view.height
193 onItemRightClicked: root.itemRightClicked()
194 onBackgroundClicked: root.close()
199 VideoMaximizeDelegate {
200 id: videoMaximizeDelegate
201 width: ListView.view.width
202 height: ListView.view.height
204 autoPlay: root.autoPlay
206 downloadAction: root.downloadAction ? root.downloadAction : undefined
209 when: root.playAction
211 target: videoMaximizeDelegate
212 playAction: root.playAction
218 when: root.pauseAction
220 target: videoMaximizeDelegate
221 pauseAction: root.pauseAction
226 onItemRightClicked: root.itemRightClicked()
227 onBackgroundClicked: root.close()
236 verticalCenter: parent.verticalCenter
240 icon.name:
"arrow-left"
241 visible: !
Kirigami.Settings.isMobile && view.currentIndex > 0
243 Accessible.name:
i18nd(
"kirigami-addons6",
"Previous image")
245 view.currentItem.pause()
246 view.currentIndex -= 1
248 view.currentItem.playAction.trigger()
252 KirigamiComponents.FloatingButton {
255 rightMargin:
Kirigami.Units.largeSpacing
256 verticalCenter: parent.verticalCenter
260 icon.name:
"arrow-right"
261 visible: !
Kirigami.Settings.isMobile && view.currentIndex < view.count - 1
263 Accessible.name:
i18nd(
"kirigami-addons6",
"Next image")
265 view.currentItem.pause()
266 view.currentIndex += 1
268 view.currentItem.playAction.trigger()
274 acceptedDevices: PointerDevice.Mouse
278 footer: QQC2.Control {
279 visible: root.showCaption && view.currentItem.caption && !root.hideCaption
280 contentItem: QQC2.ScrollView {
282 QQC2.ScrollBar.vertical.policy: QQC2.ScrollBar.AlwaysOn
283 QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AsNeeded
284 contentWidth: captionLabel.width - captionLabel.padding * 2
285 contentItem: Flickable {
287 height: parent.height
288 contentWidth: captionLabel.width
289 contentHeight: captionLabel.height - captionLabel.padding * 2 +
Kirigami.Units.largeSpacing
293 wrapMode:
Text.WordWrap
294 text: view.currentItem.caption
295 padding:
Kirigami.Units.largeSpacing
296 width: root.width - padding * 2
301 background: Rectangle {
302 color:
Kirigami.Theme.alternateBackgroundColor
315 parent: applicationWindow().overlay
316 closePolicy: QQC2.Popup.CloseOnEscape
318 height: parent.height
324 if (root.initialIndex != -1 && root.initialIndex >= 0) {
325 view.currentIndex = initialIndex
An object container for defining content items to show in a AlbumMaximizeComponent.
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)