on xenial help sign in
Merge lp:~josharenson/unity8/new_fix_upsidedown
fdda1b1Daniel d'Andrada
qml/DeviceConfiguration.qml+15
@@ -28,6 +28,20 @@ StateGroup {
28 | Qt.LandscapeOrientation
28 | Qt.LandscapeOrientation
29 | Qt.InvertedLandscapeOrientation
29 | Qt.InvertedLandscapeOrientation
30
30
31+ property var deviceSpecificOrientationOverrides: QtObject{
32+ id: overrides
33+ property int landscapeOrientation: Qt.LandscapeOrientation
34+ property int invertedLandscapeOrientation: Qt.InvertedLandscapeOrientation
35+ property int portraitOrientation: Qt.PortraitOrientation
36+ property int invertedPortraitOrientation: Qt.InvertedPortraitOrientation
37+ }
38+
39+ // PropertyChanges don't like assigning to nested properties
40+ property alias landscapeOrientation: overrides.landscapeOrientation
41+ property alias invertedLandscapeOrientation: overrides.invertedLandscapeOrientation
42+ property alias portraitOrientation: overrides.portraitOrientation
43+ property alias invertedPortraitOrientation: overrides.invertedPortraitOrientation
44+
31 // Supported values so far:
45 // Supported values so far:
32 // "phone", "tablet" or "desktop"
46 // "phone", "tablet" or "desktop"
33 property string category: "phone"
47 property string category: "phone"
@@ -77,6 +91,7 @@ StateGroup {
77 name: "flo"
91 name: "flo"
78 PropertyChanges {
92 PropertyChanges {
79 target: root
93 target: root
94+ landscapeOrientation: Qt.InvertedLandscapeOrientation
80 primaryOrientation: Qt.InvertedLandscapeOrientation
95 primaryOrientation: Qt.InvertedLandscapeOrientation
81 category: "tablet"
96 category: "tablet"
82 }
97 }
qml/OrientedShell.qml+1
@@ -153,6 +153,7 @@ Rectangle {
153 objectName: "shell"
153 objectName: "shell"
154 width: root.width
154 width: root.width
155 height: root.height
155 height: root.height
156+ deviceSpecificOrientationOverrides: deviceConfiguration.deviceSpecificOrientationOverrides
156 orientation: root.angleToOrientation(orientationAngle)
157 orientation: root.angleToOrientation(orientationAngle)
157 primaryOrientation: root.primaryOrientation
158 primaryOrientation: root.primaryOrientation
158 nativeOrientation: root.nativeOrientation
159 nativeOrientation: root.nativeOrientation
qml/Shell.qml+6
@@ -48,6 +48,7 @@ Item {
48 // to be set from outside
48 // to be set from outside
49 property int orientationAngle: 0
49 property int orientationAngle: 0
50 property int orientation
50 property int orientation
51+ property QtObject deviceSpecificOrientationOverrides
51 property int primaryOrientation
52 property int primaryOrientation
52 property int nativeOrientation
53 property int nativeOrientation
53 property real nativeWidth
54 property real nativeWidth
@@ -336,6 +337,11 @@ Item {
336 property: "nativeWidth"
337 property: "nativeWidth"
337 value: shell.nativeWidth
338 value: shell.nativeWidth
338 }
339 }
340+ Binding {
341+ target: applicationsDisplayLoader.item
342+ property: "deviceSpecificOrientationOverrides"
343+ value: shell.deviceSpecificOrientationOverrides
344+ }
339 Binding {
345 Binding {
340 target: applicationsDisplayLoader.item
346 target: applicationsDisplayLoader.item
341 property: "nativeHeight"
347 property: "nativeHeight"
qml/Stages/PhoneStage.qml+4
@@ -39,6 +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+
43+ // For some reason qml doesn't seem to like to bind to a QtObject, so this is a var
44+ property var deviceSpecificOrientationOverrides
42 property int shellOrientation
45 property int shellOrientation
43 property int shellPrimaryOrientation
46 property int shellPrimaryOrientation
44 property int nativeOrientation
47 property int nativeOrientation
@@ -528,6 +531,7 @@ Rectangle {
528 || (isDash && priv.focusedAppDelegateIsDislocated)
531 || (isDash && priv.focusedAppDelegateIsDislocated)
529
532
530
533
534+ deviceSpecificOrientationOverrides: root.deviceSpecificOrientationOverrides
531 shellOrientationAngle: root.shellOrientationAngle
535 shellOrientationAngle: root.shellOrientationAngle
532 shellOrientation: root.shellOrientation
536 shellOrientation: root.shellOrientation
533 shellPrimaryOrientation: root.shellPrimaryOrientation
537 shellPrimaryOrientation: root.shellPrimaryOrientation
qml/Stages/SpreadDelegate.qml+10−4
@@ -42,6 +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 QtObject deviceSpecificOrientationOverrides
45 property int shellPrimaryOrientation
46 property int shellPrimaryOrientation
46 property int nativeOrientation
47 property int nativeOrientation
47
48
@@ -139,6 +140,7 @@ FocusScope {
139 return angle % 360;
140 return angle % 360;
140 }
141 }
141
142
143+ property alias overrides: root.deviceSpecificOrientationOverrides
142 states: [
144 states: [
143 // Sets the initial orientationAngle of the window, when it first slides into view
145 // Sets the initial orientationAngle of the window, when it first slides into view
144 // (with the splash screen likely being displayed). At that point we just try to
146 // (with the splash screen likely being displayed). At that point we just try to
@@ -166,13 +168,17 @@ FocusScope {
166 if (supportedOrientations & root.shellOrientation) {
168 if (supportedOrientations & root.shellOrientation) {
167 chosenOrientation = root.shellOrientation;
169 chosenOrientation = root.shellOrientation;
168 } else if (supportedOrientations & Qt.PortraitOrientation) {
170 } else if (supportedOrientations & Qt.PortraitOrientation) {
169− chosenOrientation = Qt.PortraitOrientation;
171+ chosenOrientation = overrides ?
172+ overrides.portraitOrientation : Qt.PortraitOrientation;
170 } else if (supportedOrientations & Qt.LandscapeOrientation) {
173 } else if (supportedOrientations & Qt.LandscapeOrientation) {
171− chosenOrientation = Qt.LandscapeOrientation;
174+ chosenOrientation = overrides ?
175+ overrides.landscapeOrientation : Qt.LandscapeOrientation;
172 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
176 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
177+ chosenOrientation = overrides ?
173− chosenOrientation = Qt.InvertedPortraitOrientation;
178+ overrides.invertedPortraitOrientation : Qt.InvertedPortraitOrientation;
174 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
179 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
180+ chosenOrientation = overrides ?
175− chosenOrientation = Qt.InvertedLandscapeOrientation;
181+ overrides.invertedLandscapeOrientation : Qt.InvertedLandscapeOrientation;
176 } else {
182 } else {
177 chosenOrientation = root.shellPrimaryOrientation;
183 chosenOrientation = root.shellPrimaryOrientation;
178 }
184 }
qml/Stages/TabletStage.qml+5
@@ -39,11 +39,15 @@ 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+
43+ // For some reason qml doesn't seem to like to bind to a QtObject, so this is a var
44+ property var deviceSpecificOrientationOverrides
42 property int shellOrientation
45 property int shellOrientation
43 property int shellPrimaryOrientation
46 property int shellPrimaryOrientation
44 property int nativeOrientation
47 property int nativeOrientation
45 property real nativeWidth
48 property real nativeWidth
46 property real nativeHeight
49 property real nativeHeight
50+
47 function updateFocusedAppOrientation() {
51 function updateFocusedAppOrientation() {
48 var mainStageAppIndex = priv.indexOf(priv.mainStageAppId);
52 var mainStageAppIndex = priv.indexOf(priv.mainStageAppId);
49 if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) {
53 if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) {
@@ -689,6 +693,7 @@ Rectangle {
689 return progress;
693 return progress;
690 }
694 }
691
695
696+ deviceSpecificOrientationOverrides: root.deviceSpecificOrientationOverrides
692 shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0
697 shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0
693 shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation
698 shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation
694 shellPrimaryOrientation: wantsMainStage ? root.shellPrimaryOrientation : Qt.PortraitOrientation
699 shellPrimaryOrientation: wantsMainStage ? root.shellPrimaryOrientation : Qt.PortraitOrientation