@@ -26,9 +26,58 @@ Item {
26 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
26 width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
27 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
27 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
29− property int orientationAngle: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
29+ property int acceptedOrientationAngle: {
30+ var screenOrientation = Screen.orientation;
31+ var acceptedOrientation;
31− state: orientationAngle.toString()
33+ if (screenOrientation & shell.supportedScreenOrientations) {
34+ acceptedOrientation = screenOrientation;
36+ // try orientations at -90, 90 and 180
37+ switch (screenOrientation) {
38+ case Qt.PortraitOrientation:
39+ if (Qt.LandscapeOrientation & shell.supportedScreenOrientations) {
40+ acceptedOrientation = Qt.LandscapeOrientation;
41+ } else if (Qt.InvertedLandscapeOrientation & shell.supportedScreenOrientations) {
42+ acceptedOrientation = Qt.InvertedLandscapeOrientation;
44+ acceptedOrientation = Qt.InvertedPortraitOrientation;
47+ case Qt.InvertedPortraitOrientation:
48+ if (Qt.LandscapeOrientation & shell.supportedScreenOrientations) {
49+ acceptedOrientation = Qt.LandscapeOrientation;
50+ } else if (Qt.InvertedLandscapeOrientation & shell.supportedScreenOrientations) {
51+ acceptedOrientation = Qt.InvertedLandscapeOrientation;
53+ acceptedOrientation = Qt.PortraitOrientation;
56+ case Qt.LandscapeOrientation:
57+ if (Qt.PortraitOrientation & shell.supportedScreenOrientations) {
58+ acceptedOrientation = Qt.PortraitOrientation;
59+ } else if (Qt.InvertedPortraitOrientation & shell.supportedScreenOrientations) {
60+ acceptedOrientation = Qt.InvertedPortraitOrientation;
62+ acceptedOrientation = Qt.InvertedLandscapeOrientation;
65+ default: // Qt.InvertedLandscapeOrientation
66+ if (Qt.PortraitOrientation & shell.supportedScreenOrientations) {
67+ acceptedOrientation = Qt.PortraitOrientation;
68+ } else if (Qt.InvertedPortraitOrientation & shell.supportedScreenOrientations) {
69+ acceptedOrientation = Qt.InvertedPortraitOrientation;
71+ acceptedOrientation = Qt.LandscapeOrientation;
77+ return Screen.angleBetween(Screen.primaryOrientation, acceptedOrientation);
80+ state: acceptedOrientationAngle.toString()
@@ -79,6 +128,6 @@ Item {
80 id: shell
129 id: shell
81 transformOrigin: Item.TopLeft
130 transformOrigin: Item.TopLeft
82− orientationAngle: orientedShell.orientationAngle
131+ orientationAngle: orientedShell.acceptedOrientationAngle