on xenial help sign in
Merge lp:~josharenson/unity8/new_fix_upsidedown
commitfdda1b1eb868b7e1c0859d45ec507d9f242566d9 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 24 Aug 2015, 14:02 (11 years ago) parenta8f7a60cbf4e11
6 files changed+41−4
qml/DeviceConfiguration.qml+15 qml/OrientedShell.qml+1 qml/Shell.qml+6 qml/Stages/PhoneStage.qml+4 qml/Stages/SpreadDelegate.qml+10−4 qml/Stages/TabletStage.qml+5
qml/DeviceConfiguration.qml+15
@@ -28,6 +28,20 @@ StateGroup {
2828 | Qt.LandscapeOrientation
2929 | Qt.InvertedLandscapeOrientation
3030
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+
3145 // Supported values so far:
3246 // "phone", "tablet" or "desktop"
3347 property string category: "phone"
@@ -77,6 +91,7 @@ StateGroup {
7791 name: "flo"
7892 PropertyChanges {
7993 target: root
94+ landscapeOrientation: Qt.InvertedLandscapeOrientation
8095 primaryOrientation: Qt.InvertedLandscapeOrientation
8196 category: "tablet"
8297 }
qml/OrientedShell.qml+1
@@ -153,6 +153,7 @@ Rectangle {
153153 objectName: "shell"
154154 width: root.width
155155 height: root.height
156+ deviceSpecificOrientationOverrides: deviceConfiguration.deviceSpecificOrientationOverrides
156157 orientation: root.angleToOrientation(orientationAngle)
157158 primaryOrientation: root.primaryOrientation
158159 nativeOrientation: root.nativeOrientation
qml/Shell.qml+6
@@ -48,6 +48,7 @@ Item {
4848 // to be set from outside
4949 property int orientationAngle: 0
5050 property int orientation
51+ property QtObject deviceSpecificOrientationOverrides
5152 property int primaryOrientation
5253 property int nativeOrientation
5354 property real nativeWidth
@@ -336,6 +337,11 @@ Item {
336337 property: "nativeWidth"
337338 value: shell.nativeWidth
338339 }
340+ Binding {
341+ target: applicationsDisplayLoader.item
342+ property: "deviceSpecificOrientationOverrides"
343+ value: shell.deviceSpecificOrientationOverrides
344+ }
339345 Binding {
340346 target: applicationsDisplayLoader.item
341347 property: "nativeHeight"
qml/Stages/PhoneStage.qml+4
@@ -39,6 +39,9 @@ Rectangle {
3939 property bool keepDashRunning: true
4040 property bool suspended: false
4141 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
4245 property int shellOrientation
4346 property int shellPrimaryOrientation
4447 property int nativeOrientation
@@ -528,6 +531,7 @@ Rectangle {
528531 || (isDash && priv.focusedAppDelegateIsDislocated)
529532
530533
534+ deviceSpecificOrientationOverrides: root.deviceSpecificOrientationOverrides
531535 shellOrientationAngle: root.shellOrientationAngle
532536 shellOrientation: root.shellOrientation
533537 shellPrimaryOrientation: root.shellPrimaryOrientation
qml/Stages/SpreadDelegate.qml+10−4
@@ -42,6 +42,7 @@ FocusScope {
4242 property alias application: appWindow.application
4343 property int shellOrientationAngle
4444 property int shellOrientation
45+ property QtObject deviceSpecificOrientationOverrides
4546 property int shellPrimaryOrientation
4647 property int nativeOrientation
4748
@@ -139,6 +140,7 @@ FocusScope {
139140 return angle % 360;
140141 }
141142
143+ property alias overrides: root.deviceSpecificOrientationOverrides
142144 states: [
143145 // Sets the initial orientationAngle of the window, when it first slides into view
144146 // (with the splash screen likely being displayed). At that point we just try to
@@ -166,13 +168,17 @@ FocusScope {
166168 if (supportedOrientations & root.shellOrientation) {
167169 chosenOrientation = root.shellOrientation;
168170 } else if (supportedOrientations & Qt.PortraitOrientation) {
169− chosenOrientation = Qt.PortraitOrientation;
171+ chosenOrientation = overrides ?
172+ overrides.portraitOrientation : Qt.PortraitOrientation;
170173 } else if (supportedOrientations & Qt.LandscapeOrientation) {
171− chosenOrientation = Qt.LandscapeOrientation;
174+ chosenOrientation = overrides ?
175+ overrides.landscapeOrientation : Qt.LandscapeOrientation;
172176 } else if (supportedOrientations & Qt.InvertedPortraitOrientation) {
173− chosenOrientation = Qt.InvertedPortraitOrientation;
177+ chosenOrientation = overrides ?
178+ overrides.invertedPortraitOrientation : Qt.InvertedPortraitOrientation;
174179 } else if (supportedOrientations & Qt.InvertedLandscapeOrientation) {
175− chosenOrientation = Qt.InvertedLandscapeOrientation;
180+ chosenOrientation = overrides ?
181+ overrides.invertedLandscapeOrientation : Qt.InvertedLandscapeOrientation;
176182 } else {
177183 chosenOrientation = root.shellPrimaryOrientation;
178184 }
qml/Stages/TabletStage.qml+5
@@ -39,11 +39,15 @@ Rectangle {
3939 property bool keepDashRunning: true
4040 property bool suspended: false
4141 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
4245 property int shellOrientation
4346 property int shellPrimaryOrientation
4447 property int nativeOrientation
4548 property real nativeWidth
4649 property real nativeHeight
50+
4751 function updateFocusedAppOrientation() {
4852 var mainStageAppIndex = priv.indexOf(priv.mainStageAppId);
4953 if (mainStageAppIndex >= 0 && mainStageAppIndex < spreadRepeater.count) {
@@ -689,6 +693,7 @@ Rectangle {
689693 return progress;
690694 }
691695
696+ deviceSpecificOrientationOverrides: root.deviceSpecificOrientationOverrides
692697 shellOrientationAngle: wantsMainStage ? root.shellOrientationAngle : 0
693698 shellOrientation: wantsMainStage ? root.shellOrientation : Qt.PortraitOrientation
694699 shellPrimaryOrientation: wantsMainStage ? root.shellPrimaryOrientation : Qt.PortraitOrientation