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