Don't anchor the tool bar menu button.
[harmattan/cameraplus] / qml / PostCaptureItem.qml
index 4cc51d1..f648a5f 100644 (file)
@@ -26,15 +26,21 @@ import CameraPlus 1.0
 Item {
     id: postCaptureItem
 
-    property bool isVideo: itemData.type.search("nmm#Video") > 0
+    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 variant itemData: item
     property bool playing: loader.source != ""
     signal clicked
+    clip: true
 
     function startPlayback() {
         loader.source = Qt.resolvedUrl("VideoPlayerPage.qml")
-        loader.item.source = itemData.url
+        loader.item.source = itemUrl
         if (!loader.item.play()) {
             showError(qsTr("Error playing video. Please try again."))
             loader.source = ""
@@ -57,16 +63,41 @@ Item {
         onFinished: loader.source = ""
     }
 
-// TODO: rotation
     FullScreenThumbnail {
         id: image
-        source: itemData.url
-        mimeType: itemData.mimeType
-
-        width: parent.width - 10
-        height: parent.height
+        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 }
+        }
+
+        function calculateRotation(orientation) {
+            switch (orientation) {
+                case CameraOrientation.InvertedLandscape:
+                case CameraOrientation.Landscape:
+                    return 0
+                case CameraOrientation.InvertedPortrait:
+                case CameraOrientation.Portrait:
+                    return -90
+                default:
+                    return 0
+            }
+        }
 
         MouseArea {
             id: mouse
@@ -92,7 +123,7 @@ Item {
             CameraToolIcon {
                 id: playIcon
                 anchors.horizontalCenter: parent.horizontalCenter
-                iconSource: "image://theme/icon-s-music-video-play"
+                iconSource: cameraTheme.videoPlayIconId
                 visible: isVideo
                 onClicked: startPlayback()
             }