sync repository
[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:"black"
6         property int textSize:30
7         id:dialog
8         tools:commonTools
9         Menu {
10             id:uiMenu
11             visualParent:pageStack
12             MenuLayout {
13                 MenuItem { text:"MeeGo/Harmattan 854x480";  onClicked: { drone.confActiveUI="ardrone_harmattan.qml" }}
14                 MenuItem { text:"Desktop";  onClicked: { drone.confActiveUI="ardrone_desktop.qml"}}
15            }
16         }
17         Flickable {
18           id: dialogscrolarea
19           anchors.fill: parent
20  //         anchors.leftMargin:50;anchors.rightMargin:50
21           contentHeight: dialogcontent.height
22           contentWidth: parent.width
23
24           Grid {
25               columns:2
26               id: dialogcontent
27               anchors.leftMargin:50;anchors.rightMargin:150
28               spacing: 20
29
30               Text {
31                   font.pixelSize  :textSize
32                   text:"UI Style"
33
34               }
35               Button {
36                   text:drone.confActiveUI
37                   anchors.right:parent.right
38                   onClicked:uiMenu.open()
39               }
40           Text {
41               width:350
42               text: "Drone IP"
43               color:textColor
44               font.pixelSize  :textSize
45            }
46
47            TextField {
48                   id: droneip
49                   width: 300
50                   height: 40
51                   anchors.right: parent.right
52                   text: drone.confDroneIp
53                   onTextChanged:{drone.confDroneIp=text;}
54            }
55
56 //          }
57
58            Text {
59               text: "Video 640x480/Full Screen"
60               color:textColor
61               font.pixelSize  :textSize
62            }
63            Switch {
64               id: fullScreen
65               checked:drone.confFullScreen
66               anchors.right:parent.right
67               onCheckedChanged:{drone.confFullScreen=checked;}
68            }
69            Text {
70               text: "Acceleration Sensor controll"
71               color:textColor
72               font.pixelSize  :textSize
73            }
74            Switch {
75               id: useAccelSw
76               checked:drone.confUseAccel
77               anchors.right:parent.right
78               onCheckedChanged:{drone.confUseAccel=checked;}
79            }
80            Text {
81                text: "Joystick"
82               color:textColor
83               font.pixelSize  :textSize
84            }
85            Switch {
86               id: useJoySw
87               checked:drone.confUseJoyStick
88               anchors.right:parent.right
89               enabled:js.haveJoyStick
90               onCheckedChanged:{drone.confUseJoyStick=checked;}
91            }
92
93            Text {
94                visible:drone.confUseJoyStick
95                font.pixelSize  :textSize
96                text:"\"" + js.joyStickName + "\""
97
98            }
99            Button {
100                visible:drone.confUseJoyStick
101                text:"Calibrate"
102                anchors.right:parent.right
103                onClicked:{
104                    js.calibrate=true
105                    pageStack.push(calibrateDialog);
106                }
107            }
108            Text {
109                visible:drone.confUseJoyStick
110                font.pixelSize  :textSize
111                text:"Show JoyStick Indicators"
112
113            }
114             Switch {
115                visible:drone.confUseJoyStick
116                checked:drone.confShowJSIndicators
117                anchors.right:parent.right
118                enabled:js.haveJoyStick
119                onCheckedChanged:{drone.confShowJSIndicators=checked;}
120
121            }
122            Text {
123               color:textColor
124               text: "Show debug"
125               font.pixelSize  :textSize
126            }
127            Switch {
128               id: showDebug
129               checked:drone.confShowDebug
130               anchors.right:parent.right
131               onCheckedChanged:{drone.confShowDebug=checked;}
132            }
133
134            Text {
135               text: "Show engine gauges"
136               color:textColor
137               font.pixelSize  :textSize
138
139            }
140            Switch {
141               id: showGauges
142               checked:drone.confShowGauges
143               anchors.right:parent.right
144               onCheckedChanged:{drone.confShowGauges=checked;}
145            }
146
147            Text {
148               text: "Show horizon"
149               color:textColor
150               font.pixelSize  :textSize
151
152            }
153            Switch {
154               id: showHorizon
155               checked:drone.confShowHorizon
156               anchors.right:parent.right
157               onCheckedChanged:{drone.confShowHorizon=checked;}
158            }
159
160            Text {
161               text: "Forward/backward gain"
162               color:textColor
163               font.pixelSize  :textSize
164            }
165
166            Slider {
167               id: forwardGain
168               anchors.right:parent.right
169               maximumValue:1.0
170               stepSize:0.01
171               value:drone.confForwardGain
172               onValueChanged:{drone.confForwardGain=value;}
173            }
174            Text {
175               text: "Right/Left gain"
176               color:textColor
177               font.pixelSize  :textSize
178            }
179
180            Slider {
181               id: rightGain
182               anchors.right:parent.right
183               maximumValue:1.0
184               stepSize:0.01
185               value:drone.confRightGain
186               onValueChanged:{drone.confRightGain=value;}
187            }
188            Text {
189               text: "accel ctrl treshold"
190               color:textColor
191               font.pixelSize  :textSize
192            }
193
194            Slider {
195               id: ctrlTreshold
196               anchors.right:parent.right
197               maximumValue:25.0
198               value:drone.confCtrlTrsh
199               onValueChanged:{drone.confCtrlTrsh=value;}
200            }
201           }
202        }
203         Page {
204                 property color textColor:"black"
205                 property int textSize:30
206                 id:calibrateDialog
207                 tools:commonTools
208                 JoyStickCalibrator {
209                     id:jc
210                 //    jStick:js
211                     Component.onCompleted: {
212                         if (jc.status != Component.Ready)
213                                     console.log("Error loading component:", jc.errorString());
214                     }
215                 }
216
217         }
218      }
219