@@ -17,23 +17,17 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtQuick.Window 2.0
18import QtQuick.Window 2.0
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
22 id: orientedShell
23 id: orientedShell
24 // this is only here to select the width / height of the window if not running fullscreen
25 // this is only here to select the width / height of the window if not running fullscreen
25− property bool tablet: false
26+ //property bool tablet: false
26− width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
27+ //width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
27− height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
28+ //height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
29 property int acceptedOrientationAngle: {
30 property int acceptedOrientationAngle: {
30− // check device name and fix orientation if necessary
31− if (applicationArguments.device() === "flo") {
32− return Screen.angleBetween(Screen.primaryOrientation, Qt.InvertedLandscapeOrientation);
33− } else if (applicationArguments.device() === "manta") {
34− return Screen.angleBetween(Screen.primaryOrientation, Qt.LandscapeOrientation);
37 var screenOrientation = Screen.orientation;
31 var screenOrientation = Screen.orientation;
38 var acceptedOrientation;
32 var acceptedOrientation;
@@ -90,13 +84,25 @@ Item {
91 PropertyChanges {
85 PropertyChanges {
92 target: shell
86 target: shell
93− rotation: 0
87+ transformRotationAngle: 0
96 width: orientedShell.width
90 width: orientedShell.width
97 height: orientedShell.height
91 height: orientedShell.height
98+ transformRotationAngle: 90
101+ width: orientedShell.height
102+ height: orientedShell.width
105+ // FIXME: 180 and 270 need to be updated
101 name: "180"
107 name: "180"
102 PropertyChanges {
108 PropertyChanges {
@@ -118,22 +124,78 @@ Item {
118 width: orientedShell.height
124 width: orientedShell.height
119 height: orientedShell.width
125 height: orientedShell.width
131+ property int rotationDuration: 450
132+ property int rotationEasing: Easing.InOutCubic
133+ // Those values are good for debugging/development
134+ //property int rotationDuration: 6000
135+ //property int rotationEasing: Easing.Linear
142+ SequentialAnimation {
143+ ScriptAction { script: { windowScreenshot.take(); } }
144+ PropertyAction { target: windowScreenshot; property: "visible"; value: true }
145+ PropertyAction { target: shell; property: "width"; value: orientedShell.width }
146+ PropertyAction { target: shell; property: "height"; value: orientedShell.height }
147+ PropertyAction { target: shell; property: "transformRotationAngle"; value: 90 }
149+ NumberAnimation { target: shell; property: "opacity"; from: 0; to: 1; duration: rotationDuration; easing.type: rotationEasing }
150+ NumberAnimation { target: shell; property: "transformRotationAngle"; to: 0; duration: rotationDuration; easing.type: rotationEasing }
152+ NumberAnimation { target: windowScreenshot; property: "opacity"; from: 1; to: 0; duration: rotationDuration; easing.type: rotationEasing }
153+ NumberAnimation { target: windowScreenshot; property: "transformRotationAngle"; from: 0; to: -90; duration: rotationDuration; easing.type: rotationEasing }
155+ PropertyAction { target: windowScreenshot; property: "visible"; value: false }
122− State {
158+ Transition {
123− name: "90"
160+ to: "90"
124− PropertyChanges {
161+ enabled: ready
125− target: shell
162+ SequentialAnimation {
126− rotation: 90
163+ ScriptAction { script: { windowScreenshot.take(); } }
164+ PropertyAction { target: windowScreenshot; property: "visible"; value: true }
165+ PropertyAction { target: shell; property: "width"; value: orientedShell.height }
127− x: orientedShell.width
166+ PropertyAction { target: shell; property: "height"; value: orientedShell.width }
128− y: 0
167+ PropertyAction { target: shell; property: "transformRotationAngle"; value: 0 }
129− width: orientedShell.height
168+ ParallelAnimation {
130− height: orientedShell.width
169+ NumberAnimation { target: shell; property: "opacity"; from: 0; to: 1; duration: rotationDuration; easing.type: rotationEasing }
170+ NumberAnimation { target: shell; property: "transformRotationAngle"; to: 90; duration: rotationDuration; easing.type: rotationEasing }
172+ NumberAnimation { target: windowScreenshot; property: "opacity"; from: 1; to: 0; duration: rotationDuration; easing.type: rotationEasing }
173+ NumberAnimation { target: windowScreenshot; property: "transformRotationAngle"; from: 0; to: 90; duration: rotationDuration; easing.type: rotationEasing }
175+ PropertyAction { target: windowScreenshot; property: "visible"; value: false }
136 id: shell
181 id: shell
137− transformOrigin: Item.TopLeft
182+ property real transformRotationAngle: 0
184+ transform: Rotation {
185+ origin.x: orientedShell.width / 2; origin.y: orientedShell.width / 2; axis { x: 0; y: 0; z: 1 }
186+ angle: shell.transformRotationAngle
191+ id: windowScreenshot
194+ property real transformRotationAngle: 0
196+ transform: Rotation {
197+ origin.x: orientedShell.width / 2; origin.y: orientedShell.width / 2; axis { x: 0; y: 0; z: 1 }
198+ angle: windowScreenshot.transformRotationAngle