tmp file removed
[mardrone] / mardrone / ardrone_desktop.qml
1 // uiName:Desktop
2 import Drone 1.0
3 import QtQuick 1.0
4 import QtDesktop 0.1
5 import Gauges 1.0
6 import JoyStick 1.0
7
8 Window {
9     title: "MArdrone"
10     id:mainWindow
11     width: 1024
12     height: 800
13     maximumHeight: mainWindow.height
14     minimumHeight: 800
15     maximumWidth: 1280
16     minimumWidth: 800
17     visible: true
18
19
20     MenuBar {
21         Menu {
22             text: "File"
23             MenuItem {
24                 text: "Settings"
25                 shortcut: "Ctrl+O"
26                 onTriggered: configDialog.visible = true
27             }
28             MenuItem {
29                 text: "Close"
30                 shortcut: "Ctrl+Q"
31                 onTriggered: Qt.quit()
32             }
33             MenuItem {
34                 text: "Record"
35                 shortcut: "Ctrl+R"
36                 onTriggered: Qt.quit()
37             }
38         }
39         Menu {
40             text: "Edit"
41             MenuItem {
42                 text: "Copy"
43             }
44             MenuItem {
45                 text: "Paste"
46             }
47         }
48     }
49
50
51   DroneControl {
52         id:drone
53     }
54   JoyStick {
55       id:js
56       onElevatorChanged:{if(drone.confUseJoyStick) drone.pitch=elevator;}
57       onAileronChanged: {if(drone.confUseJoyStick) drone.roll=aileron;}
58       onThrotleChanged: {if(drone.confUseJoyStick) drone.vVelocity=throtle;}
59       onRudderChanged:  {if(drone.confUseJoyStick) drone.yaw=rudder;}
60
61   }
62
63     Column {
64         width:parent.width
65         spacing:5
66       Rectangle {
67         id:mainWiew
68         width:parent.width
69         height:480
70         //onEntered:(mainWindow.fullscreen=true)
71
72         state:"Landscape"
73         DroneVideo {
74             id:droneVideo
75             y:0
76          //       anchors.horizontalCenter: parent.horizontalCenter
77          //   anchors.horizontalCenter:parent.horizontalCenter
78             width:drone.confFullScreen? parent.width:640 ;height:width<=640 ?480*width/640:480;
79         }
80         Binding {
81           target:drone
82           property:"logSeq"
83           value: droneVideo.frameSeq;
84         }
85         EfisPFD {
86             id:hudPDF
87             y:0
88    //         anchors.horizontalCenter: parent.horizontalCenter
89             visible:drone.confShowHorizon
90             roll:drone.droneRoll
91             pitch:drone.dronePitch
92             ias:drone.droneSpeed
93             alt:drone.droneAltitude/10
94             indicatorColor:"green"
95             skyColor:"#00000000"
96             groundColor:"#00000000"
97             width:640;height:480;
98         }
99         Text {
100             y:100
101             visible:drone.confShowDebug
102             color: "#00FF00"
103             id: droneCtrlValues
104             font.pixelSize:20
105             text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " +  drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2)
106         }
107
108         Text {
109             y:115
110             visible:drone.confShowDebug
111             color: "#00FF00"
112             id: droneNavData
113             font.pixelSize:20
114             text: "pitch=" + Math.round(drone.dronePitch) + " roll= " +  Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " +  Math.round(drone.droneAltitude)
115         }
116
117         Text {
118             y:130
119             visible:drone.confShowDebug
120             color: "#00FF00"
121             id: droneStatus
122             font.pixelSize:20
123             text: drone.decodedStatus
124         }
125    /*     Button {
126             y:150;x:0
127             height: 50
128             width: 50
129             iconSource: "gear32x32.png"
130             onClicked:{   configDialog.visible = true }
131         }
132 */
133         JoyStickIndicator {
134
135             anchors.left:parent.left
136             anchors.bottom:parent.bottom
137             anchors.margins:10
138             visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick
139             border.width:1
140             color:"transparent"
141             width:100;height:100
142             xvalue:js.axis4
143             yvalue:js.axis3
144             Text {
145                 anchors.bottom: parent.bottom
146                 font.pixelSize: 10
147                 text:"       rudder"
148             }
149             Text {
150                 x:-10;y:50
151                 rotation:90
152                 font.pixelSize: 10
153                 text:"Throtle"
154             }
155         }
156
157
158         JoyStickIndicator {
159
160             anchors.right:parent.right
161             anchors.bottom:parent.bottom
162             anchors.margins:10
163             visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick
164             border.width:1
165             color:"transparent"
166             width:100;height:100
167             xvalue:js.axis1
168             yvalue:js.axis2
169             Text {
170                 anchors.bottom: parent.bottom
171                 font.pixelSize: 10
172                 text:"      Aileron"
173             }
174             Text {
175                 x:-15;y:50
176                 rotation:90
177                 font.pixelSize: 10
178                 text:"Elevator"
179             }
180         }
181
182             JoyStickTouch {
183                 id:lj
184                 width:280;height:280;
185                 y:200
186                 joyBackground: ""
187                 visible: !drone.confUseAccel & !drone.confUseJoyStick
188                 anchors.left:parent.left
189                 anchors.margins:50
190                 onYvChanged:{drone.pitch=yv/200.0;}
191                 onXvChanged:{drone.roll=xv/200.0;}
192
193
194             }
195
196             JoyStickTouch {
197                  visible: !drone.confUseJoyStick
198                 id:rj
199                 y:200
200                 joyBackground: ""
201                 anchors.right:parent.right
202                 width:280;height:280;
203                 anchors.margins:50
204                 onYvChanged:{drone.vVelocity=-1*yv/200.0;}
205                 onXvChanged:{drone.yaw=xv/200.0;}
206                 onPressedChanged: { drone.ctrlActive=pressed;}
207             }
208       }
209         Row {
210             spacing:5
211
212             EfisPFD {
213                 id:pDF
214                 width:300
215                 height:320
216                 showHSI:true
217                 roll:drone.droneRoll
218                 pitch:drone.dronePitch
219                 ias:drone.droneSpeed
220                 alt:drone.droneAltitude/10
221            //     bezel:"glareshield1.png"
222             }
223         Grid {
224             columns: 3
225
226
227         AltGauge {
228             width:120
229             height:120
230             id:altGauge
231             value:drone.droneAltitude/10
232             bezel:"bezel.png"
233         }
234         AttitudeGauge {
235             width:120
236             height:120
237             id:attGauge
238             roll:drone.droneRoll
239             pitch:drone.dronePitch
240             bezel:"bezel.png"
241         }
242         HeadingGauge {
243             width:120
244             height:120
245             id:hdgGauge
246             value:drone.droneYaw
247             bezel:"bezel.png"
248         }
249         GaugeArc {
250             width:120
251             height:120
252             id:fuelGauge
253             anchors.margins:10
254             displayScale:0.85
255             font.pixelSize:10
256             tickIncrement:10
257             tickSpacing:24
258             tickMinor:5
259             lowPosition:220
260             highPosition:120
261             low:0
262             high:100
263             gaugeStyle:2
264             color:"white"
265             value:drone.droneVBat
266             lineWidth:2
267             backColor:"black"
268         }
269         GaugeHSI{
270             anchors.margins:10
271             displayScale:0.5
272             width:120
273             height:120
274             font.pixelSize:10
275             tickIncrement:30
276             tickSpacing:10
277             tickMinor:5
278             gaugeStyle:2
279             color:"white"
280             backColor:"black"
281             id:hsi
282         }
283
284         Row {
285             spacing: 5
286             anchors.rightMargin: 10
287             height:100
288         BarGauge {
289            val:drone.pwm_motor1;
290            max: 255
291            height:100
292         }
293         BarGauge {
294             val:drone.pwm_motor2;
295             max: 255
296             height:100
297         }
298         BarGauge {
299             val:drone.pwm_motor3;
300             max: 255
301             height:100
302         }
303         BarGauge {
304             val:drone.pwm_motor4;
305             max: 255
306             height:100
307         }
308         BarGauge {
309             val:drone.droneVBat
310             max: 100
311             height:100
312         }
313         }
314             } // Grid if instruments
315         } // Column ( Main window content )
316
317         Dialog {
318             id:configDialog
319             width:800
320             height:600
321             data:ConfigDialogDesktop {}
322         }
323     }
324   } // Main page
325
326