// uiName:Android import QtQuick 1.0 import com.nokia.android 1.1 import Drone 1.0 //import gauges 1.0 import JoyStick 1.0 PageStackWindow { id:mainWindow initialPage: mainpageComponent showStatusBar: false // fullscreen:true property Component dialogComponent // property alias m: mainPage /* ToolBarLayout { id: commonTools visible: false ToolItem { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); } // ToolItem { iconId: "icon-m-toolbar-home"; onClicked: pageStack.pop(); } ToolItem { iconId: "icon-m-toolbar-view-menu"; onClicked: myMenu.open(); } } */ ToolBarLayout { id: commonTools ToolButton { flat: true iconSource: "toolbar-back" onClicked: mainWindow.pageStack.depth <= 1 ? Qt.quit() : mainWindow.pageStack.pop() } } DroneControl { id:drone } JoyStick { id:js onElevatorChanged:{if(drone.confUseJoyStick) drone.pitch=elevator;} onAileronChanged: {if(drone.confUseJoyStick) drone.roll=-1.0*aileron;} onThrotleChanged: {if(drone.confUseJoyStick) drone.vVelocity=throtle;} onRudderChanged: {if(drone.confUseJoyStick) drone.yaw=rudder;} } Component { id: mainpageComponent Page { id:mainPage property bool connectingBoxVisible:true //onEntered:(mainWindow.fullscreen=true) state:"Landscape" DroneVideo { id:droneVideo y:0 x:0 // anchors.horizontalCenter:parent.horizontalCenter width:drone.confFullScreen? parent.width:640 ;height:480*width/640; } Binding { target:drone property:"logSeq" value: droneVideo.frameSeq; } EfisPFD { id:hudPDF y:0 anchors.horizontalCenter: parent.horizontalCenter visible:drone.confShowHorizon roll:drone.droneRoll pitch:drone.dronePitch ias:drone.droneSpeed alt:drone.droneAltitude indicatorColor:"#00FF00" skyColor:"#00000000" groundColor:"#00000000" width:500;height:400; } Text { y:50 visible:drone.confShowDebug color: "#00FF00" id: droneCtrlValues font.pixelSize:25 text: "cmd:pitch=" + drone.pitch.toFixed(2) + " roll= " + drone.roll.toFixed(2) + " yaw=" + drone.yaw.toFixed(2) + " vv= " + drone.vVelocity.toFixed(2) } Text { y:70 visible:drone.confShowDebug color: "#00FF00" id: droneNavData font.pixelSize:25 text: "pitch=" + drone.dronePitch.toFixed(2) + " roll= " + drone.droneRoll.toFixed(2) + "yaw=" + drone.droneYaw.toFixed(2) + " alt= " + drone.droneAltitude.toFixed(2) } Text { y:100 visible:drone.confShowDebug color: "#00FF00" id: droneStatus font.pixelSize:20 text: drone.decodedStatus } Button { y:150;x:0 height: 50 width: 50 z:2 // This is visible even connecting to drone iconSource: "gear32x32.png" onClicked:{ //mainWindow.fullscreen = false ; pageStack.push(dialogComponent); } } JoyStickIndicator { x:200;y:350 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 { x:500;y:350 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:200;height:200; visible: !drone.confUseAccel & !drone.confUseJoyStick anchors.left:parent.left anchors.bottom:parent.bottom anchors.margins:10 joyBackground: "" onYvChanged:{drone.vVelocity=-1*yv/200.0;} onXvChanged:{drone.yaw=xv/200.0;} onPressedChanged: { drone.ctrlActive=pressed;} } JoyStickTouch { visible: !drone.confUseJoyStick id:rj joyBackground: "" anchors.right:parent.right anchors.bottom:parent.bottom width:200;height:200; anchors.margins:10 onYvChanged:{drone.pitch=yv/200.0;} onXvChanged:{drone.roll=xv/200.0;} } Row { spacing: 5 anchors.right:parent.right anchors.rightMargin: 10 y:100 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 } } Button { x:400 width:60 height:50 id:flyButton anchors.bottom:parent.bottom anchors.margins:15 text:"Fly"; checkable:true onClicked:{drone.fly=checked; // mainWindow.fullsecreen=checked; } } Button { x:500; width:80 height:50 id:emergencyButton anchors.bottom:parent.bottom anchors.margins:15 text:"Emrg"; checkable:true onClicked:{drone.emergency=checked;} } Button { x:600; width:100 height:50 id:recordButton anchors.bottom:parent.bottom anchors.margins:15 text:"Rec"; checkable:true onClicked:{droneVideo.recVideo=checked; drone.logFileName=droneVideo.videoFileName; drone.recordLog=checked;} } Text { y:700 anchors.bottom:parent.bottom // visible:droneVideo.recVideo color: "#00FF00" id: droneFrameSeq font.pixelSize:25 text: droneVideo.videoFileName+ " "+droneVideo.frameSeq } Connections { target:drone onConnectedChanged:{ console.log("Connected to drone"); connectingDialog.accept();} } QueryDialog { id:connectingDialog titleText:"Connecting to Drone" message:"Connecting to Drone "+ drone.confDroneIp acceptButtonText:"OK" Component.onCompleted: { console.log("ConectionDialog Opened"); if(!drone.connected) open(); } } } // Main page } Component.onCompleted: { if (mainpageComponent.status != Component.Ready) // pageStack.push(mainpageComponent); // else console.log("Error loading component:", mainpageComponent.errorString()); dialogComponent = Qt.createComponent("ConfigDialogAndroid.qml"); } }