Joinig to video broadcast group on OSX improved
[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: 700
12     height: 800
13     maximumHeight: mainWindow.height
14     minimumHeight: 800
15     maximumWidth: 1280
16     minimumWidth: 700
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         color:"black"
70         height:480
71         //onEntered:(mainWindow.fullscreen=true)
72
73         state:"Landscape"
74         DroneVideo {
75             id:droneVideo
76             y:0
77          //       anchors.horizontalCenter: parent.horizontalCenter
78          //   anchors.horizontalCenter:parent.horizontalCenter
79             width:drone.confFullScreen? parent.width:640 ;height:width<=640 ?480*width/640:480;
80         }
81         Binding {
82           target:drone
83           property:"logSeq"
84           value: droneVideo.frameSeq;
85         }
86         EfisPFD {
87             id:hudPDF
88             y:0
89    //         anchors.horizontalCenter: parent.horizontalCenter
90             visible:drone.confShowHorizon
91             roll:drone.droneRoll
92             pitch:drone.dronePitch
93             ias:drone.droneSpeed
94             alt:drone.droneAltitude/10
95             heading:drone.droneYaw
96             indicatorColor:"green"
97             skyColor:"#00000000"
98             groundColor:"#00000000"
99             width:640;height:480;
100         }
101
102    /*     Button {
103             y:150;x:0
104             height: 50
105             width: 50
106             iconSource: "gear32x32.png"
107             onClicked:{   configDialog.visible = true }
108         }
109 */
110         JoyStickIndicator {
111
112             anchors.left:parent.left
113             anchors.bottom:parent.bottom
114             anchors.margins:10
115             visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick
116             border.width:1
117             color:"transparent"
118             width:100;height:100
119             xvalue:js.axis4
120             yvalue:js.axis3
121             Text {
122                 anchors.bottom: parent.bottom
123                 font.pixelSize: 10
124                 text:"       rudder"
125             }
126             Text {
127                 x:-10;y:50
128                 rotation:90
129                 font.pixelSize: 10
130                 text:"Throtle"
131             }
132         }
133
134
135         JoyStickIndicator {
136
137             anchors.right:parent.right
138             anchors.bottom:parent.bottom
139             anchors.margins:10
140             visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick
141             border.width:1
142             color:"transparent"
143             width:100;height:100
144             xvalue:js.axis1
145             yvalue:js.axis2
146             Text {
147                 anchors.bottom: parent.bottom
148                 font.pixelSize: 10
149                 text:"      Aileron"
150             }
151             Text {
152                 x:-15;y:50
153                 rotation:90
154                 font.pixelSize: 10
155                 text:"Elevator"
156             }
157         }
158         Text {
159            x:0
160               anchors.top:parent.top
161             visible:drone.confShowDebug
162             color: "#00FF00"
163             id: droneCtrlValues
164             font.pixelSize:10
165             text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " +  drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2)
166         }
167
168         Text {
169             x:400
170             anchors.top:parent.top
171             visible:drone.confShowDebug
172             color: "#00FF00"
173             id: droneNavData
174             font.pixelSize:10
175             text: "pitch=" + Math.round(drone.dronePitch) + " roll= " +  Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " +  Math.round(drone.droneAltitude)
176         }
177
178         Text {
179             x:400
180             anchors.bottom:parent.bottom
181             visible:drone.confShowDebug
182             color: "#00FF00"
183             id: droneStatus
184             font.pixelSize:10
185             text: drone.decodedStatus
186         }
187         Text {
188             x:00
189             anchors.bottom:parent.bottom
190             visible:drone.confShowDebug
191        //     visible:droneVideo.recVideo
192             color: "#00FF00"
193             id: droneFrameSeq
194             font.pixelSize:10
195             text: droneVideo.videoFileName+ " "+droneVideo.frameSeq
196         }
197
198             JoyStickTouch {
199                 id:lj
200                 width:280;height:280;
201                 y:200
202                 joyBackground: ""
203                 visible: !drone.confUseAccel & !drone.confUseJoyStick
204                 anchors.left:parent.left
205                 anchors.margins:50
206                 onYvChanged:{drone.pitch=yv/200.0;}
207                 onXvChanged:{drone.roll=xv/200.0;}
208
209
210             }
211
212             JoyStickTouch {
213                  visible: !drone.confUseJoyStick
214                 id:rj
215                 y:200
216                 joyBackground: ""
217                 anchors.right:parent.right
218                 width:280;height:280;
219                 anchors.margins:50
220                 onYvChanged:{drone.vVelocity=-1*yv/200.0;}
221                 onXvChanged:{drone.yaw=xv/200.0;}
222                 onPressedChanged: { drone.ctrlActive=pressed;}
223             }
224       }
225
226       Rectangle {
227           width:parent.width
228      //     width:chlidrenRect.width
229      //     height:childrenRect.height
230           height:320
231           color: "black"
232
233
234
235         Row {
236             id:instrumentPanel
237             spacing:5
238             anchors.fill:parent
239             anchors.margins:5
240
241             EfisPFD {
242                 id:pDF
243                 width:300
244                 height:320
245                 showHSI:true
246                 roll:drone.droneRoll
247                 pitch:drone.dronePitch
248                 ias:drone.droneSpeed
249                 alt:drone.droneAltitude/10
250                 heading:drone.droneYaw
251            //     bezel:"glareshield1.png"
252             }
253         Grid {
254             columns: 3
255
256
257         AltGauge {
258             width:120
259             height:120
260             id:altGauge
261             value:drone.droneAltitude/10
262             bezel:"bezel.png"
263         }
264         AttitudeGauge {
265             width:120
266             height:120
267             id:attGauge
268             roll:drone.droneRoll
269             pitch:drone.dronePitch
270             bezel:"bezel.png"
271         }
272         Item {
273             width:120
274             height:120
275
276
277         GaugeArc {
278             anchors.fill:parent
279             id:speedGauge
280  //           anchors.margins:10
281             displayScale:0.95
282             font.pixelSize:10
283             tickIncrement:20
284             tickSpacing:24
285             tickMinor:5
286             lowPosition:220
287             highPosition:120
288             low:0
289             high:200
290             gaugeStyle:2
291             color:"white"
292             value:drone.droneSpeed
293             lineWidth:2
294             backColor:"black"
295         }
296         Image {
297             anchors.fill:parent
298             source:"bezel.png"
299         }
300         }
301
302         Item {
303             width:120
304             height:120
305
306
307         GaugeArc {
308             anchors.fill:parent
309             id:fuelGauge
310  //           anchors.margins:10
311             displayScale:0.95
312             font.pixelSize:10
313             tickIncrement:10
314             tickSpacing:22
315             tickMinor:5
316             lowPosition:240
317             highPosition:120
318             low:0
319             high:100
320             gaugeStyle:2
321             color:"white"
322             value:drone.droneVBat
323             lineWidth:2
324             backColor:"black"
325         }
326         Image {
327             anchors.fill:parent
328             source:"bezel.png"
329         }
330         }
331         Item {
332             width:120
333             height:120
334
335             HeadingGauge {
336                 width:120
337                 height:120
338                 id:hdgGauge
339                 value:drone.droneYaw
340                 bezel:"bezel.png"
341             }
342         }
343         Item {
344             width:120
345             height:120
346         Rectangle {
347             anchors.fill:parent
348             anchors.margins:5
349             color:"gray"
350             }
351         Row {
352             anchors.centerIn:parent
353             spacing: 5
354             anchors.margins: 30
355             height:90
356         BarGauge {
357            val:drone.pwm_motor1;
358            max: 255
359            height:parent.height
360            width:10
361         }
362         BarGauge {
363             val:drone.pwm_motor2;
364             max: 255
365            height:parent.height
366                      width:10
367         }
368         BarGauge {
369             val:drone.pwm_motor3;
370             max: 255
371             height:parent.height
372             width:10
373         }
374         BarGauge {
375             val:drone.pwm_motor4;
376             max: 255
377             height:parent.height
378              width:10
379         }
380         /*
381         BarGauge {
382             val:drone.droneVBat
383             max: 100
384             height:parent.height
385                       width:10
386         }
387         */
388         }
389         Image {
390             anchors.fill:parent
391             source:"bezel.png"
392         }
393         }
394         Button {
395
396             width:80
397             height:50
398             id:flyButton
399      //       anchors.bottom:parent.bottom
400             anchors.margins:15
401             text:"Fly";
402             checkable:true
403             onClicked:{drone.fly=checked;
404             // mainWindow.fullsecreen=checked;
405             }
406         }
407         Button {
408
409             width:90
410             height:50
411             id:emergencyButton
412          //   anchors.bottom:parent.bottom
413             anchors.margins:15
414             text:"Emrg";
415             checkable:true
416             onClicked:{drone.emergency=checked;}
417         }
418
419         Button {
420
421             width:100
422             height:50
423             id:recordButton
424        //     anchors.bottom:parent.bottom
425             anchors.margins:15
426             text:"Rec";
427             checkable:true
428             onClicked:{droneVideo.recVideo=checked; drone.logFileName=droneVideo.videoFileName; drone.recordLog=checked;}
429         }
430             } // Grid if instruments
431         }
432
433         } // Column ( Main window content )
434        }
435         Dialog {
436             id:configDialog
437             width:800
438             height:600
439             data:ConfigDialogDesktop {}
440         }
441
442   } // Main page
443
444