on xenial help sign in
Enable support for overriding application orientations based on device type Fixes: #1478637
c2d47baMichał Sawicz
qml/Components/Orientations.qmlnew file+57
@@ -0,0 +1,57 @@
1+/*
2+ * Copyright 2015 Canonical Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.4
18+
19+QtObject {
20+ id: root
21+
22+ // Just because "native" is a reserved keyword :(
23+ property int native_: Qt.PortraitOrientation
24+
25+ property int primary: Qt.PortraitOrientation
26+
27+ property int landscape: Qt.LandscapeOrientation
28+ property int invertedLandscape: Qt.InvertedLandscapeOrientation
29+ property int portrait: Qt.PortraitOrientation
30+ property int invertedPortrait: Qt.InvertedPortraitOrientation
31+
32+ function map(orientations) {
33+ var result = 0;
34+
35+ if (orientations & Qt.PortraitOrientation) {
36+ result |= root.portrait;
37+ }
38+
39+ if (orientations & Qt.InvertedPortraitOrientation) {
40+ result |= root.invertedPortrait;
41+ }
42+
43+ if (orientations & Qt.LandscapeOrientation) {
44+ result |= root.landscape;
45+ }
46+
47+ if (orientations & Qt.InvertedLandscapeOrientation) {
48+ result |= root.invertedLandscape;
49+ }
50+
51+ if (result == 0) {
52+ result = root.primary;
53+ }
54+
55+ return result;
56+ }
57+}
qml/DeviceConfiguration.qml+86−64
@@ -16,79 +16,101 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18
18
19−StateGroup {
19+QtObject {
20 id: root
20 id: root
21
21
22 readonly property int useNativeOrientation: -1
22 readonly property int useNativeOrientation: -1
23
23
24− property int primaryOrientation: useNativeOrientation
24+ // The only writable property in the API
25+ // all other properties are set according to the device name
26+ property alias name: priv.state
25
27
26− property int supportedOrientations: Qt.PortraitOrientation
28+ readonly property alias primaryOrientation: priv.primaryOrientation
27− | Qt.InvertedPortraitOrientation
29+ readonly property alias supportedOrientations: priv.supportedOrientations
28− | Qt.LandscapeOrientation
30+ readonly property alias landscapeOrientation: priv.landscapeOrientation
29− | Qt.InvertedLandscapeOrientation
31+ readonly property alias invertedLandscapeOrientation: priv.invertedLandscapeOrientation
32+ readonly property alias portraitOrientation: priv.portraitOrientation
33+ readonly property alias invertedPortraitOrientation: priv.invertedPortraitOrientation
30
34
31− // Supported values so far:
32− // "phone", "tablet" or "desktop"
33− property string category: "phone"
35+ readonly property alias category: priv.category
34
36
35− property int ignoredMice: 0
37+ readonly property alias ignoredMice: priv.ignoredMice
36
38
39+ readonly property var priv: StateGroup {
40+ id: priv
37
41
38− property alias name: root.state
42+ property int primaryOrientation: root.useNativeOrientation
39
43
40− states: [
44+ property int supportedOrientations: Qt.PortraitOrientation
41− State {
45+ | Qt.InvertedPortraitOrientation
42− name: "mako"
43− PropertyChanges {
44− target: root
45− supportedOrientations: Qt.PortraitOrientation
46− | Qt.LandscapeOrientation
46+ | Qt.LandscapeOrientation
47− | Qt.InvertedLandscapeOrientation
47+ | Qt.InvertedLandscapeOrientation
48− }
48+
49− },
49+ property int landscapeOrientation: Qt.LandscapeOrientation
50− State {
51− name: "krillin"
52− PropertyChanges {
53− target: root
54− supportedOrientations: Qt.PortraitOrientation
55− | Qt.LandscapeOrientation
56− | Qt.InvertedLandscapeOrientation
50+ property int invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
57− }
58− },
59− State {
60− name: "arale"
61− PropertyChanges {
62− target: root
63− supportedOrientations: Qt.PortraitOrientation
51+ property int portraitOrientation: Qt.PortraitOrientation
64− | Qt.LandscapeOrientation
52+ property int invertedPortraitOrientation: Qt.InvertedPortraitOrientation
65− | Qt.InvertedLandscapeOrientation
53+
66− ignoredMice: 1
54+ // Supported values so far:
67− }
68− },
69− State {
70− name: "manta"
71− PropertyChanges {
72− target: root
73− category: "tablet"
74− }
75− },
76− State {
77− name: "flo"
78− PropertyChanges {
79− target: root
80− primaryOrientation: Qt.InvertedLandscapeOrientation
81− category: "tablet"
82− }
83− },
84− State {
85− name: "desktop"
55+ // "phone", "tablet" or "desktop"
86− PropertyChanges {
56+ property string category: "phone"
87− target: root
88− category: "desktop"
89− supportedOrientations: root.useNativeOrientation
90− }
91− }
92− ]
93
57
58+ property int ignoredMice: 0
59+
60+ states: [
61+ State {
62+ name: "mako"
63+ PropertyChanges {
64+ target: priv
65+ supportedOrientations: Qt.PortraitOrientation
66+ | Qt.LandscapeOrientation
67+ | Qt.InvertedLandscapeOrientation
68+ }
69+ },
70+ State {
71+ name: "krillin"
72+ PropertyChanges {
73+ target: priv
74+ supportedOrientations: Qt.PortraitOrientation
75+ | Qt.LandscapeOrientation
76+ | Qt.InvertedLandscapeOrientation
77+ }
78+ },
79+ State {
80+ name: "arale"
81+ PropertyChanges {
82+ target: priv
83+ supportedOrientations: Qt.PortraitOrientation
84+ | Qt.LandscapeOrientation
85+ | Qt.InvertedLandscapeOrientation
86+ ignoredMice: 1
87+ }
88+ },
89+ State {
90+ name: "manta"
91+ PropertyChanges {
92+ target: priv
93+ category: "tablet"
94+ }
95+ },
96+ State {
97+ name: "flo"
98+ PropertyChanges {
99+ target: priv
100+ landscapeOrientation: Qt.InvertedLandscapeOrientation
101+ invertedLandscapeOrientation: Qt.LandscapeOrientation
102+ primaryOrientation: Qt.InvertedLandscapeOrientation
103+ category: "tablet"
104+ }
105+ },
106+ State {
107+ name: "desktop"
108+ PropertyChanges {
109+ target: priv
110+ category: "desktop"
111+ supportedOrientations: root.useNativeOrientation
112+ }
113+ }
114+ ]
115+ }
94}
116}
qml/OrientedShell.qml+34−24
@@ -32,20 +32,31 @@ Rectangle {
32 implicitWidth: units.gu(40)
32 implicitWidth: units.gu(40)
33 implicitHeight: units.gu(71)
33 implicitHeight: units.gu(71)
34
34
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−
42 DeviceConfiguration {
35 DeviceConfiguration {
43 id: deviceConfiguration
36 id: deviceConfiguration
44 name: applicationArguments.deviceName
37 name: applicationArguments.deviceName
45 }
38 }
46
39
40+ property alias orientations: d.orientations
41+
42+ Item {
43+ id: d
44+
45+ property Orientations orientations: Orientations {
46+ id: orientations
47+ // NB: native and primary orientations here don't map exactly to their QScreen counterparts
48+ native_: root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation
47
49
50+ primary: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation
51+ ? native_ : deviceConfiguration.primaryOrientation
52+
53+ landscape: deviceConfiguration.landscapeOrientation
54+ invertedLandscape: deviceConfiguration.invertedLandscapeOrientation
55+ portrait: deviceConfiguration.portraitOrientation
56+ invertedPortrait: deviceConfiguration.invertedPortraitOrientation
57+ }
58+ }
48− // to be overwritten by tests
59+ // to be overwritten by tests
49 property var unity8Settings: Unity8Settings {}
60 property var unity8Settings: Unity8Settings {}
50 property var oskSettings: GSettings { schema.id: "com.canonical.keyboard.maliit" }
61 property var oskSettings: GSettings { schema.id: "com.canonical.keyboard.maliit" }
51
62
@@ -78,8 +89,8 @@ Rectangle {
78
89
79 // we must rotate to a supported orientation regardless of shell's preference
90 // we must rotate to a supported orientation regardless of shell's preference
80 property bool orientationChangesEnabled:
91 property bool orientationChangesEnabled:
81− (orientation & supportedOrientations) === 0 ? true
92+ (shell.orientation & supportedOrientations) === 0 ? true
82− : shell.orientationChangesEnabled
93+ : shell.orientationChangesEnabled
83
94
84
95
85 Binding {
96 Binding {
@@ -96,12 +107,12 @@ Rectangle {
96
107
97 readonly property int supportedOrientations: shell.supportedOrientations
108 readonly property int supportedOrientations: shell.supportedOrientations
98 & (deviceConfiguration.supportedOrientations == deviceConfiguration.useNativeOrientation
109 & (deviceConfiguration.supportedOrientations == deviceConfiguration.useNativeOrientation
99− ? nativeOrientation
110+ ? orientations.native_
100 : deviceConfiguration.supportedOrientations)
111 : deviceConfiguration.supportedOrientations)
101
112
102 property int acceptedOrientationAngle: {
113 property int acceptedOrientationAngle: {
103 if (orientation & supportedOrientations) {
114 if (orientation & supportedOrientations) {
104− return Screen.angleBetween(nativeOrientation, orientation);
115+ return Screen.angleBetween(orientations.native_, orientation);
105 } else if (shell.orientation & supportedOrientations) {
116 } else if (shell.orientation & supportedOrientations) {
106 // stay where we are
117 // stay where we are
107 return shell.orientationAngle;
118 return shell.orientationAngle;
@@ -111,16 +122,16 @@ Rectangle {
111 // rotate to some supported orientation as we can't stay where we currently are
122 // rotate to some supported orientation as we can't stay where we currently are
112 // TODO: Choose the closest to the current one
123 // TODO: Choose the closest to the current one
113 if (supportedOrientations & Qt.PortraitOrientation) {
124 if (supportedOrientations & Qt.PortraitOrientation) {
114− return Screen.angleBetween(nativeOrientation, Qt.PortraitOrientation);
125+ return Screen.angleBetween(orientations.native_, Qt.PortraitOrientation);
115 } else if (supportedOrientations & Qt.LandscapeOrientation) {
126 } else if (supportedOrientations & Qt.LandscapeOrientation) {
116− return Screen.angleBetween(nativeOrientation, Qt.LandscapeOrientation);
127+ return Screen.angleBetween(orientations.native_, Qt.LandscapeOrientation);
117 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
128 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
118− return Screen.angleBetween(nativeOrientation, Qt.InvertedPortraitOrientation);
129+ return Screen.angleBetween(orientations.native_, Qt.InvertedPortraitOrientation);
119 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
130 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
120− return Screen.angleBetween(nativeOrientation, Qt.InvertedLandscapeOrientation);
131+ return Screen.angleBetween(orientations.native_, Qt.InvertedLandscapeOrientation);
121 } else {
132 } else {
122 // if all fails, fallback to primary orientation
133 // if all fails, fallback to primary orientation
123− return Screen.angleBetween(nativeOrientation, primaryOrientation);
134+ return Screen.angleBetween(orientations.native_, orientations.primary);
124 }
135 }
125 }
136 }
126 }
137 }
@@ -128,19 +139,19 @@ Rectangle {
128 function angleToOrientation(angle) {
139 function angleToOrientation(angle) {
129 switch (angle) {
140 switch (angle) {
130 case 0:
141 case 0:
131− return nativeOrientation;
142+ return orientations.native_;
132 case 90:
143 case 90:
133− return nativeOrientation === Qt.PortraitOrientation ? Qt.InvertedLandscapeOrientation
144+ return orientations.native_ === Qt.PortraitOrientation ? Qt.InvertedLandscapeOrientation
134 : Qt.PortraitOrientation;
145 : Qt.PortraitOrientation;
135 case 180:
146 case 180:
136− return nativeOrientation === Qt.PortraitOrientation ? Qt.InvertedPortraitOrientation
147+ return orientations.native_ === Qt.PortraitOrientation ? Qt.InvertedPortraitOrientation
137 : Qt.InvertedLandscapeOrientation;
148 : Qt.InvertedLandscapeOrientation;
138 case 270:
149 case 270:
139− return nativeOrientation === Qt.PortraitOrientation ? Qt.LandscapeOrientation
150+ return orientations.native_ === Qt.PortraitOrientation ? Qt.LandscapeOrientation
140 : Qt.InvertedPortraitOrientation;
151 : Qt.InvertedPortraitOrientation;
141 default:
152 default:
142 console.warn("angleToOrientation: Invalid orientation angle: " + angle);
153 console.warn("angleToOrientation: Invalid orientation angle: " + angle);
143− return primaryOrientation;
154+ return orientations.primary;
144 }
155 }
145 }
156 }
146
157
@@ -159,8 +170,7 @@ Rectangle {
159 width: root.width
170 width: root.width
160 height: root.height
171 height: root.height
161 orientation: root.angleToOrientation(orientationAngle)
172 orientation: root.angleToOrientation(orientationAngle)
162− primaryOrientation: root.primaryOrientation
173+ orientations: root.orientations
163− nativeOrientation: root.nativeOrientation
164 nativeWidth: root.width
174 nativeWidth: root.width
165 nativeHeight: root.height
175 nativeHeight: root.height
166 mode: applicationArguments.mode
176 mode: applicationArguments.mode
qml/Shell.qml+6−12
@@ -49,8 +49,7 @@ Item {
49 // to be set from outside
49 // to be set from outside
50 property int orientationAngle: 0
50 property int orientationAngle: 0
51 property int orientation
51 property int orientation
52− property int primaryOrientation
52+ property Orientations orientations
53− property int nativeOrientation
54 property real nativeWidth
53 property real nativeWidth
55 property real nativeHeight
54 property real nativeHeight
56 property alias indicatorAreaShowProgress: panel.indicatorAreaShowProgress
55 property alias indicatorAreaShowProgress: panel.indicatorAreaShowProgress
@@ -86,7 +85,7 @@ Item {
86 } else if (greeter && greeter.shown) {
85 } else if (greeter && greeter.shown) {
87 return Qt.PrimaryOrientation;
86 return Qt.PrimaryOrientation;
88 } else if (mainApp) {
87 } else if (mainApp) {
89− return mainApp.supportedOrientations;
88+ return shell.orientations.map(mainApp.supportedOrientations);
90 } else {
89 } else {
91 // we just don't care
90 // we just don't care
92 return Qt.PortraitOrientation
91 return Qt.PortraitOrientation
@@ -299,18 +298,13 @@ Item {
299 }
298 }
300 Binding {
299 Binding {
301 target: applicationsDisplayLoader.item
300 target: applicationsDisplayLoader.item
302− property: "background"
301+ property: "orientations"
303− value: wallpaperResolver.background
302+ value: shell.orientations
304 }
303 }
305 Binding {
304 Binding {
306 target: applicationsDisplayLoader.item
305 target: applicationsDisplayLoader.item
307− property: "shellPrimaryOrientation"
306+ property: "background"
308− value: shell.primaryOrientation
307+ value: wallpaperResolver.background
309− }
310− Binding {
311− target: applicationsDisplayLoader.item
312− property: "nativeOrientation"
313− value: shell.nativeOrientation
314 }
308 }
315 Binding {
309 Binding {
316 target: applicationsDisplayLoader.item
310 target: applicationsDisplayLoader.item
qml/Stages/DesktopStage.qml+2−2
@@ -22,6 +22,7 @@ import Ubuntu.Components 1.3
22import Unity.Application 0.1
22import Unity.Application 0.1
23import "../Components"
23import "../Components"
24import "../Components/PanelState"
24import "../Components/PanelState"
25+import "../Components"
25import Utils 0.1
26import Utils 0.1
26import Ubuntu.Gestures 0.1
27import Ubuntu.Gestures 0.1
27
28
@@ -37,8 +38,7 @@ Rectangle {
37 property real inverseProgress: 0 // just to comply with the interface shared between stages
38 property real inverseProgress: 0 // just to comply with the interface shared between stages
38 property int shellOrientationAngle: 0
39 property int shellOrientationAngle: 0
39 property int shellOrientation
40 property int shellOrientation
40− property int shellPrimaryOrientation
41+ property QtObject orientations
41− property int nativeOrientation
42 property bool beingResized: false
42 property bool beingResized: false
43 property bool keepDashRunning: true
43 property bool keepDashRunning: true
44 property bool suspended: false
44 property bool suspended: false
qml/Stages/PhoneStage.qml+4−6
@@ -39,9 +39,9 @@ Rectangle {
39 property bool keepDashRunning: true
39 property bool keepDashRunning: true
40 property bool suspended: false
40 property bool suspended: false
41 property int shellOrientationAngle: 0
41 property int shellOrientationAngle: 0
42+
42 property int shellOrientation
43 property int shellOrientation
43− property int shellPrimaryOrientation
44+ property QtObject orientations
44− property int nativeOrientation
45 property real nativeWidth
45 property real nativeWidth
46 property real nativeHeight
46 property real nativeHeight
47 property bool beingResized: false
47 property bool beingResized: false
@@ -71,7 +71,7 @@ Rectangle {
71
71
72 var supportedOrientations = spreadDelegate.application.supportedOrientations;
72 var supportedOrientations = spreadDelegate.application.supportedOrientations;
73 if (supportedOrientations === Qt.PrimaryOrientation) {
73 if (supportedOrientations === Qt.PrimaryOrientation) {
74− supportedOrientations = spreadDelegate.shellPrimaryOrientation;
74+ supportedOrientations = root.orientations.primary;
75 }
75 }
76
76
77 if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) {
77 if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) {
@@ -535,11 +535,9 @@ Rectangle {
535 visible: (progress >= 0 && progress < 1.7)
535 visible: (progress >= 0 && progress < 1.7)
536 || (isDash && priv.focusedAppDelegateIsDislocated)
536 || (isDash && priv.focusedAppDelegateIsDislocated)
537
537
538−
539 shellOrientationAngle: root.shellOrientationAngle
538 shellOrientationAngle: root.shellOrientationAngle
540 shellOrientation: root.shellOrientation
539 shellOrientation: root.shellOrientation
541− shellPrimaryOrientation: root.shellPrimaryOrientation
540+ orientations: root.orientations
542− nativeOrientation: root.nativeOrientation
543
541
544 onClicked: {
542 onClicked: {
545 if (root.altTabEnabled && spreadView.phase == 2) {
543 if (root.altTabEnabled && spreadView.phase == 2) {
qml/Stages/SpreadDelegate.qml+8−9
@@ -42,8 +42,7 @@ FocusScope {
42 property alias application: appWindow.application
42 property alias application: appWindow.application
43 property int shellOrientationAngle
43 property int shellOrientationAngle
44 property int shellOrientation
44 property int shellOrientation
45− property int shellPrimaryOrientation
45+ property QtObject orientations
46− property int nativeOrientation
47
46
48 function matchShellOrientation() {
47 function matchShellOrientation() {
49 if (!root.application)
48 if (!root.application)
@@ -157,7 +156,7 @@ FocusScope {
157 var supportedOrientations = root.application.supportedOrientations;
156 var supportedOrientations = root.application.supportedOrientations;
158
157
159 if (supportedOrientations === Qt.PrimaryOrientation) {
158 if (supportedOrientations === Qt.PrimaryOrientation) {
160− supportedOrientations = root.shellPrimaryOrientation;
159+ supportedOrientations = root.orientations.primary;
161 }
160 }
162
161
163 // If it doesn't support shell's current orientation
162 // If it doesn't support shell's current orientation
@@ -166,18 +165,18 @@ FocusScope {
166 if (supportedOrientations & root.shellOrientation) {
165 if (supportedOrientations & root.shellOrientation) {
167 chosenOrientation = root.shellOrientation;
166 chosenOrientation = root.shellOrientation;
168 } else if (supportedOrientations & Qt.PortraitOrientation) {
167 } else if (supportedOrientations & Qt.PortraitOrientation) {
169− chosenOrientation = Qt.PortraitOrientation;
168+ chosenOrientation = root.orientations.portrait;
170 } else if (supportedOrientations & Qt.LandscapeOrientation) {
169 } else if (supportedOrientations & Qt.LandscapeOrientation) {
171− chosenOrientation = Qt.LandscapeOrientation;
170+ chosenOrientation = root.orientations.landscape;
172 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
171 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
173− chosenOrientation = Qt.InvertedPortraitOrientation;
172+ chosenOrientation = root.orientations.invertedPortrait;
174 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
173 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
175− chosenOrientation = Qt.InvertedLandscapeOrientation;
174+ chosenOrientation = root.orientations.invertedLandscape;
176 } else {
175 } else {
177− chosenOrientation = root.shellPrimaryOrientation;
176+ chosenOrientation = root.orientations.primary;
178 }
177 }
179
178
180− return Screen.angleBetween(root.nativeOrientation, chosenOrientation);
179+ return Screen.angleBetween(root.orientations.native_, chosenOrientation);
181 }
180 }
182
181
183 rotation: normalizeAngle(appWindowWithShadow.orientationAngle - root.shellOrientationAngle)
182 rotation: normalizeAngle(appWindowWithShadow.orientationAngle - root.shellOrientationAngle)
qml/Stages/TabletStage.qml+13−7
@@ -39,11 +39,12 @@ Rectangle {
39 property bool keepDashRunning: true
39 property bool keepDashRunning: true
40 property bool suspended: false
40 property bool suspended: false
41 property int shellOrientationAngle: 0
41 property int shellOrientationAngle: 0
42+
42 property int shellOrientation
43 property int shellOrientation
43− property int shellPrimaryOrientation
44+ property QtObject orientations
44− property int nativeOrientation
45 property real nativeWidth
45 property real nativeWidth
46 property real nativeHeight
46 property real nativeHeight
47+
47 function updateFocusedAppOrientation() {
48 function updateFocusedAppOrientation() {
48 var mainStageAppIndex = priv.indexOf(priv.mainStageAppId);
49 var mainStageAppIndex = priv.indexOf(priv.mainStageAppId);
49 if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) {
50 if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) {
@@ -64,7 +65,7 @@ Rectangle {
64
65
65 var supportedOrientations = spreadDelegate.application.supportedOrientations;
66 var supportedOrientations = spreadDelegate.application.supportedOrientations;
66 if (supportedOrientations === Qt.PrimaryOrientation) {
67 if (supportedOrientations === Qt.PrimaryOrientation) {
67− supportedOrientations = spreadDelegate.shellPrimaryOrientation;
68+ supportedOrientations = spreadDelegate.orientations.primary;
68 }
69 }
69
70
70 if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) {
71 if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) {
@@ -130,7 +131,7 @@ Rectangle {
130 property string oldFocusedAppId: ""
131 property string oldFocusedAppId: ""
131 property bool mainAppOrientationChangesEnabled: false
132 property bool mainAppOrientationChangesEnabled: false
132
133
133− property real landscapeHeight: root.nativeOrientation == Qt.LandscapeOrientation ?
134+ property real landscapeHeight: root.orientations.native_ == Qt.LandscapeOrientation ?
134 root.nativeHeight : root.nativeWidth
135 root.nativeHeight : root.nativeWidth
135
136
136 property bool shellIsLandscape: root.shellOrientation === Qt.LandscapeOrientation
137 property bool shellIsLandscape: root.shellOrientation === Qt.LandscapeOrientation
@@ -691,9 +692,14 @@ Rectangle {
691
692
692 shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0
693 shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0
693 shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation
694 shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation
695+ orientations: Orientations {
694− shellPrimaryOrientation: wantsMainStage ? root.shellPrimaryOrientation : Qt.PortraitOrientation
696+ primary: spreadTile.wantsMainStage ? root.orientations.primary : Qt.PortraitOrientation
695− nativeOrientation: wantsMainStage ? root.nativeOrientation : Qt.PortraitOrientation
697+ native_: spreadTile.wantsMainStage ? root.orientations.native_ : Qt.PortraitOrientation
696−
698+ portrait: root.orientations.portrait
699+ invertedPortrait: root.orientations.invertedPortrait
700+ landscape: root.orientations.landscape
701+ invertedLandscape: root.orientations.invertedLandscape
702+ }
697
703
698 onClicked: {
704 onClicked: {
699 if (spreadView.phase == 2) {
705 if (spreadView.phase == 2) {
tests/qmltests/Stages/tst_PhoneStage.qml−2
@@ -34,8 +34,6 @@ Item {
34 maximizedAppTopMargin: units.gu(3) + units.dp(2)
34 maximizedAppTopMargin: units.gu(3) + units.dp(2)
35 interactive: true
35 interactive: true
36 shellOrientation: Qt.PortraitOrientation
36 shellOrientation: Qt.PortraitOrientation
37− shellPrimaryOrientation: Qt.PortraitOrientation
38− nativeOrientation: Qt.PortraitOrientation
39 }
37 }
40
38
41 Binding {
39 Binding {
tests/qmltests/Stages/tst_SpreadDelegate.qml+6−2
@@ -18,6 +18,7 @@ import QtQuick 2.4
18import QtTest 1.0
18import QtTest 1.0
19import Unity.Test 0.1 as UT
19import Unity.Test 0.1 as UT
20import ".."
20import ".."
21+import "../../../qml/Components"
21import "../../../qml/Stages"
22import "../../../qml/Stages"
22import Ubuntu.Components 1.3
23import Ubuntu.Components 1.3
23import Ubuntu.Components.ListItems 1.3 as ListItem
24import Ubuntu.Components.ListItems 1.3 as ListItem
@@ -73,8 +74,11 @@ Rectangle {
73 return Qt.LandscapeOrientation;
74 return Qt.LandscapeOrientation;
74 }
75 }
75 }
76 }
76− shellPrimaryOrientation: Qt.PortraitOrientation
77+
77− nativeOrientation: Qt.PortraitOrientation
78+ orientations: Orientations {
79+ // the default values will do
80+ }
81+
78 maximizedAppTopMargin: units.gu(3)
82 maximizedAppTopMargin: units.gu(3)
79 Component.onDestruction: {
83 Component.onDestruction: {
80 spreadDelegateLoader.itemDestroyed = true;
84 spreadDelegateLoader.itemDestroyed = true;
tests/qmltests/Stages/tst_TabletStage.qml+2−2
@@ -22,6 +22,7 @@ import Unity.Application 0.1
22import Unity.Test 0.1
22import Unity.Test 0.1
23
23
24import "../../../qml/Stages"
24import "../../../qml/Stages"
25+import "../../../qml/Components"
25
26
26Rectangle {
27Rectangle {
27 id: root
28 id: root
@@ -50,10 +51,9 @@ Rectangle {
50 maximizedAppTopMargin: units.gu(3) + units.dp(2)
51 maximizedAppTopMargin: units.gu(3) + units.dp(2)
51 interactive: true
52 interactive: true
52 shellOrientation: Qt.LandscapeOrientation
53 shellOrientation: Qt.LandscapeOrientation
53− shellPrimaryOrientation: Qt.LandscapeOrientation
54− nativeOrientation: Qt.LandscapeOrientation
55 nativeWidth: width
54 nativeWidth: width
56 nativeHeight: height
55 nativeHeight: height
56+ orientations: Orientations{} // Defaults are fine for testing
57 focus: true
57 focus: true
58 }
58 }
59 }
59 }
tests/qmltests/tst_OrientedShell.qml+1−1
@@ -840,7 +840,7 @@ Rectangle {
840 // shell should remain in its primery orientation as the app in the main stage
840 // shell should remain in its primery orientation as the app in the main stage
841 // is the one that dictates its orientation. In this case it's unity8-dash
841 // is the one that dictates its orientation. In this case it's unity8-dash
842 // which supports only primary orientation
842 // which supports only primary orientation
843− compare(shell.orientation, orientedShell.primaryOrientation);
843+ compare(shell.orientation, orientedShell.orientations.primary);
844 }
844 }
845
845
846 function test_sideStageAppsRemainPortraitInSpread_data() {
846 function test_sideStageAppsRemainPortraitInSpread_data() {
tests/qmltests/tst_Shell.qml+2−2
@@ -32,6 +32,7 @@ import Wizard 0.1 as Wizard
32import Utils 0.1
32import Utils 0.1
33
33
34import "../../qml"
34import "../../qml"
35+import "../../qml/Components"
35import "../../qml/Components/PanelState"
36import "../../qml/Components/PanelState"
36import "Stages"
37import "Stages"
37
38
@@ -99,8 +100,7 @@ Rectangle {
99 id: __shell
100 id: __shell
100 usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
101 usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
101 orientation: Qt.PortraitOrientation
102 orientation: Qt.PortraitOrientation
102− primaryOrientation: Qt.PortraitOrientation
103+ orientations: Orientations{} // Defaults are fine for testing
103− nativeOrientation: Qt.PortraitOrientation
104 Component.onDestruction: {
104 Component.onDestruction: {
105 shellLoader.itemDestroyed = true;
105 shellLoader.itemDestroyed = true;
106 }
106 }