0.2 version add desktop components multitouch, joystick, multicast
[mardrone] / mardrone / JoyStickCalibrator.qml
1 import QtQuick 1.0
2 import JoyStick 1.0
3 import com.nokia.meego 1.0
4
5 Item {
6     width: 600
7     height: 800
8     property int textSize:22
9     property int ctrlSize:40
10     Menu {
11         id:js1map
12         visualParent:pageStack
13         MenuLayout {
14             MenuItem { text:"Aileron";  onClicked: { js.mapAxis1=1 }}
15             MenuItem { text:"Elevator"; onClicked: { js.mapAxis1=2 }}
16             MenuItem { text:"Throtle";  onClicked: { js.mapAxis1=3 }}
17             MenuItem { text:"Rudder";   onClicked: { js.mapAxis1=4 }}
18             MenuItem { text:"none";     onClicked: { js.mapAxis1=0 }}
19
20        }
21     }
22     Menu {
23         id:js2map
24         visualParent:pageStack
25         MenuLayout {
26             MenuItem { text:"Aileron";  onClicked: { js.mapAxis2=1 }}
27             MenuItem { text:"Elevator"; onClicked: { js.mapAxis2=2 }}
28             MenuItem { text:"Throtle";  onClicked: { js.mapAxis2=3 }}
29             MenuItem { text:"Rudder";   onClicked: { js.mapAxis2=4 }}
30             MenuItem { text:"none";     onClicked: { js.mapAxis2=0 }}
31
32        }
33     }
34     Menu {
35         id:js3map
36         visualParent:pageStack
37         MenuLayout {
38             MenuItem { text:"Aileron";  onClicked: { js.mapAxis3=1 }}
39             MenuItem { text:"Elevator"; onClicked: { js.mapAxis3=2 }}
40             MenuItem { text:"Throtle";  onClicked: { js.mapAxis3=3 }}
41             MenuItem { text:"Rudder";   onClicked: { js.mapAxis3=4 }}
42             MenuItem { text:"none";     onClicked: { js.mapAxis3=0 }}
43
44        }
45     }
46     Menu {
47         id:js4map
48         visualParent:pageStack
49         MenuLayout {
50             MenuItem { text:"Aileron";  onClicked: { js.mapAxis4=1 }}
51             MenuItem { text:"Elevator"; onClicked: { js.mapAxis4=2 }}
52             MenuItem { text:"Throtle";  onClicked: { js.mapAxis4=3 }}
53             MenuItem { text:"Rudder";   onClicked: { js.mapAxis4=4 }}
54             MenuItem { text:"none";     onClicked: { js.mapAxis4=0 }}
55
56        }
57     }
58     Menu {
59         id:js5map
60         visualParent:pageStack
61         MenuLayout {
62             MenuItem { text:"Aileron";  onClicked: { js.mapAxis5=1 }}
63             MenuItem { text:"Elevator"; onClicked: { js.mapAxis5=2 }}
64             MenuItem { text:"Throtle";  onClicked: { js.mapAxis5=3 }}
65             MenuItem { text:"Rudder";   onClicked: { js.mapAxis5=4 }}
66             MenuItem { text:"none";     onClicked: { js.mapAxis5=0 }}
67
68        }
69     }
70     Menu {
71         id:js6map
72         visualParent:pageStack
73         MenuLayout {
74             MenuItem { text:"Aileron";  onClicked: { js.mapAxis6=1 }}
75             MenuItem { text:"Elevator"; onClicked: { js.mapAxis6=2 }}
76             MenuItem { text:"Throtle";  onClicked: { js.mapAxis6=3 }}
77             MenuItem { text:"Rudder";   onClicked: { js.mapAxis6=4 }}
78             MenuItem { text:"none";     onClicked: { js.mapAxis6=0 }}
79
80        }
81     }
82
83  //   property Item jStick:
84     Column {
85         Text {
86             text:" "
87         }
88
89         Row {
90             Text {
91                 text:"                  "
92             }
93             JoyStickIndicator {
94                 border.width:1
95                 width:100;height:100
96                 xvalue:js.axis4
97                 yvalue:js.axis3
98                 Text {
99                     anchors.bottom: parent.bottom
100                     font.pixelSize: 10
101                     text:"       rudder"
102                 }
103                 Text {
104                     x:-10;y:50
105                     rotation:90
106                     font.pixelSize: 10
107                     text:"Throtle"
108                 }
109             }
110
111             spacing:50
112             JoyStickIndicator {
113                 border.width:1
114                 width:100;height:100
115                 xvalue:js.axis1
116                 yvalue:js.axis2
117                 Text {
118                     anchors.bottom: parent.bottom
119                     font.pixelSize: 10
120                     text:"      Aileron"
121                 }
122                 Text {
123                     x:-15;y:50
124                     rotation:90
125                     font.pixelSize: 10
126                     text:"Elevator"
127                 }
128             }
129             Column {
130                 Button{
131                     text:"Reset"
132                     onClicked:{
133                         js.calibrate=false
134                         pageStack.pop();
135                     }
136                 }
137                 Button{
138                     text:"Save"
139                     onClicked:{
140                         js.calibrate=false
141                         pageStack.pop();
142                     }
143                 }
144         }
145         }
146         Grid {
147             spacing:10
148             columns:7
149             Text {
150                 font.pixelSize  :textSize
151                 text:"     Raw"
152             }
153             Text {
154                 font.pixelSize  :textSize
155                 text:"     Max"
156             }
157             Text {
158                 font.pixelSize  :textSize
159                 text:"     Min"
160             }
161             Text {
162                 font.pixelSize  :textSize
163                 text:"Calib"
164             }
165             Text {
166                 font.pixelSize  :textSize
167                 text:"value"
168             }
169             Text {
170                 font.pixelSize  :textSize
171                 text:"reverse"
172             }
173             Text {
174                 font.pixelSize  :textSize
175                 text:"mapping" + js.mapAxis1 + js.mapAxis2 + js.mapAxis3 + js.mapAxis4 +js.mapAxis5 +js.mapAxis6
176             }
177
178
179             Text {
180                 font.pixelSize  :textSize
181                 text:js.rawAxis1
182             }
183             Text {
184                 font.pixelSize  :textSize
185                 text:js.maxAxis1
186             }
187             Text {
188                 font.pixelSize  :textSize
189                 text:js.minAxis1
190             }
191             Text {
192                 font.pixelSize  :textSize
193                 text:js.calAxis1.toFixed(2)
194             }
195             BarGauge {
196                 width:100
197                 height:20
198                 val:js.calAxis1+1.0
199                 max:2.0
200                 horiz:true
201             }
202             CheckBox {
203                 width:60
204        //         scale:0.8
205                 checked:js.invertAxis1
206                 onCheckedChanged:{js.invertAxis1=checked;}
207             }
208             Button{
209                 width:200;height:ctrlSize
210                 text:js.mapAxis1==1?"Aileron":js.mapAxis1==2?"Elevator":js.mapAxis1==3?"Throtle":js.mapAxis1==4?"Rudder":"none"
211                 onClicked:js1map.open()
212             }
213
214
215
216             Text {
217                 font.pixelSize  :textSize
218                 text:js.rawAxis2
219             }
220             Text {
221                 font.pixelSize  :textSize
222                 text:js.maxAxis2
223             }
224             Text {
225                 font.pixelSize  :textSize
226                 text:js.minAxis2
227             }
228             Text {
229                 font.pixelSize  :textSize
230                 text:js.calAxis2.toFixed(2)
231             }
232             BarGauge {
233                 width:100
234                 height:20
235                 val:js.calAxis2+1.0
236                 max:2.0
237                 horiz:true
238             }
239             CheckBox {
240                 checked:js.invertAxis2
241                 onCheckedChanged:{js.invertAxis2=checked;}
242             }
243             Button{
244                 width:200;height:ctrlSize
245                 text:js.mapAxis2==1?"Aileron":js.mapAxis2==2?"Elevator":js.mapAxis2==3?"Throtle":js.mapAxis2==4?"Rudder":"none"
246                 onClicked:js2map.open()
247             }
248
249
250
251             Text {
252                 font.pixelSize  :textSize
253                 text:js.rawAxis3
254             }
255             Text {
256                 font.pixelSize  :textSize
257                 text:js.maxAxis3
258             }
259             Text {
260                 font.pixelSize  :textSize
261                 text:js.minAxis3
262             }
263             Text {
264                 font.pixelSize  :textSize
265                 text:js.calAxis3.toFixed(2)
266             }
267             BarGauge {
268                 width:100
269                 height:20
270                 val:js.calAxis3+1.0
271                 max:2.0               
272                 horiz:true
273             }
274             CheckBox {
275                 checked:js.invertAxis3
276                 onCheckedChanged:{js.invertAxis3=checked;}
277             }
278             Button{
279                 width:200;height:ctrlSize
280                 text:js.mapAxis3==1?"Aileron":js.mapAxis3==2?"Elevator":js.mapAxis3==3?"Throtle":js.mapAxis3==4?"Rudder":"none"
281                 onClicked:js3map.open()
282             }
283
284             Text {
285                 font.pixelSize  :textSize
286                 text:js.rawAxis4
287             }
288             Text {
289                 font.pixelSize  :textSize
290                 text:js.maxAxis4
291             }
292             Text {
293                 font.pixelSize  :textSize
294                 text:js.minAxis4
295             }
296             Text {
297                 font.pixelSize  :textSize
298                 text:js.calAxis4.toFixed(2)
299             }
300             BarGauge {
301                 width:100
302                 height:20
303                 val:js.calAxis4+1.0
304                 max:2.0
305                 horiz:true
306             }
307             CheckBox {
308                 checked:js.invertAxis4
309                 onCheckedChanged:{js.invertAxis4=checked;}
310             }
311             Button{
312                 width:200;height:ctrlSize
313                 text:js.mapAxis4==1?"Aileron":js.mapAxis4==2?"Elevator":js.mapAxis4==3?"Throtle":js.mapAxis4==4?"Rudder":"none"
314                 onClicked:js4map.open()
315             }
316
317             Text {
318                 font.pixelSize  :textSize
319                 text:js.rawAxis5
320             }
321             Text {
322                 font.pixelSize  :textSize
323                 text:js.maxAxis5
324             }
325             Text {
326                 font.pixelSize  :textSize
327                 text:js.minAxis5
328             }
329             Text {
330                 font.pixelSize  :textSize
331                 text:js.calAxis5.toFixed(2)
332             }
333             BarGauge {
334                 width:100
335                 height:20
336                 val:js.calAxis5+1.0
337                 max:2.0
338                 horiz:true
339             }
340             CheckBox {
341                 checked:js.invertAxis5
342                 onCheckedChanged:{js.invertAxis5=checked;}
343             }
344             Button{
345                 width:200;height:ctrlSize
346                 text:js.mapAxis5==1?"Aileron":js.mapAxis5==2?"Elevator":js.mapAxis5==3?"Throtle":js.mapAxis5==4?"Rudder":"none"
347                 onClicked:js5map.open()
348             }
349
350             Text {
351                 font.pixelSize  :textSize
352                 text:js.rawAxis6
353             }
354             Text {
355                 font.pixelSize  :textSize
356                 text:js.maxAxis6
357             }
358             Text {
359                 font.pixelSize  :textSize
360                 text:js.minAxis6
361             }
362             Text {
363                 font.pixelSize  :textSize
364                 text:js.calAxis6.toFixed(2)
365             }
366             BarGauge {
367                 width:100
368                 height:20
369                 val:js.calAxis6+1.0
370                 max:2.0
371                 horiz:true
372             }
373             CheckBox {
374                 checked:js.invertAxis6
375                 onCheckedChanged:{js.invertAxis6=checked;}
376             }
377             Button{
378                 width:200;height:ctrlSize
379                 text:js.mapAxis6==1?"Aileron":js.mapAxis6==2?"Elevator":js.mapAxis6==3?"Throtle":js.mapAxis6==4?"Rudder":"none"
380                 onClicked:js6map.open()
381             }
382         }
383
384     }
385 }
386
387