improved desktop UI
[mardrone] / mardrone / ConfigDialogDesktop.qml
1 import QtQuick 1.0
2 import QtDesktop 0.1
3 Rectangle {
4
5     property int textSize:20
6     property color textColor:"black"
7         id:dialog
8         CalibrateDialogDesktop {
9             id:joyStickCalibrator
10         }
11
12         anchors.fill: parent
13         TabFrame {
14             anchors.fill:parent
15         Tab {
16              title: "Display"
17             id: displayTab
18             anchors.fill: parent
19        //   anchors.leftMargin:50;anchors.rightMargin:50
20
21           Grid {
22               columns:2
23               id: dialogcontent
24               anchors.fill:parent
25               anchors.topMargin: 50
26               anchors.leftMargin:50;anchors.rightMargin:50
27               spacing: 20
28
29            Text {
30                   font.pixelSize  :textSize
31                   text:"UI Style"
32
33           }
34
35            Component.onCompleted: {
36                for(var j = 0; j < uiList.count();++j ) {
37                    var data = {'text':uiList.get(j).name,'name':uiList.get(j).name,'file':uiList.get(j).file };
38     //                 var data = {'name':uiList.get(j).name };
39                    console.debug("appending ",uiList.get(j).name,uiList.get(j).file);
40                    choices.append(data);
41                    if(uiList.get(j).file==drone.confActiveUI) activeUICombo.selectedIndex=j;
42                }
43            }
44
45            ListModel {
46                            id: choices
47             }
48         ComboBox {
49               id: activeUICombo;
50               width:200
51               model:choices
52               onSelectedIndexChanged: {
53                   console.debug("onSelectedIndexChanged " + selectedText + ", " + model.get(selectedIndex).file);
54                   drone.confActiveUI=model.get(selectedIndex).file
55               }
56
57
58              // KeyNavigation.tab: t1
59               //KeyNavigation.backtab: button2
60            }
61
62           Text {
63               width:200
64               text: "Drone IP"
65               color:textColor
66               font.pixelSize  :textSize
67            }
68
69            TextField {
70                   id: droneip
71                   width: 200
72                   height: 40
73                   anchors.right: parent.right
74                   text: drone.confDroneIp
75                   onTextChanged:{drone.confDroneIp=text;}
76            }
77
78 //          }
79
80            Text {
81               text: "Video 640x480 / Full Screen"
82               color:textColor
83               font.pixelSize  :textSize
84            }
85            CheckBox {
86               id: fullScreen
87               checked:drone.confFullScreen
88               anchors.right:parent.right
89               onCheckedChanged:{drone.confFullScreen=checked;}
90            }
91            Text {
92               color:textColor
93               text: "Show debug"
94               font.pixelSize  :textSize
95            }
96            CheckBox {
97               id: showDebug
98               checked:drone.confShowDebug
99               anchors.right:parent.right
100               onCheckedChanged:{drone.confShowDebug=checked;}
101            }
102
103            Text {
104               text: "Show engine gauges"
105               color:textColor
106               font.pixelSize  :textSize
107
108            }
109            CheckBox {
110               id: showGauges
111               checked:drone.confShowGauges
112               anchors.right:parent.right
113               onCheckedChanged:{drone.confShowGauges=checked;}
114            }
115
116            Text {
117               text: "Show horizon"
118               color:textColor
119               font.pixelSize  :textSize
120
121            }
122            CheckBox {
123               id: showHorizon
124               checked:drone.confShowHorizon
125               anchors.right:parent.right
126               onCheckedChanged:{drone.confShowHorizon=checked;}
127            }
128           } // Grid
129           } // tab
130           Tab {
131               title: "Control"
132               Grid {
133                   columns:2
134                   anchors.fill:parent
135                   anchors.topMargin: 50
136                   anchors.leftMargin:50;anchors.rightMargin:50
137                   spacing: 20
138            Text {
139               text: "Acceleration Sensor for controll"
140               color:textColor
141               font.pixelSize  :textSize
142            }
143            CheckBox {
144               id: useAccelSw
145               checked:drone.confUseAccel
146               anchors.right:parent.right
147               onCheckedChanged:{drone.confUseAccel=checked;}
148            }
149
150            Text {
151                text: "Joystick"
152               color:textColor
153               font.pixelSize  :textSize
154            }
155            CheckBox {
156               id: useJoySw
157               checked:drone.confUseJoyStick
158               anchors.right:parent.right
159               enabled:js.haveJoyStick
160               onCheckedChanged:{drone.confUseJoyStick=checked;}
161            }
162
163            Text {
164                visible:drone.confUseJoyStick & js.haveJoyStick
165                font.pixelSize  :textSize
166                text:"\"" + js.joyStickName + "\""
167
168            }
169            Button {
170                visible:drone.confUseJoyStick & js.haveJoyStick
171                text:"Calibrate"
172                anchors.right:parent.right
173               onClicked:{   joyStickCalibrator.visible = true;
174                    js.calibrate=true
175                }
176            }
177            Text {
178                visible:drone.confUseJoyStick
179                font.pixelSize  :textSize
180                text:"Show JoyStick Indicators"
181
182            }
183             CheckBox {
184                visible:drone.confUseJoyStick
185                checked:drone.confShowJSIndicators
186                anchors.right:parent.right
187                enabled:js.haveJoyStick
188                onCheckedChanged:{drone.confShowJSIndicators=checked;}
189
190            }
191
192
193            Text {
194               text: "Forward/backward gain"
195               color:textColor
196               font.pixelSize  :textSize
197            }
198
199            Slider {
200               id: forwardGain
201               anchors.right:parent.right
202               maximumValue:1.0
203               stepSize:0.01
204               value:drone.confForwardGain
205               onValueChanged:{drone.confForwardGain=value;}
206            }
207            Text {
208               text: "Right/Left gain"
209               color:textColor
210               font.pixelSize  :textSize
211            }
212
213            Slider {
214               id: rightGain
215               anchors.right:parent.right
216               maximumValue:1.0
217               stepSize:0.01
218               value:drone.confRightGain
219               onValueChanged:{drone.confRightGain=value;}
220            }
221            Text {
222               text: "accel ctrl treshold"
223               color:textColor
224               font.pixelSize  :textSize
225            }
226
227            Slider {
228               id: ctrlTreshold
229               anchors.right:parent.right
230               maximumValue:25.0
231               value:drone.confCtrlTrsh
232               onValueChanged:{drone.confCtrlTrsh=value;}
233            }
234           }
235        }
236         }
237      }