@@ -32,18 +32,26 @@ Rectangle {
32 implicitWidth: units.gu(40)
32 implicitWidth: units.gu(40)
33 implicitHeight: units.gu(71)
33 implicitHeight: units.gu(71)
35− // NB: native and primary orientations here don't map exactly to their QScreen counterparts
36− readonly property int nativeOrientation: width > height ? Qt.LandscapeOrientation : Qt.PortraitOrientation
38− readonly property int primaryOrientation:
39− deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
40− ? nativeOrientation : deviceConfiguration.primaryOrientation
42 DeviceConfiguration {
35 DeviceConfiguration {
43 id: deviceConfiguration
36 id: deviceConfiguration
44 name: applicationArguments.deviceName
37 name: applicationArguments.deviceName
40+ property var orientations: Orientations {
42+ // NB: native and primary orientations here don't map exactly to their QScreen counterparts
43+ native_: root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation
45+ primary: deviceConfiguration.primaryOrientation == deviceConfiguration.UseNativeOrientation
46+ ? nativeOrientation : deviceConfiguration.primaryOrientation
48+ landscape: deviceConfiguration.landscapeOrientation
49+ invertedLandscape: deviceConfiguration.invertedLandscapeOrientation
50+ portrait: deviceConfiguration.portraitOrientation
51+ invertedPortrait: deviceConfiguration.invertedPortraitOrientation
48 // to be overwritten by tests
56 // to be overwritten by tests
49 property var unity8Settings: Unity8Settings {}
57 property var unity8Settings: Unity8Settings {}
@@ -92,7 +100,7 @@ Rectangle {
92 & deviceConfiguration.supportedOrientations
100 & deviceConfiguration.supportedOrientations
93 property int acceptedOrientationAngle: {
101 property int acceptedOrientationAngle: {
94 if (orientation & supportedOrientations) {
102 if (orientation & supportedOrientations) {
95− return Screen.angleBetween(nativeOrientation, orientation);
103+ return Screen.angleBetween(orientations.native_, orientation);
96 } else if (shell.orientation & supportedOrientations) {
104 } else if (shell.orientation & supportedOrientations) {
97 // stay where we are
105 // stay where we are
98 return shell.orientationAngle;
106 return shell.orientationAngle;
@@ -102,16 +110,16 @@ Rectangle {
102 // rotate to some supported orientation as we can't stay where we currently are
110 // rotate to some supported orientation as we can't stay where we currently are
103 // TODO: Choose the closest to the current one
111 // TODO: Choose the closest to the current one
104 if (supportedOrientations & Qt.PortraitOrientation) {
112 if (supportedOrientations & Qt.PortraitOrientation) {
105− return Screen.angleBetween(nativeOrientation, Qt.PortraitOrientation);
113+ return Screen.angleBetween(orientations.native_, Qt.PortraitOrientation);
106− } else if (supportedOrientations & Qt.LandcscapeOrientation) {
114+ } else if (supportedOrientations & Qt.LandscapeOrientation) {
107− return Screen.angleBetween(nativeOrientation, Qt.LandscapeOrientation);
115+ return Screen.angleBetween(orientations.native_, Qt.LandscapeOrientation);
108 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
116 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
109− return Screen.angleBetween(nativeOrientation, Qt.InvertedPortraitOrientation);
117+ return Screen.angleBetween(orientations.native_, Qt.InvertedPortraitOrientation);
110 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
118 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
111− return Screen.angleBetween(nativeOrientation, Qt.InvertedLandscapeOrientation);
119+ return Screen.angleBetween(orientations.native_, Qt.InvertedLandscapeOrientation);
113 // if all fails, fallback to primary orientation
121 // if all fails, fallback to primary orientation
114− return Screen.angleBetween(nativeOrientation, primaryOrientation);
122+ return Screen.angleBetween(orientations.native_, orientations.primary);
@@ -135,7 +143,7 @@ Rectangle {
137 console.warn("angleToOrientation: Invalid orientation angle: " + angle);
145 console.warn("angleToOrientation: Invalid orientation angle: " + angle);
138− return primaryOrientation;
146+ return orientations.primary;
@@ -153,10 +161,8 @@ Rectangle {
153 objectName: "shell"
161 objectName: "shell"
154 width: root.width
162 width: root.width
155 height: root.height
163 height: root.height
156− deviceSpecificOrientationOverrides: deviceConfiguration.deviceSpecificOrientationOverrides
157 orientation: root.angleToOrientation(orientationAngle)
164 orientation: root.angleToOrientation(orientationAngle)
158− primaryOrientation: root.primaryOrientation
165+ orientations: root.orientations
159− nativeOrientation: root.nativeOrientation
160 nativeWidth: root.width
166 nativeWidth: root.width
161 nativeHeight: root.height
167 nativeHeight: root.height
162 mode: applicationArguments.mode
168 mode: applicationArguments.mode