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