Changeset View
Changeset View
Standalone View
Standalone View
qmlUiKirigami/ImageViewer.qml
Show All 34 Lines | 31 | Kirigami.Page { | |||
---|---|---|---|---|---|
35 | property int indexValue | 35 | property int indexValue | ||
36 | 36 | | |||
37 | property int imageWidth | 37 | property int imageWidth | ||
38 | property int imageHeight | 38 | property int imageHeight | ||
39 | 39 | | |||
40 | leftPadding: 0 | 40 | leftPadding: 0 | ||
41 | rightPadding: 0 | 41 | rightPadding: 0 | ||
42 | 42 | | |||
43 | KQA.MimeDatabase { | ||||
44 | id: mimeDB | ||||
45 | } | ||||
46 | | ||||
47 | actions { | ||||
48 | main: Kirigami.Action { | ||||
49 | iconName: "document-share" | ||||
50 | tooltip: i18n("Share Image") | ||||
51 | onTriggered: { | ||||
52 | shareDialog.sheetOpen = true | ||||
53 | shareDialog.inputData = { | ||||
54 | "urls": [ listView.currentItem.currentImageSource.toString() ], | ||||
mart: probably in square brackets? | |||||
55 | "mimeType": mimeDB.mimeTypeForUrl( listView.currentItem.currentImageSource).name | ||||
56 | } | ||||
57 | } | ||||
58 | } | ||||
59 | left: Kirigami.Action { | ||||
60 | iconName: "view-close" | ||||
61 | tooltip: i18n("Close Image") | ||||
62 | onTriggered: root.state = "closed" | ||||
63 | } | ||||
64 | right: Kirigami.Action { | ||||
65 | iconName: "editimage" | ||||
66 | tooltip: i18n("Edit Image") | ||||
67 | } | ||||
68 | } | ||||
69 | | ||||
43 | states: [ | 70 | states: [ | ||
44 | State { | 71 | State { | ||
45 | name: "open" | 72 | name: "open" | ||
46 | PropertyChanges { | 73 | PropertyChanges { | ||
47 | target: root | 74 | target: root | ||
48 | visible: true | 75 | visible: true | ||
49 | } | 76 | } | ||
50 | PropertyChanges { | 77 | PropertyChanges { | ||
Show All 18 Lines | 94 | State { | |||
69 | PropertyChanges { | 96 | PropertyChanges { | ||
70 | target: root | 97 | target: root | ||
71 | opacity: 0 | 98 | opacity: 0 | ||
72 | } | 99 | } | ||
73 | PropertyChanges { | 100 | PropertyChanges { | ||
74 | target: root | 101 | target: root | ||
75 | visible: false | 102 | visible: false | ||
76 | } | 103 | } | ||
104 | PropertyChanges { | ||||
105 | target: shareDialog | ||||
106 | sheetOpen: false | ||||
107 | } | ||||
77 | }, | 108 | }, | ||
78 | State { | 109 | State { | ||
79 | name: "fullscreen" | 110 | name: "fullscreen" | ||
80 | PropertyChanges { | 111 | PropertyChanges { | ||
81 | target: root | 112 | target: root | ||
82 | focus: true | 113 | focus: true | ||
83 | } | 114 | } | ||
84 | PropertyChanges { | 115 | PropertyChanges { | ||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 188 | Timer { | |||
160 | onTriggered: footerList.opacity = 0 | 191 | onTriggered: footerList.opacity = 0 | ||
161 | } | 192 | } | ||
162 | 193 | | |||
163 | onCurrentIndexChanged: { | 194 | onCurrentIndexChanged: { | ||
164 | currentImage.index = model.sourceIndex( currentIndex) | 195 | currentImage.index = model.sourceIndex( currentIndex) | ||
165 | listView.positionViewAtIndex(currentIndex, ListView.Beginning) | 196 | listView.positionViewAtIndex(currentIndex, ListView.Beginning) | ||
166 | footerList.opacity = 1.0 | 197 | footerList.opacity = 1.0 | ||
167 | timer.restart() | 198 | timer.restart() | ||
199 | shareDialog.sheetOpen = false | ||||
168 | } | 200 | } | ||
169 | 201 | | |||
170 | delegate: Flickable { | 202 | delegate: Flickable { | ||
171 | id: flick | 203 | id: flick | ||
204 | property alias currentImageSource: image.source | ||||
172 | width: imageWidth | 205 | width: imageWidth | ||
173 | height: imageHeight | 206 | height: imageHeight | ||
174 | contentWidth: imageWidth | 207 | contentWidth: imageWidth | ||
175 | contentHeight: imageHeight | 208 | contentHeight: imageHeight | ||
176 | interactive: contentWidth > width || contentHeight > height | 209 | interactive: contentWidth > width || contentHeight > height | ||
177 | onInteractiveChanged: listView.interactive = !interactive; | 210 | onInteractiveChanged: listView.interactive = !interactive; | ||
178 | clip: true | 211 | clip: true | ||
179 | z: index == listView.currentIndex ? 1000 : 0 | 212 | z: index == listView.currentIndex ? 1000 : 0 | ||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Line(s) | 383 | KQA.QImageItem { | |||
351 | height: Kirigami.Units.gridUnit * 3.8 | 384 | height: Kirigami.Units.gridUnit * 3.8 | ||
352 | width: height | 385 | width: height | ||
353 | anchors.centerIn: parent | 386 | anchors.centerIn: parent | ||
354 | image: model.thumbnail | 387 | image: model.thumbnail | ||
355 | } | 388 | } | ||
356 | } | 389 | } | ||
357 | } | 390 | } | ||
358 | 391 | | |||
359 | //FIXME: placeholder, will have to use the state machine | 392 | ShareDialog { | ||
360 | Controls.Button { | 393 | id: shareDialog | ||
361 | text: i18n("Back") | 394 | inputData: { urls: [] } | ||
362 | onClicked: root.state = "closed" | 395 | sheetOpen: false | ||
396 | onFinished: { | ||||
397 | if (error==0 && output.url !== "") { | ||||
398 | console.assert(output.url !== undefined); | ||||
399 | var resultUrl = output.url; | ||||
400 | console.log("Received", resultUrl) | ||||
401 | //Qt.openUrlExternally(resultUrl) | ||||
402 | notificationManager.showNotification( true, resultUrl); | ||||
403 | } else { | ||||
404 | notificationManager.showNotification( false); | ||||
405 | } | ||||
406 | } | ||||
407 | } | ||||
408 | | ||||
409 | Koko.NotificationManager { | ||||
410 | id: notificationManager | ||||
363 | } | 411 | } | ||
364 | } | 412 | } |
probably in square brackets?