- id: postCaptureItem
- property bool isVideo: itemData.type.search("nmm#Video") > 0
- property bool error: false
- property variant itemData: item
- property bool isCurrentItem: PathView.isCurrentItem
- onIsCurrentItemChanged: {
- if (isCurrentItem) {
- page.currentItem = postCaptureItem;
- }
+ id: postCaptureItem
+
+ property url itemUrl: url
+ property string itemTitle: title
+ property string itemMimeType: mimeType
+ property string itemCreated: created
+ property string itemFileName: fileName
+
+ property bool isVideo: itemMimeType.search("video/") >= 0
+ property alias error: image.error
+ property bool playing: loader.source != ""
+ signal clicked
+ clip: true
+
+ function startPlayback() {
+ loader.source = Qt.resolvedUrl("VideoPlayerPage.qml")
+ loader.item.source = itemUrl
+ if (!loader.item.play()) {
+ showError(qsTr("Error playing video. Please try again."))
+ loader.source = ""
+ }
+ }
+
+ function stopPlayback() {
+ if (loader.item) {
+ loader.item.stop()
+ }
+ }
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ }
+
+ Connections {
+ target: loader.item
+ onFinished: loader.source = ""
+ }
+
+ FullScreenThumbnail {
+ id: image
+ source: itemUrl
+ mimeType: itemMimeType
+ rotation: calculateRotation(orientation.orientation)
+ width: isPortrait ? parent.height : parent.width - 10
+ height: isPortrait ? parent.width - 10 : parent.height
+ anchors.centerIn: parent
+ visible: loader.source == ""
+ property bool isPortrait: rotation == -90
+
+ Behavior on width {
+ PropertyAnimation { duration: 100 }
+ }
+
+ Behavior on height {
+ PropertyAnimation { duration: 100 }
+ }
+
+ Behavior on rotation {
+ PropertyAnimation { duration: 100 }