Sync repository
[mardrone] / mardrone / gauges / main.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the Qt Components project on Qt Labs.
8 **
9 ** No Commercial Usage
10 ** This file contains pre-release code and may not be distributed.
11 ** You may use this file in accordance with the terms and conditions contained
12 ** in the Technology Preview License Agreement accompanying this package.
13 **
14 ** GNU Lesser General Public License Usage
15 ** Alternatively, this file may be used under the terms of the GNU Lesser
16 ** General Public License version 2.1 as published by the Free Software
17 ** Foundation and appearing in the file LICENSE.LGPL included in the
18 ** packaging of this file.  Please review the following information to
19 ** ensure the GNU Lesser General Public License version 2.1 requirements
20 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
21 **
22 ** If you have questions regarding the use of this file, please contact
23 ** Nokia at qt-info@nokia.com.
24 **
25 ****************************************************************************/
26
27 import Qt 4.7
28 import com.nokia.meego 1.0
29
30 Window {
31     id: window
32     state:"Landscape"
33
34     StatusBar {
35           id: statusBar
36           anchors.top: parent.top
37           anchors.bottom:myToolbar.top
38           orientation: screen.orientation
39           width: parent.width
40       }
41
42     ToolBar {
43         id: myToolbar
44         anchors.top: statusBar.bottom
45      // anchors.bottom: pageStack.top
46     }
47
48     PageStack {
49             id: pageStack
50              clip: true
51             anchors.top: toolBar.bottom
52             anchors.bottom: parent.bottom
53             width: parent.width
54             toolBar: myToolbar
55         }
56     ToolBarLayout {
57             id: commonTools
58             visible: false
59             ToolItem { iconId: "icon-m-toolbar-home"; onClicked: pageStack.pop(); }
60             ToolItem { iconId: "icon-m-toolbar-view-menu"; onClicked: myMenu.open(); }
61             ToolItem { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
62         }
63
64
65
66     Component {
67       id: mainpageComponent
68       Page {
69         id:mainPage
70         tools:
71               ToolBarLayout {
72                      ToolItem { iconId: "icon-m-toolbar-home"; onClicked: pageStack.pop(); }
73                      ToolItem { iconId: "icon-m-toolbar-view-menu"; onClicked: myMenu.open();}
74                      ToolItem { iconId: "icon-m-toolbar-close"; onClicked: Qt.quit(); }
75               }
76         Rectangle {
77             anchors.fill: parent
78             color: "white"
79         }
80
81         Flickable {
82            //
83           id: mainScrolArea
84           anchors.fill: parent
85           contentHeight: mainContent.height
86           contentWidth: parent.width
87
88         Column {
89           id:mainContent
90           anchors.centerIn: parent
91           spacing: 10
92           Button {
93              height: 50
94              width: 600
95              text: "Show a cat"
96              onClicked:(pageStack.push(catComponent))
97            }
98           Button {
99            height: 50
100            width: 600
101            text: "Show a dialog"
102            onClicked:(pageStack.push(dialogComponent))
103           }
104           Row {
105               AltGauge {
106                   width:200
107                   height:200
108                   id:alt1
109                   value: testSlider.value*500
110               }
111               AttitudeGauge {
112                   width:200
113                   height:200
114                   id:ati2
115                   roll: testSlider.value*500
116                   pitch:testSlider2.value
117               }
118
119           }
120
121 Row {
122           Slider {
123               id:testSlider
124           }
125
126           Slider {
127               id:testSlider2
128               minimumValue: -90
129               maximumValue: 90
130           }
131 }
132         }
133         }
134       }
135     }
136
137     Component {
138      id: catComponent
139        Page {
140           id:catPage
141           tools:commonTools
142
143           Image {
144              anchors.centerIn: parent
145              source: "aureo600.jpg"
146           }
147        }
148      }
149
150     Component {
151      id: dialogComponent
152        Page {
153           id:dialog
154           tools:commonTools
155           Flickable {
156           //  clip: true
157             id: dialogscrolarea
158             anchors.fill: parent
159             flickableDirection:Flickable.VerticalFlick
160
161             anchors.leftMargin:50;anchors.rightMargin:50
162             contentHeight: dialogcontent.height
163             contentWidth: parent.width
164
165             Column {
166                 id: dialogcontent
167                 width: parent.width
168           //anchors.left:parent.left;anchors.right:parent.right
169             anchors.leftMargin:150;anchors.rightMargin:150
170
171              spacing: 10
172              Button {
173                 text: "Button 1"
174                 width: parent.width
175              }
176        /*      LineEdit {
177                     id: line1
178                     width:parent.width
179                     anchors.left: parent.left; anchors.right: parent.Right
180                     promptText: "Enter text here"
181              }
182 */
183              Button {
184                 text: "ToggleButton"
185                     width:parent.width
186                 checkable:true
187              }
188              CheckBox {
189                id: cbox
190              }
191              Switch {
192                 id: switch1
193              }
194              Button {
195                 text: "Button 3"
196                     width:parent.width
197              }
198              Button {
199                 text: "Button 4"
200                     width:parent.width
201              }
202              Button {
203                 text: "Button 5"
204                     width:parent.width
205              }
206
207             }
208          }
209        }
210      }
211
212      Component.onCompleted: {
213          if (mainpageComponent.status == Component.Ready)
214                      pageStack.push(mainpageComponent);
215                  else
216                      console.log("Error loading component:", mainpageComponent.errorString());
217              }
218
219 }
220