@@ -32,18 +32,26 @@ Rectangle {
3232 implicitWidth: units.gu(40)
3333 implicitHeight: units.gu(71)
3434
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
37−
38− readonly property int primaryOrientation:
39− deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
40− ? nativeOrientation : deviceConfiguration.primaryOrientation
41−
4235 DeviceConfiguration {
4336 id: deviceConfiguration
4437 name: applicationArguments.deviceName
4538 }
4639
40+ property var orientations: Orientations {
41+ id: 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
44+
45+ primary: deviceConfiguration.primaryOrientation == deviceConfiguration.UseNativeOrientation
46+ ? nativeOrientation : deviceConfiguration.primaryOrientation
47+
48+ landscape: deviceConfiguration.landscapeOrientation
49+ invertedLandscape: deviceConfiguration.invertedLandscapeOrientation
50+ portrait: deviceConfiguration.portraitOrientation
51+ invertedPortrait: deviceConfiguration.invertedPortraitOrientation
52+ }
53+
54+
4755
4856 // to be overwritten by tests
4957 property var unity8Settings: Unity8Settings {}
@@ -92,7 +100,7 @@ Rectangle {
92100 & deviceConfiguration.supportedOrientations
93101 property int acceptedOrientationAngle: {
94102 if (orientation & supportedOrientations) {
95− return Screen.angleBetween(nativeOrientation, orientation);
103+ return Screen.angleBetween(orientations.native_, orientation);
96104 } else if (shell.orientation & supportedOrientations) {
97105 // stay where we are
98106 return shell.orientationAngle;
@@ -102,16 +110,16 @@ Rectangle {
102110 // rotate to some supported orientation as we can't stay where we currently are
103111 // TODO: Choose the closest to the current one
104112 if (supportedOrientations & Qt.PortraitOrientation) {
105− return Screen.angleBetween(nativeOrientation, Qt.PortraitOrientation);
106− } else if (supportedOrientations & Qt.LandcscapeOrientation) {
107− return Screen.angleBetween(nativeOrientation, Qt.LandscapeOrientation);
113+ return Screen.angleBetween(orientations.native_, Qt.PortraitOrientation);
114+ } else if (supportedOrientations & Qt.LandscapeOrientation) {
115+ return Screen.angleBetween(orientations.native_, Qt.LandscapeOrientation);
108116 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
109− return Screen.angleBetween(nativeOrientation, Qt.InvertedPortraitOrientation);
117+ return Screen.angleBetween(orientations.native_, Qt.InvertedPortraitOrientation);
110118 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
111− return Screen.angleBetween(nativeOrientation, Qt.InvertedLandscapeOrientation);
119+ return Screen.angleBetween(orientations.native_, Qt.InvertedLandscapeOrientation);
112120 } else {
113121 // if all fails, fallback to primary orientation
114− return Screen.angleBetween(nativeOrientation, primaryOrientation);
122+ return Screen.angleBetween(orientations.native_, orientations.primary);
115123 }
116124 }
117125 }
@@ -135,7 +143,7 @@ Rectangle {
135143 break;
136144 default:
137145 console.warn("angleToOrientation: Invalid orientation angle: " + angle);
138− return primaryOrientation;
146+ return orientations.primary;
139147 }
140148 }
141149
@@ -153,10 +161,8 @@ Rectangle {
153161 objectName: "shell"
154162 width: root.width
155163 height: root.height
156− deviceSpecificOrientationOverrides: deviceConfiguration.deviceSpecificOrientationOverrides
157164 orientation: root.angleToOrientation(orientationAngle)
158− primaryOrientation: root.primaryOrientation
159− nativeOrientation: root.nativeOrientation
165+ orientations: root.orientations
160166 nativeWidth: root.width
161167 nativeHeight: root.height
162168 mode: applicationArguments.mode