Merge lp:~unity-team/unity8/new_fix_upsidedown into lp:unity8
- new_fix_upsidedown
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michał Sawicz |
Approved revision: | 1952 |
Merged at revision: | 2030 |
Proposed branch: | lp:~unity-team/unity8/new_fix_upsidedown |
Merge into: | lp:unity8 |
Prerequisite: | lp:~mzanetti/unity8/panel-button-fixes |
Diff against target: |
677 lines (+230/-142) 13 files modified
qml/Components/Orientations.qml (+57/-0) qml/DeviceConfiguration.qml (+93/-71) qml/OrientedShell.qml (+35/-25) qml/Shell.qml (+7/-13) qml/Stages/DesktopStage.qml (+2/-2) qml/Stages/PhoneStage.qml (+4/-6) qml/Stages/SpreadDelegate.qml (+8/-9) qml/Stages/TabletStage.qml (+13/-7) tests/qmltests/Stages/tst_PhoneStage.qml (+0/-2) tests/qmltests/Stages/tst_SpreadDelegate.qml (+6/-2) tests/qmltests/Stages/tst_TabletStage.qml (+2/-2) tests/qmltests/tst_OrientedShell.qml (+1/-1) tests/qmltests/tst_Shell.qml (+2/-2) |
To merge this branch: | bzr merge lp:~unity-team/unity8/new_fix_upsidedown |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Daniel d'Andrada | Pending | ||
Review via email: mp+275683@code.launchpad.net |
This proposal supersedes a proposal from 2015-10-26.
Commit message
Enable support for overriding application orientations based on device type
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
Branch is intended to supersede lp:~josharenson/unity8/fix_upside_down_apps
by encapsulating the orientation overrides inside a neat QtObject, intended to reduce lines of code and improve clarity.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
In tests/qmltests/
Don't we have to pass an Orientations object to Shell?
I think that's why we're getting the warning and test failures below:
"""
file://
"""
"""
FAIL! : qmltestrunner:
Loc: [/home/
"""
"""
FAIL! : qmltestrunner:
Loc: [/home/
"""
"""
FAIL! : qmltestrunner:
Loc: [/home/
FAIL! : qmltestrunner:
Actual (): 1
Expected (): 2
Loc: [/home/
"""
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
In qml/OrientedShe
"""
orientations: root.orientations ? root.orientations : ""
"""
This looks strange. Passing an empty string in case there's no root.orientations?
In which situation do you expect root.orientations to be null/undefined?
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
> In qml/OrientedShe
>
> """
> orientations: root.orientations ? root.orientations : ""
> """
>
> This looks strange. Passing an empty string in case there's no
> root.orientations?
>
> In which situation do you expect root.orientations to be null/undefined?
This was residual debug code that I will remove.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1938
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1939
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
Some OrientedShell tests are failing and others don't even compile (PhoneStage and TabletStage)!
Please do check the results from the latest jenkins test run
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
In tests/qmltests/
"""
orientations: Orientations{ id: orientations }
"""
This id is not being referenced anywhere. Please remove it.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1940
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1940
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Has wrong branches
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
Stripped tags, merged trunk
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
FAIL! : qmltestrunner:
Actual (): 8
Expected (): undefined
Loc: [/home/
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1941
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
The solution was already in some code that I must have accidentally removed. qmltestrunner:
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1942
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1943
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
whitespace check fails:
qml/Stages/
You're mixing tabs and spaces there.
Otherwise it looks good and tests pass now (at least the ones I tried)
Daniel d'Andrada (dandrader) : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1944
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1945
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1946
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1947. By Michał Sawicz
-
Bump QtQuick import
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1947
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1947
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1948
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
This seems to enable rotation when connected to an external screen.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1948
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1949. By Daniel d'Andrada
-
DeviceConfigura
tion.qml: Fix bogus merge with trunk
Daniel d'Andrada (dandrader) wrote : | # |
> This seems to enable rotation when connected to an external screen.
Fixed. Was due to a bogus merge with trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1949
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 1950. By Daniel d'Andrada
-
Another bug from a bad merge with trunk
- 1951. By Daniel d'Andrada
-
Fix
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1950
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1951
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
qmltestrunner.
property transformRotati
- 1952. By Daniel d'Andrada
-
Fix bug in OrientedShell.
orientationChan gesEnabled
Daniel d'Andrada (dandrader) wrote : | # |
> qmltestrunner.
> property transformRotati
Fixed. It was actually a bug in trunk!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1952
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michał Sawicz (saviq) wrote : | # |
All fixed, thanks.
Preview Diff
1 | === added file 'qml/Components/Orientations.qml' |
2 | --- qml/Components/Orientations.qml 1970-01-01 00:00:00 +0000 |
3 | +++ qml/Components/Orientations.qml 2015-10-30 13:37:41 +0000 |
4 | @@ -0,0 +1,57 @@ |
5 | +/* |
6 | + * Copyright 2015 Canonical Ltd. |
7 | + * |
8 | + * This program is free software; you can redistribute it and/or modify |
9 | + * it under the terms of the GNU General Public License as published by |
10 | + * the Free Software Foundation; version 3. |
11 | + * |
12 | + * This program is distributed in the hope that it will be useful, |
13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | + * GNU General Public License for more details. |
16 | + * |
17 | + * You should have received a copy of the GNU General Public License |
18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | + */ |
20 | + |
21 | +import QtQuick 2.4 |
22 | + |
23 | +QtObject { |
24 | + id: root |
25 | + |
26 | + // Just because "native" is a reserved keyword :( |
27 | + property int native_: Qt.PortraitOrientation |
28 | + |
29 | + property int primary: Qt.PortraitOrientation |
30 | + |
31 | + property int landscape: Qt.LandscapeOrientation |
32 | + property int invertedLandscape: Qt.InvertedLandscapeOrientation |
33 | + property int portrait: Qt.PortraitOrientation |
34 | + property int invertedPortrait: Qt.InvertedPortraitOrientation |
35 | + |
36 | + function map(orientations) { |
37 | + var result = 0; |
38 | + |
39 | + if (orientations & Qt.PortraitOrientation) { |
40 | + result |= root.portrait; |
41 | + } |
42 | + |
43 | + if (orientations & Qt.InvertedPortraitOrientation) { |
44 | + result |= root.invertedPortrait; |
45 | + } |
46 | + |
47 | + if (orientations & Qt.LandscapeOrientation) { |
48 | + result |= root.landscape; |
49 | + } |
50 | + |
51 | + if (orientations & Qt.InvertedLandscapeOrientation) { |
52 | + result |= root.invertedLandscape; |
53 | + } |
54 | + |
55 | + if (result == 0) { |
56 | + result = root.primary; |
57 | + } |
58 | + |
59 | + return result; |
60 | + } |
61 | +} |
62 | |
63 | === modified file 'qml/DeviceConfiguration.qml' |
64 | --- qml/DeviceConfiguration.qml 2015-10-05 16:43:41 +0000 |
65 | +++ qml/DeviceConfiguration.qml 2015-10-30 13:37:41 +0000 |
66 | @@ -16,79 +16,101 @@ |
67 | |
68 | import QtQuick 2.0 |
69 | |
70 | -StateGroup { |
71 | +QtObject { |
72 | id: root |
73 | |
74 | readonly property int useNativeOrientation: -1 |
75 | |
76 | - property int primaryOrientation: useNativeOrientation |
77 | - |
78 | - property int supportedOrientations: Qt.PortraitOrientation |
79 | - | Qt.InvertedPortraitOrientation |
80 | - | Qt.LandscapeOrientation |
81 | - | Qt.InvertedLandscapeOrientation |
82 | - |
83 | - // Supported values so far: |
84 | - // "phone", "tablet" or "desktop" |
85 | - property string category: "phone" |
86 | - |
87 | - property int ignoredMice: 0 |
88 | - |
89 | - |
90 | - property alias name: root.state |
91 | - |
92 | - states: [ |
93 | - State { |
94 | - name: "mako" |
95 | - PropertyChanges { |
96 | - target: root |
97 | - supportedOrientations: Qt.PortraitOrientation |
98 | - | Qt.LandscapeOrientation |
99 | - | Qt.InvertedLandscapeOrientation |
100 | - } |
101 | - }, |
102 | - State { |
103 | - name: "krillin" |
104 | - PropertyChanges { |
105 | - target: root |
106 | - supportedOrientations: Qt.PortraitOrientation |
107 | - | Qt.LandscapeOrientation |
108 | - | Qt.InvertedLandscapeOrientation |
109 | - } |
110 | - }, |
111 | - State { |
112 | - name: "arale" |
113 | - PropertyChanges { |
114 | - target: root |
115 | - supportedOrientations: Qt.PortraitOrientation |
116 | - | Qt.LandscapeOrientation |
117 | - | Qt.InvertedLandscapeOrientation |
118 | - ignoredMice: 1 |
119 | - } |
120 | - }, |
121 | - State { |
122 | - name: "manta" |
123 | - PropertyChanges { |
124 | - target: root |
125 | - category: "tablet" |
126 | - } |
127 | - }, |
128 | - State { |
129 | - name: "flo" |
130 | - PropertyChanges { |
131 | - target: root |
132 | - primaryOrientation: Qt.InvertedLandscapeOrientation |
133 | - category: "tablet" |
134 | - } |
135 | - }, |
136 | - State { |
137 | - name: "desktop" |
138 | - PropertyChanges { |
139 | - target: root |
140 | - category: "desktop" |
141 | - supportedOrientations: root.useNativeOrientation |
142 | - } |
143 | - } |
144 | - ] |
145 | - |
146 | + // The only writable property in the API |
147 | + // all other properties are set according to the device name |
148 | + property alias name: priv.state |
149 | + |
150 | + readonly property alias primaryOrientation: priv.primaryOrientation |
151 | + readonly property alias supportedOrientations: priv.supportedOrientations |
152 | + readonly property alias landscapeOrientation: priv.landscapeOrientation |
153 | + readonly property alias invertedLandscapeOrientation: priv.invertedLandscapeOrientation |
154 | + readonly property alias portraitOrientation: priv.portraitOrientation |
155 | + readonly property alias invertedPortraitOrientation: priv.invertedPortraitOrientation |
156 | + |
157 | + readonly property alias category: priv.category |
158 | + |
159 | + readonly property alias ignoredMice: priv.ignoredMice |
160 | + |
161 | + readonly property var priv: StateGroup { |
162 | + id: priv |
163 | + |
164 | + property int primaryOrientation: root.useNativeOrientation |
165 | + |
166 | + property int supportedOrientations: Qt.PortraitOrientation |
167 | + | Qt.InvertedPortraitOrientation |
168 | + | Qt.LandscapeOrientation |
169 | + | Qt.InvertedLandscapeOrientation |
170 | + |
171 | + property int landscapeOrientation: Qt.LandscapeOrientation |
172 | + property int invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation |
173 | + property int portraitOrientation: Qt.PortraitOrientation |
174 | + property int invertedPortraitOrientation: Qt.InvertedPortraitOrientation |
175 | + |
176 | + // Supported values so far: |
177 | + // "phone", "tablet" or "desktop" |
178 | + property string category: "phone" |
179 | + |
180 | + property int ignoredMice: 0 |
181 | + |
182 | + states: [ |
183 | + State { |
184 | + name: "mako" |
185 | + PropertyChanges { |
186 | + target: priv |
187 | + supportedOrientations: Qt.PortraitOrientation |
188 | + | Qt.LandscapeOrientation |
189 | + | Qt.InvertedLandscapeOrientation |
190 | + } |
191 | + }, |
192 | + State { |
193 | + name: "krillin" |
194 | + PropertyChanges { |
195 | + target: priv |
196 | + supportedOrientations: Qt.PortraitOrientation |
197 | + | Qt.LandscapeOrientation |
198 | + | Qt.InvertedLandscapeOrientation |
199 | + } |
200 | + }, |
201 | + State { |
202 | + name: "arale" |
203 | + PropertyChanges { |
204 | + target: priv |
205 | + supportedOrientations: Qt.PortraitOrientation |
206 | + | Qt.LandscapeOrientation |
207 | + | Qt.InvertedLandscapeOrientation |
208 | + ignoredMice: 1 |
209 | + } |
210 | + }, |
211 | + State { |
212 | + name: "manta" |
213 | + PropertyChanges { |
214 | + target: priv |
215 | + category: "tablet" |
216 | + } |
217 | + }, |
218 | + State { |
219 | + name: "flo" |
220 | + PropertyChanges { |
221 | + target: priv |
222 | + landscapeOrientation: Qt.InvertedLandscapeOrientation |
223 | + invertedLandscapeOrientation: Qt.LandscapeOrientation |
224 | + primaryOrientation: Qt.InvertedLandscapeOrientation |
225 | + category: "tablet" |
226 | + } |
227 | + }, |
228 | + State { |
229 | + name: "desktop" |
230 | + PropertyChanges { |
231 | + target: priv |
232 | + category: "desktop" |
233 | + supportedOrientations: root.useNativeOrientation |
234 | + } |
235 | + } |
236 | + ] |
237 | + } |
238 | } |
239 | |
240 | === modified file 'qml/OrientedShell.qml' |
241 | --- qml/OrientedShell.qml 2015-10-05 19:15:03 +0000 |
242 | +++ qml/OrientedShell.qml 2015-10-30 13:37:41 +0000 |
243 | @@ -32,20 +32,31 @@ |
244 | implicitWidth: units.gu(40) |
245 | implicitHeight: units.gu(71) |
246 | |
247 | - // NB: native and primary orientations here don't map exactly to their QScreen counterparts |
248 | - readonly property int nativeOrientation: width > height ? Qt.LandscapeOrientation : Qt.PortraitOrientation |
249 | - |
250 | - readonly property int primaryOrientation: |
251 | - deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation |
252 | - ? nativeOrientation : deviceConfiguration.primaryOrientation |
253 | - |
254 | DeviceConfiguration { |
255 | id: deviceConfiguration |
256 | name: applicationArguments.deviceName |
257 | } |
258 | |
259 | - |
260 | - // to be overwritten by tests |
261 | + property alias orientations: d.orientations |
262 | + |
263 | + Item { |
264 | + id: d |
265 | + |
266 | + property Orientations orientations: Orientations { |
267 | + id: orientations |
268 | + // NB: native and primary orientations here don't map exactly to their QScreen counterparts |
269 | + native_: root.width > root.height ? Qt.LandscapeOrientation : Qt.PortraitOrientation |
270 | + |
271 | + primary: deviceConfiguration.primaryOrientation == deviceConfiguration.useNativeOrientation |
272 | + ? native_ : deviceConfiguration.primaryOrientation |
273 | + |
274 | + landscape: deviceConfiguration.landscapeOrientation |
275 | + invertedLandscape: deviceConfiguration.invertedLandscapeOrientation |
276 | + portrait: deviceConfiguration.portraitOrientation |
277 | + invertedPortrait: deviceConfiguration.invertedPortraitOrientation |
278 | + } |
279 | + } |
280 | + // to be overwritten by tests |
281 | property var unity8Settings: Unity8Settings {} |
282 | property var oskSettings: GSettings { schema.id: "com.canonical.keyboard.maliit" } |
283 | |
284 | @@ -78,8 +89,8 @@ |
285 | |
286 | // we must rotate to a supported orientation regardless of shell's preference |
287 | property bool orientationChangesEnabled: |
288 | - (orientation & supportedOrientations) === 0 ? true |
289 | - : shell.orientationChangesEnabled |
290 | + (shell.orientation & supportedOrientations) === 0 ? true |
291 | + : shell.orientationChangesEnabled |
292 | |
293 | |
294 | Binding { |
295 | @@ -96,12 +107,12 @@ |
296 | |
297 | readonly property int supportedOrientations: shell.supportedOrientations |
298 | & (deviceConfiguration.supportedOrientations == deviceConfiguration.useNativeOrientation |
299 | - ? nativeOrientation |
300 | + ? orientations.native_ |
301 | : deviceConfiguration.supportedOrientations) |
302 | |
303 | property int acceptedOrientationAngle: { |
304 | if (orientation & supportedOrientations) { |
305 | - return Screen.angleBetween(nativeOrientation, orientation); |
306 | + return Screen.angleBetween(orientations.native_, orientation); |
307 | } else if (shell.orientation & supportedOrientations) { |
308 | // stay where we are |
309 | return shell.orientationAngle; |
310 | @@ -111,16 +122,16 @@ |
311 | // rotate to some supported orientation as we can't stay where we currently are |
312 | // TODO: Choose the closest to the current one |
313 | if (supportedOrientations & Qt.PortraitOrientation) { |
314 | - return Screen.angleBetween(nativeOrientation, Qt.PortraitOrientation); |
315 | + return Screen.angleBetween(orientations.native_, Qt.PortraitOrientation); |
316 | } else if (supportedOrientations & Qt.LandscapeOrientation) { |
317 | - return Screen.angleBetween(nativeOrientation, Qt.LandscapeOrientation); |
318 | + return Screen.angleBetween(orientations.native_, Qt.LandscapeOrientation); |
319 | } else if (supportedOrientations & Qt.InvertedPortraitOrientation) { |
320 | - return Screen.angleBetween(nativeOrientation, Qt.InvertedPortraitOrientation); |
321 | + return Screen.angleBetween(orientations.native_, Qt.InvertedPortraitOrientation); |
322 | } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) { |
323 | - return Screen.angleBetween(nativeOrientation, Qt.InvertedLandscapeOrientation); |
324 | + return Screen.angleBetween(orientations.native_, Qt.InvertedLandscapeOrientation); |
325 | } else { |
326 | // if all fails, fallback to primary orientation |
327 | - return Screen.angleBetween(nativeOrientation, primaryOrientation); |
328 | + return Screen.angleBetween(orientations.native_, orientations.primary); |
329 | } |
330 | } |
331 | } |
332 | @@ -128,19 +139,19 @@ |
333 | function angleToOrientation(angle) { |
334 | switch (angle) { |
335 | case 0: |
336 | - return nativeOrientation; |
337 | + return orientations.native_; |
338 | case 90: |
339 | - return nativeOrientation === Qt.PortraitOrientation ? Qt.InvertedLandscapeOrientation |
340 | + return orientations.native_ === Qt.PortraitOrientation ? Qt.InvertedLandscapeOrientation |
341 | : Qt.PortraitOrientation; |
342 | case 180: |
343 | - return nativeOrientation === Qt.PortraitOrientation ? Qt.InvertedPortraitOrientation |
344 | + return orientations.native_ === Qt.PortraitOrientation ? Qt.InvertedPortraitOrientation |
345 | : Qt.InvertedLandscapeOrientation; |
346 | case 270: |
347 | - return nativeOrientation === Qt.PortraitOrientation ? Qt.LandscapeOrientation |
348 | + return orientations.native_ === Qt.PortraitOrientation ? Qt.LandscapeOrientation |
349 | : Qt.InvertedPortraitOrientation; |
350 | default: |
351 | console.warn("angleToOrientation: Invalid orientation angle: " + angle); |
352 | - return primaryOrientation; |
353 | + return orientations.primary; |
354 | } |
355 | } |
356 | |
357 | @@ -159,8 +170,7 @@ |
358 | width: root.width |
359 | height: root.height |
360 | orientation: root.angleToOrientation(orientationAngle) |
361 | - primaryOrientation: root.primaryOrientation |
362 | - nativeOrientation: root.nativeOrientation |
363 | + orientations: root.orientations |
364 | nativeWidth: root.width |
365 | nativeHeight: root.height |
366 | mode: applicationArguments.mode |
367 | |
368 | === modified file 'qml/Shell.qml' |
369 | --- qml/Shell.qml 2015-10-30 13:37:40 +0000 |
370 | +++ qml/Shell.qml 2015-10-30 13:37:41 +0000 |
371 | @@ -49,8 +49,7 @@ |
372 | // to be set from outside |
373 | property int orientationAngle: 0 |
374 | property int orientation |
375 | - property int primaryOrientation |
376 | - property int nativeOrientation |
377 | + property Orientations orientations |
378 | property real nativeWidth |
379 | property real nativeHeight |
380 | property alias indicatorAreaShowProgress: panel.indicatorAreaShowProgress |
381 | @@ -86,7 +85,7 @@ |
382 | } else if (greeter && greeter.shown) { |
383 | return Qt.PrimaryOrientation; |
384 | } else if (mainApp) { |
385 | - return mainApp.supportedOrientations; |
386 | + return shell.orientations.map(mainApp.supportedOrientations); |
387 | } else { |
388 | // we just don't care |
389 | return Qt.PortraitOrientation |
390 | @@ -299,21 +298,16 @@ |
391 | } |
392 | Binding { |
393 | target: applicationsDisplayLoader.item |
394 | + property: "orientations" |
395 | + value: shell.orientations |
396 | + } |
397 | + Binding { |
398 | + target: applicationsDisplayLoader.item |
399 | property: "background" |
400 | value: wallpaperResolver.background |
401 | } |
402 | Binding { |
403 | target: applicationsDisplayLoader.item |
404 | - property: "shellPrimaryOrientation" |
405 | - value: shell.primaryOrientation |
406 | - } |
407 | - Binding { |
408 | - target: applicationsDisplayLoader.item |
409 | - property: "nativeOrientation" |
410 | - value: shell.nativeOrientation |
411 | - } |
412 | - Binding { |
413 | - target: applicationsDisplayLoader.item |
414 | property: "nativeWidth" |
415 | value: shell.nativeWidth |
416 | } |
417 | |
418 | === modified file 'qml/Stages/DesktopStage.qml' |
419 | --- qml/Stages/DesktopStage.qml 2015-10-30 13:37:40 +0000 |
420 | +++ qml/Stages/DesktopStage.qml 2015-10-30 13:37:41 +0000 |
421 | @@ -22,6 +22,7 @@ |
422 | import Unity.Application 0.1 |
423 | import "../Components" |
424 | import "../Components/PanelState" |
425 | +import "../Components" |
426 | import Utils 0.1 |
427 | import Ubuntu.Gestures 0.1 |
428 | |
429 | @@ -37,8 +38,7 @@ |
430 | property real inverseProgress: 0 // just to comply with the interface shared between stages |
431 | property int shellOrientationAngle: 0 |
432 | property int shellOrientation |
433 | - property int shellPrimaryOrientation |
434 | - property int nativeOrientation |
435 | + property QtObject orientations |
436 | property bool beingResized: false |
437 | property bool keepDashRunning: true |
438 | property bool suspended: false |
439 | |
440 | === modified file 'qml/Stages/PhoneStage.qml' |
441 | --- qml/Stages/PhoneStage.qml 2015-09-21 13:37:47 +0000 |
442 | +++ qml/Stages/PhoneStage.qml 2015-10-30 13:37:41 +0000 |
443 | @@ -39,9 +39,9 @@ |
444 | property bool keepDashRunning: true |
445 | property bool suspended: false |
446 | property int shellOrientationAngle: 0 |
447 | + |
448 | property int shellOrientation |
449 | - property int shellPrimaryOrientation |
450 | - property int nativeOrientation |
451 | + property QtObject orientations |
452 | property real nativeWidth |
453 | property real nativeHeight |
454 | property bool beingResized: false |
455 | @@ -71,7 +71,7 @@ |
456 | |
457 | var supportedOrientations = spreadDelegate.application.supportedOrientations; |
458 | if (supportedOrientations === Qt.PrimaryOrientation) { |
459 | - supportedOrientations = spreadDelegate.shellPrimaryOrientation; |
460 | + supportedOrientations = root.orientations.primary; |
461 | } |
462 | |
463 | if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) { |
464 | @@ -535,11 +535,9 @@ |
465 | visible: (progress >= 0 && progress < 1.7) |
466 | || (isDash && priv.focusedAppDelegateIsDislocated) |
467 | |
468 | - |
469 | shellOrientationAngle: root.shellOrientationAngle |
470 | shellOrientation: root.shellOrientation |
471 | - shellPrimaryOrientation: root.shellPrimaryOrientation |
472 | - nativeOrientation: root.nativeOrientation |
473 | + orientations: root.orientations |
474 | |
475 | onClicked: { |
476 | if (root.altTabEnabled && spreadView.phase == 2) { |
477 | |
478 | === modified file 'qml/Stages/SpreadDelegate.qml' |
479 | --- qml/Stages/SpreadDelegate.qml 2015-09-21 13:10:02 +0000 |
480 | +++ qml/Stages/SpreadDelegate.qml 2015-10-30 13:37:41 +0000 |
481 | @@ -42,8 +42,7 @@ |
482 | property alias application: appWindow.application |
483 | property int shellOrientationAngle |
484 | property int shellOrientation |
485 | - property int shellPrimaryOrientation |
486 | - property int nativeOrientation |
487 | + property QtObject orientations |
488 | |
489 | function matchShellOrientation() { |
490 | if (!root.application) |
491 | @@ -157,7 +156,7 @@ |
492 | var supportedOrientations = root.application.supportedOrientations; |
493 | |
494 | if (supportedOrientations === Qt.PrimaryOrientation) { |
495 | - supportedOrientations = root.shellPrimaryOrientation; |
496 | + supportedOrientations = root.orientations.primary; |
497 | } |
498 | |
499 | // If it doesn't support shell's current orientation |
500 | @@ -166,18 +165,18 @@ |
501 | if (supportedOrientations & root.shellOrientation) { |
502 | chosenOrientation = root.shellOrientation; |
503 | } else if (supportedOrientations & Qt.PortraitOrientation) { |
504 | - chosenOrientation = Qt.PortraitOrientation; |
505 | + chosenOrientation = root.orientations.portrait; |
506 | } else if (supportedOrientations & Qt.LandscapeOrientation) { |
507 | - chosenOrientation = Qt.LandscapeOrientation; |
508 | + chosenOrientation = root.orientations.landscape; |
509 | } else if (supportedOrientations & Qt.InvertedPortraitOrientation) { |
510 | - chosenOrientation = Qt.InvertedPortraitOrientation; |
511 | + chosenOrientation = root.orientations.invertedPortrait; |
512 | } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) { |
513 | - chosenOrientation = Qt.InvertedLandscapeOrientation; |
514 | + chosenOrientation = root.orientations.invertedLandscape; |
515 | } else { |
516 | - chosenOrientation = root.shellPrimaryOrientation; |
517 | + chosenOrientation = root.orientations.primary; |
518 | } |
519 | |
520 | - return Screen.angleBetween(root.nativeOrientation, chosenOrientation); |
521 | + return Screen.angleBetween(root.orientations.native_, chosenOrientation); |
522 | } |
523 | |
524 | rotation: normalizeAngle(appWindowWithShadow.orientationAngle - root.shellOrientationAngle) |
525 | |
526 | === modified file 'qml/Stages/TabletStage.qml' |
527 | --- qml/Stages/TabletStage.qml 2015-08-03 13:47:44 +0000 |
528 | +++ qml/Stages/TabletStage.qml 2015-10-30 13:37:41 +0000 |
529 | @@ -39,11 +39,12 @@ |
530 | property bool keepDashRunning: true |
531 | property bool suspended: false |
532 | property int shellOrientationAngle: 0 |
533 | + |
534 | property int shellOrientation |
535 | - property int shellPrimaryOrientation |
536 | - property int nativeOrientation |
537 | + property QtObject orientations |
538 | property real nativeWidth |
539 | property real nativeHeight |
540 | + |
541 | function updateFocusedAppOrientation() { |
542 | var mainStageAppIndex = priv.indexOf(priv.mainStageAppId); |
543 | if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) { |
544 | @@ -64,7 +65,7 @@ |
545 | |
546 | var supportedOrientations = spreadDelegate.application.supportedOrientations; |
547 | if (supportedOrientations === Qt.PrimaryOrientation) { |
548 | - supportedOrientations = spreadDelegate.shellPrimaryOrientation; |
549 | + supportedOrientations = spreadDelegate.orientations.primary; |
550 | } |
551 | |
552 | if (delta === 180 && (supportedOrientations & spreadDelegate.shellOrientation)) { |
553 | @@ -130,7 +131,7 @@ |
554 | property string oldFocusedAppId: "" |
555 | property bool mainAppOrientationChangesEnabled: false |
556 | |
557 | - property real landscapeHeight: root.nativeOrientation == Qt.LandscapeOrientation ? |
558 | + property real landscapeHeight: root.orientations.native_ == Qt.LandscapeOrientation ? |
559 | root.nativeHeight : root.nativeWidth |
560 | |
561 | property bool shellIsLandscape: root.shellOrientation === Qt.LandscapeOrientation |
562 | @@ -691,9 +692,14 @@ |
563 | |
564 | shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0 |
565 | shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation |
566 | - shellPrimaryOrientation: wantsMainStage ? root.shellPrimaryOrientation : Qt.PortraitOrientation |
567 | - nativeOrientation: wantsMainStage ? root.nativeOrientation : Qt.PortraitOrientation |
568 | - |
569 | + orientations: Orientations { |
570 | + primary: spreadTile.wantsMainStage ? root.orientations.primary : Qt.PortraitOrientation |
571 | + native_: spreadTile.wantsMainStage ? root.orientations.native_ : Qt.PortraitOrientation |
572 | + portrait: root.orientations.portrait |
573 | + invertedPortrait: root.orientations.invertedPortrait |
574 | + landscape: root.orientations.landscape |
575 | + invertedLandscape: root.orientations.invertedLandscape |
576 | + } |
577 | |
578 | onClicked: { |
579 | if (spreadView.phase == 2) { |
580 | |
581 | === modified file 'tests/qmltests/Stages/tst_PhoneStage.qml' |
582 | --- tests/qmltests/Stages/tst_PhoneStage.qml 2015-08-12 15:08:09 +0000 |
583 | +++ tests/qmltests/Stages/tst_PhoneStage.qml 2015-10-30 13:37:41 +0000 |
584 | @@ -34,8 +34,6 @@ |
585 | maximizedAppTopMargin: units.gu(3) + units.dp(2) |
586 | interactive: true |
587 | shellOrientation: Qt.PortraitOrientation |
588 | - shellPrimaryOrientation: Qt.PortraitOrientation |
589 | - nativeOrientation: Qt.PortraitOrientation |
590 | } |
591 | |
592 | Binding { |
593 | |
594 | === modified file 'tests/qmltests/Stages/tst_SpreadDelegate.qml' |
595 | --- tests/qmltests/Stages/tst_SpreadDelegate.qml 2015-03-06 04:44:11 +0000 |
596 | +++ tests/qmltests/Stages/tst_SpreadDelegate.qml 2015-10-30 13:37:41 +0000 |
597 | @@ -18,6 +18,7 @@ |
598 | import QtTest 1.0 |
599 | import Unity.Test 0.1 as UT |
600 | import ".." |
601 | +import "../../../qml/Components" |
602 | import "../../../qml/Stages" |
603 | import Ubuntu.Components 0.1 |
604 | import Ubuntu.Components.ListItems 1.0 as ListItem |
605 | @@ -73,8 +74,11 @@ |
606 | return Qt.LandscapeOrientation; |
607 | } |
608 | } |
609 | - shellPrimaryOrientation: Qt.PortraitOrientation |
610 | - nativeOrientation: Qt.PortraitOrientation |
611 | + |
612 | + orientations: Orientations { |
613 | + // the default values will do |
614 | + } |
615 | + |
616 | maximizedAppTopMargin: units.gu(3) |
617 | Component.onDestruction: { |
618 | spreadDelegateLoader.itemDestroyed = true; |
619 | |
620 | === modified file 'tests/qmltests/Stages/tst_TabletStage.qml' |
621 | --- tests/qmltests/Stages/tst_TabletStage.qml 2015-09-02 14:26:43 +0000 |
622 | +++ tests/qmltests/Stages/tst_TabletStage.qml 2015-10-30 13:37:41 +0000 |
623 | @@ -22,6 +22,7 @@ |
624 | import Unity.Test 0.1 |
625 | |
626 | import "../../../qml/Stages" |
627 | +import "../../../qml/Components" |
628 | |
629 | Rectangle { |
630 | id: root |
631 | @@ -50,10 +51,9 @@ |
632 | maximizedAppTopMargin: units.gu(3) + units.dp(2) |
633 | interactive: true |
634 | shellOrientation: Qt.LandscapeOrientation |
635 | - shellPrimaryOrientation: Qt.LandscapeOrientation |
636 | - nativeOrientation: Qt.LandscapeOrientation |
637 | nativeWidth: width |
638 | nativeHeight: height |
639 | + orientations: Orientations{} // Defaults are fine for testing |
640 | focus: true |
641 | } |
642 | } |
643 | |
644 | === modified file 'tests/qmltests/tst_OrientedShell.qml' |
645 | --- tests/qmltests/tst_OrientedShell.qml 2015-10-05 22:04:32 +0000 |
646 | +++ tests/qmltests/tst_OrientedShell.qml 2015-10-30 13:37:41 +0000 |
647 | @@ -840,7 +840,7 @@ |
648 | // shell should remain in its primery orientation as the app in the main stage |
649 | // is the one that dictates its orientation. In this case it's unity8-dash |
650 | // which supports only primary orientation |
651 | - compare(shell.orientation, orientedShell.primaryOrientation); |
652 | + compare(shell.orientation, orientedShell.orientations.primary); |
653 | } |
654 | |
655 | function test_sideStageAppsRemainPortraitInSpread_data() { |
656 | |
657 | === modified file 'tests/qmltests/tst_Shell.qml' |
658 | --- tests/qmltests/tst_Shell.qml 2015-10-30 13:37:40 +0000 |
659 | +++ tests/qmltests/tst_Shell.qml 2015-10-30 13:37:41 +0000 |
660 | @@ -32,6 +32,7 @@ |
661 | import Utils 0.1 |
662 | |
663 | import "../../qml" |
664 | +import "../../qml/Components" |
665 | import "../../qml/Components/PanelState" |
666 | import "Stages" |
667 | |
668 | @@ -99,8 +100,7 @@ |
669 | id: __shell |
670 | usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex] |
671 | orientation: Qt.PortraitOrientation |
672 | - primaryOrientation: Qt.PortraitOrientation |
673 | - nativeOrientation: Qt.PortraitOrientation |
674 | + orientations: Orientations{} // Defaults are fine for testing |
675 | Component.onDestruction: { |
676 | shellLoader.itemDestroyed = true; |
677 | } |
FAILED: Continuous integration, rev:1936 jenkins. qa.ubuntu. com/job/ unity8- ci/6353/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- vivid-touch/ 4367 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- wily-touch/ 728 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- vivid/1065 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- wily/383 jenkins. qa.ubuntu. com/job/ unity8- vivid-amd64- ci/960 jenkins. qa.ubuntu. com/job/ unity8- vivid-i386- ci/961 jenkins. qa.ubuntu. com/job/ unity8- wily-amd64- ci/592 jenkins. qa.ubuntu. com/job/ unity8- wily-i386- ci/593 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- vivid-mako/ 3558 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 4364 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- vivid-armhf/ 4364/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 23683 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- wily-mako/ 439 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- wily-armhf/ 728 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- wily-armhf/ 728/artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 23684
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity8- ci/6353/ rebuild
http://