import Drone 1.0 import QtQuick 1.0 import QtDesktop 0.1 import Gauges 1.0 import JoyStick 1.0 Window { title: "MArdrone" id:mainWindow width: 1024 height: 800 maximumHeight: mainWindow.height minimumHeight: 800 maximumWidth: 1280 minimumWidth: 800 visible: true MenuBar { Menu { text: "File" MenuItem { text: "Settings" shortcut: "Ctrl+O" onTriggered: configDialog.visible = true } MenuItem { text: "Close" shortcut: "Ctrl+Q" onTriggered: Qt.quit() } } Menu { text: "Edit" MenuItem { text: "Copy" } MenuItem { text: "Paste" } } } DroneControl { id:drone } JoyStick { id:js onElevatorChanged:{if(drone.confUseJoyStick) drone.pitch=elevator;} onAileronChanged: {if(drone.confUseJoyStick) drone.roll=aileron;} onThrotleChanged: {if(drone.confUseJoyStick) drone.vVelocity=throtle;} onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;} } Column { width:parent.width spacing:5 Rectangle { id:mainWiew width:parent.width height:480 //onEntered:(mainWindow.fullscreen=true) state:"Landscape" DroneVideo { id:droneVideo y:0 // anchors.horizontalCenter: parent.horizontalCenter // anchors.horizontalCenter:parent.horizontalCenter width:drone.confFullScreen? parent.width:640 ;height:width<=640 ?480*width/640:480; } EfisPFD { id:hudPDF y:0 // anchors.horizontalCenter: parent.horizontalCenter visible:drone.confShowHorizon roll:drone.droneRoll pitch:drone.dronePitch ias:drone.droneSpeed alt:drone.droneAltitude/10 indicatorColor:"green" skyColor:"#00000000" groundColor:"#00000000" width:640;height:480; } Text { y:100 // visible:drone.confUseAccel color: "#00FF00" id: droneCtrlValues font.pixelSize:20 text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " + drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2) } Text { y:115 visible:drone.confShowDebug color: "#00FF00" id: droneNavData font.pixelSize:20 text: "pitch=" + Math.round(drone.dronePitch) + " roll= " + Math.round(drone.droneRoll) + "yaw=" + Math.round(drone.droneYaw) + " alt= " + Math.round(drone.droneAltitude) } Text { y:130 visible:drone.confShowDebug color: "#00FF00" id: droneStatus font.pixelSize:20 text: drone.decodedStatus } /* Button { y:150;x:0 height: 50 width: 50 iconSource: "gear32x32.png" onClicked:{ configDialog.visible = true } } */ JoyStickIndicator { anchors.left:parent.left anchors.bottom:parent.bottom anchors.margins:10 visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick border.width:1 color:"transparent" width:100;height:100 xvalue:js.axis4 yvalue:js.axis3 Text { anchors.bottom: parent.bottom font.pixelSize: 10 text:" rudder" } Text { x:-10;y:50 rotation:90 font.pixelSize: 10 text:"Throtle" } } JoyStickIndicator { anchors.right:parent.right anchors.bottom:parent.bottom anchors.margins:10 visible:drone.confShowJSIndicators&js.haveJoyStick&drone.confUseJoyStick border.width:1 color:"transparent" width:100;height:100 xvalue:js.axis1 yvalue:js.axis2 Text { anchors.bottom: parent.bottom font.pixelSize: 10 text:" Aileron" } Text { x:-15;y:50 rotation:90 font.pixelSize: 10 text:"Elevator" } } JoyStickTouch { id:lj width:280;height:280; y:200 visible: !drone.confUseAccel & !drone.confUseJoyStick anchors.left:parent.left anchors.margins:50 onYvChanged:{drone.pitch=yv/200.0;} onXvChanged:{drone.roll=xv/200.0;} } JoyStickTouch { visible: !drone.confUseJoyStick id:rj y:200 anchors.right:parent.right width:280;height:280; anchors.margins:50 onYvChanged:{drone.vVelocity=-1*yv/200.0;} onXvChanged:{drone.yaw=xv/200.0;} onPressedChanged: { drone.ctrlActive=pressed;} } } Row { spacing:5 EfisPFD { id:pDF width:300 height:320 showHSI:true roll:drone.droneRoll pitch:drone.dronePitch ias:drone.droneSpeed alt:drone.droneAltitude/10 // bezel:"glareshield1.png" } Grid { columns: 3 AltGauge { width:120 height:120 id:altGauge value:drone.droneAltitude/10 bezel:"bezel.png" } AttitudeGauge { width:120 height:120 id:attGauge roll:drone.droneRoll pitch:drone.dronePitch bezel:"bezel.png" } HeadingGauge { width:120 height:120 id:hdgGauge value:drone.droneYaw bezel:"bezel.png" } GaugeArc { width:120 height:120 id:fuelGauge anchors.margins:10 displayScale:0.85 font.pixelSize:10 tickIncrement:10 tickSpacing:20 tickMinor:5 lowPosition:220 highPosition:120 low:0 high:100 gaugeStyle:2 color:"white" value:drone.droneVBat lineWidth:2 backColor:"black" } GaugeHSI{ anchors.margins:10 displayScale:0.7 width:120 height:120 font.pixelSize:10 tickIncrement:30 tickSpacing:10 tickMinor:5 gaugeStyle:2 color:"white" backColor:"black" id:hsi } Row { spacing: 5 anchors.rightMargin: 10 height:100 BarGauge { val:drone.pwm_motor1; max: 255 height:100 } BarGauge { val:drone.pwm_motor2; max: 255 height:100 } BarGauge { val:drone.pwm_motor3; max: 255 height:100 } BarGauge { val:drone.pwm_motor4; max: 255 height:100 } BarGauge { val:drone.droneVBat max: 100 height:100 } } } // Grid if instruments } // Column ( Main window content ) Dialog { id:configDialog width:800 height:600 data:ConfigDialogDesktop {} } } } // Main page