@@ -0,0 +1,84 @@
1+/*
2+ * Copyright (C) 2014 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.0
18+import QtQuick.Window 2.0
19+import Ubuntu.Components 0.1
20+
21+Item {
22+ id: orientedShell
23+
24+ // this is only here to select the width / height of the window if not running fullscreen
25+ property bool tablet: false
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)
28+
29+ property int orientationAngle: Screen.angleBetween(Screen.primaryOrientation, Screen.orientation)
30+
31+ state: orientationAngle.toString()
32+ states: [
33+ State {
34+ name: "0"
35+ PropertyChanges {
36+ target: shell
37+ rotation: 0
38+ x: 0
39+ y: 0
40+ width: orientedShell.width
41+ height: orientedShell.height
42+ }
43+ },
44+ State {
45+ name: "180"
46+ PropertyChanges {
47+ target: shell
48+ rotation: 180
49+ x: orientedShell.width
50+ y: orientedShell.height
51+ width: orientedShell.width
52+ height: orientedShell.height
53+ }
54+ },
55+ State {
56+ name: "270"
57+ PropertyChanges {
58+ target: shell
59+ rotation: 270
60+ x: 0
61+ y: orientedShell.height
62+ width: orientedShell.height
63+ height: orientedShell.width
64+ }
65+ },
66+ State {
67+ name: "90"
68+ PropertyChanges {
69+ target: shell
70+ rotation: 90
71+ x: orientedShell.width
72+ y: 0
73+ width: orientedShell.height
74+ height: orientedShell.width
75+ }
76+ }
77+ ]
78+
79+ Shell {
80+ id: shell
81+ transformOrigin: Item.TopLeft
82+ orientationAngle: orientedShell.orientationAngle
83+ }
84+}