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
126 property alias currentIndex: view.currentIndex
131 signal itemRightClicked()
143 text: i18nd("kirigami-addons6",
"Zoom in")
148 text:
i18nd(
"kirigami-addons6",
"Zoom out")
149 icon.name:
"zoom-out"
154 text:
i18nd(
"kirigami-addons6",
"Rotate left")
155 icon.name:
"object-rotate-left"
160 text:
i18nd(
"kirigami-addons6",
"Rotate right")
161 icon.name:
"object-rotate-right"
165 text:
hideCaption ?
i18ndc(
"kirigami-addons6",
"@action:intoolbar",
"Show caption") :
i18ndc(
"kirigami-addons6",
"@action:intoolbar",
"Hide caption")
166 icon.name:
"add-subtitle"
171 text:
i18nd(
"kirigami-addons6",
"Save as")
172 icon.name:
"document-save"
179 Layout.fillWidth: true
180 Layout.fillHeight: true
181 interactive: !hoverHandler.hovered && count > 1
182 snapMode: ListView.SnapOneItem
183 highlightRangeMode: ListView.StrictlyEnforceRange
184 highlightMoveDuration: 0
186 keyNavigationEnabled: true
187 keyNavigationWraps: false
189 orientation: ListView.Horizontal
191 delegate: DelegateChooser {
195 ImageMaximizeDelegate {
196 width: ListView.view.width
197 height: ListView.view.height
200 onBackgroundClicked: root.close()
205 VideoMaximizeDelegate {
206 id: videoMaximizeDelegate
207 width: ListView.view.width
208 height: ListView.view.height
217 target: videoMaximizeDelegate
226 target: videoMaximizeDelegate
233 onBackgroundClicked: root.close()
242 verticalCenter: parent.verticalCenter
246 icon.name:
"arrow-left"
249 Accessible.name:
i18nd(
"kirigami-addons6",
"Previous image")
251 view.currentItem.pause()
252 view.currentIndex -= 1
253 if (root.autoPlay && view.currentItem.playAction) {
254 view.currentItem.playAction.trigger()
258 KirigamiComponents.FloatingButton {
261 rightMargin:
Kirigami.Units.largeSpacing
262 verticalCenter: parent.verticalCenter
266 icon.name:
"arrow-right"
267 visible: !
Kirigami.Settings.isMobile && view.currentIndex < view.count - 1
269 Accessible.name:
i18nd(
"kirigami-addons6",
"Next image")
271 view.currentItem.pause()
272 view.currentIndex += 1
273 if (root.autoPlay && view.currentItem.playAction) {
274 view.currentItem.playAction.trigger()
280 acceptedDevices: PointerDevice.Mouse
284 footer: QQC2.Control {
285 visible: root.showCaption && view.currentItem.caption && !root.hideCaption
286 contentItem: QQC2.ScrollView {
288 QQC2.ScrollBar.vertical.policy: QQC2.ScrollBar.AlwaysOn
289 QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AsNeeded
290 contentWidth: captionLabel.width - captionLabel.padding * 2
291 contentItem: Flickable {
293 height: parent.height
294 contentWidth: captionLabel.width
295 contentHeight: captionLabel.height - captionLabel.padding * 2 +
Kirigami.Units.largeSpacing
299 wrapMode:
Text.WordWrap
300 text: view.currentItem.caption
301 padding:
Kirigami.Units.largeSpacing
302 width: root.width - padding * 2
307 background: Rectangle {
308 color:
Kirigami.Theme.alternateBackgroundColor
321 parent: applicationWindow().overlay
322 closePolicy: QQC2.Popup.CloseOnEscape
324 height: parent.height
330 if (root.initialIndex != -1 && root.initialIndex >= 0) {
331 view.currentIndex = initialIndex
Item content
The main content item in the view.
alias currentIndex
The current index in the view.
alias currentItem
The current item in the view.
KirigamiAction playAction
The default action triggered when the play button is pressed.
KirigamiAction pauseAction
The default action triggered when the pause button is pressed.
bool autoPlay
Whether any video media should auto-play.
bool hideCaption
Whether the caption is hidden by the user.
bool showCaption
Whether the caption should be shown.
void saveItem()
Emitted when the save item button is pressed.
void itemRightClicked()
Emitted when the content image is right clicked.
DownloadAction downloadAction
The default action triggered when the video download button is pressed.
var model
Model containing the media item to be shown.
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)