first import
[mardrone] / mardrone / ardrone.qml
1 import Qt 4.7
2 import com.meego 1.0
3 import Drone 1.0
4
5
6 Window {
7     id:mainWindow
8     fullscreen:true
9     property Component dialogComponent
10 // property alias m: mainPage
11     DroneControl {
12         id:drone
13     }
14
15     Component {
16       id: mainpageComponent
17       Page {
18         id:mainPage
19         onEntered:(mainWindow.fullscreen=true)
20
21         state:"Landscape"
22         DroneVideo {
23             y:0
24             x:00
25             anchors.horizontalCenter:parent.horizontalCenter
26             width:drone.confFullScreen? parent.width:640 ;height:480*width/640;
27         }
28
29         GaugeHorizon {
30             y:0
31             x:100
32             visible:drone.confShowHorizon
33             value:drone.droneRoll
34             value2:drone.dronePitch
35 //            value:lj.xv
36 //            value2:lj.yv
37             opacity:0.5
38             width:640;height:480;
39         }
40
41         Text {
42             y:115
43             visible:drone.confShowDebug
44             color: "#00FF00"
45             id: droneNavData
46             font.pixelSize:20
47             text: "pitch=" + Math.round(drone.dronePitch) + " roll= " +  Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " +  Math.round(drone.droneAltitude)
48         }
49
50         Text {
51             y:130
52             visible:drone.confShowDebug
53             color: "#00FF00"
54             id: droneStatus
55             font.pixelSize:20
56             text: drone.decodedStatus
57         }
58         Button {
59             y:150;x:0
60             height: 50
61             width: 50
62             text: "conf"
63             onClicked:{   mainWindow.fullscreen = false ;
64                           mainWindow.nextPage(dialogComponent)
65             }
66         }
67         Image {
68             x:10;y:200
69             width:280;height:280;
70             source: "joybox.png"
71
72             JoyStick {
73                 id:lj
74                 anchors.fill:parent
75                 anchors.margins:50
76                 onYvChanged:{drone.pitch=yv;}
77                 onXvChanged:{drone.roll=xv;}
78
79
80             }
81         }
82         Image {
83             y:200
84             anchors.right:parent.right
85             width:280;height:280;
86             source: "joybox.png"
87             JoyStick {
88                 id:rj
89                 anchors.fill:parent
90                 anchors.margins:50
91                 onYvChanged:{drone.vVelocity=yv;}
92                 onXvChanged:{drone.yaw=xv;}
93             }
94         }
95         Row {
96             spacing: 5
97             anchors.right:parent.right
98             anchors.rightMargin: 10
99             y:100
100             height:100
101         BarGauge {
102            val:drone.pwm_motor1;
103            max: 255
104            height:100
105         }
106         BarGauge {
107             val:drone.pwm_motor2;
108             max: 255
109             height:100
110         }
111         BarGauge {
112             val:drone.pwm_motor3;
113             max: 255
114             height:100
115         }
116         BarGauge {
117             val:drone.pwm_motor4;
118             max: 255
119             height:100
120         }
121         BarGauge {
122             val:drone.droneVBat
123             max: 100
124             height:100
125         }
126         }
127
128         Button {
129             x:400
130             width:60
131             id:flyButton
132             anchors.bottom:parent.bottom
133             anchors.margins:15
134             text:"Fly";
135             checkable:true
136             onClicked:{drone.fly=checked;
137             // mainWindow.fullsecreen=checked;
138             }
139         }
140         Button {
141             x:400;y:100
142             width:120
143             id:emergencyButton
144             anchors.top:parent.top
145             anchors.margins:15
146             text:"Energency";
147             checkable:true
148             onClicked:{drone.emergency=checked;}
149         }
150
151         } // Main page
152     }
153
154       Component.onCompleted: {
155             mainWindow.fullscreen = true ;
156             dialogComponent = Qt.createComponent("ConfigDialog.qml");
157             mainWindow.nextPage(mainpageComponent)
158
159       }
160  }