Replaced self made UI rotation with system's rotation, portrait panels need some...
[situare] / src / qmlui / Main.qml
1 import Qt 4.7
2
3 Rectangle {
4     id: root
5     SystemPalette { id: palette }
6
7     color: palette.window
8
9     onHeightChanged: {
10         console.log("root height changed, height: " + height + ", width: " + width)
11     }
12
13     onStateChanged: {
14         console.log("root state changed, state: " + state)
15     }
16
17     Map {
18         id: map;
19         anchors { left: parent.left; right: panel.left; top: parent.top; bottom: parent.bottom }
20     }
21
22     Panel {
23         id: panel
24         x: panelSelectorButtonsBar.x
25         anchors.top: parent.top
26         width: (parent.width - panelSelectorButtonsBar.width ) / 2
27     }
28
29     Rectangle {
30         id: panelSelectorButtonsBar
31         color: "gray"
32         anchors { bottom: parent.bottom; right: parent.right }
33         width: root.height / 4
34         height: root.height
35
36         onHeightChanged: { console.log("panelSelectorButtonsBar, h:" + height) }
37         onWidthChanged: { console.log("panelSelectorButtonsBar, w:" + width) }
38
39         Grid {
40             id: panelSelectorButtons
41             anchors { fill: parent; leftMargin: 1 }
42             spacing: 2
43             rows: 4
44             columns: 1
45
46             PanelSelectorButton {
47                 id: profile
48                 image: "qrc:/res/user_info.png"
49                 text: "Profile"
50                 onButtonClicked: { panel.setView("qrc:/ProfileView.qml") }
51             }
52
53             PanelSelectorButton {
54                 id: friends
55                 image: "qrc:/res/friend_list.png"
56                 text: "Friends"
57                 onButtonClicked: { panel.setView("qrc:/FriendsView.qml") }
58             }
59
60             PanelSelectorButton {
61                 id: navigate
62                 image: "qrc:/res/routing.png"
63                 text: "Routing"
64                 onButtonClicked: { panel.setView("qrc:/RoutingView.qml") }
65             }
66
67             PanelSelectorButton {
68                 id: locations
69                 image: "qrc:/res/location_search.png"
70                 text: "Locations"
71                 onButtonClicked: { panel.setView("qrc:/LocationsView.qml") }
72             }
73         }
74     }
75
76     LoginWidget {
77         id: loginDialog
78     }
79
80     states: [
81         State {
82             name: "portrait"
83             when: height > width
84             AnchorChanges {
85                 target: map
86                 anchors.right: right
87                 anchors.bottom: panelSelectorButtonsBar.top
88             }
89             AnchorChanges {
90                 target: panel
91                 anchors.left: root.left
92                 anchors.right: root.right
93             }
94             PropertyChanges {
95                 target: panelSelectorButtonsBar
96                 width: root.width
97                 height: root.width / 4
98             }
99             PropertyChanges {
100                 target: panelSelectorButtons
101                 columns: 4
102                 rows: 1
103             }
104
105         }
106     ]
107     transitions: [
108         Transition {
109             from: ""
110             to: "portrait"
111             reversible: true
112         }
113     ]
114
115 }