--- /dev/null
+import QtQuick 1.0
+import com.nokia.meego 1.0
+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(); }
+
+ }
+
+
+ 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;}
+
+ }
+
+ Component {
+ id: mainpageComponent
+ Page {
+ id:mainPage
+ //onEntered:(mainWindow.fullscreen=true)
+
+ state:"Landscape"
+ DroneVideo {
+ y:0
+ x:0
+ // anchors.horizontalCenter:parent.horizontalCenter
+ width:drone.confFullScreen? parent.width:640 ;height:480*width/640;
+ }
+ EfisPFD {
+ id:hudPDF
+ y:0
+ x:100
+ visible:drone.confShowHorizon
+ roll:drone.droneRoll
+ pitch:drone.dronePitch
+ ias:drone.droneSpeed
+ alt:drone.droneAltitude
+ indicatorColor:"#00FF00"
+ skyColor:"#00000000"
+ groundColor:"#00000000"
+// value:lj.xv
+// value2:lj.yv
+ 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:{ //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: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:10
+ onYvChanged:{drone.vVelocity=-1*yv/200.0;}
+ onXvChanged:{drone.yaw=xv/200.0;}
+ onPressedChanged: { drone.ctrlActive=pressed;}
+ }
+
+ 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
+ id:flyButton
+ anchors.bottom:parent.bottom
+ anchors.margins:15
+ text:"Fly";
+ checkable:true
+ onClicked:{drone.fly=checked;
+ // mainWindow.fullsecreen=checked;
+ }
+ }
+ Button {
+ x:400;y:100
+ width:120
+ id:emergencyButton
+ anchors.top:parent.top
+ anchors.margins:15
+ text:"Energency";
+ checkable:true
+ onClicked:{drone.emergency=checked;}
+ }
+
+ } // Main page
+ }
+
+ Component.onCompleted: {
+ if (mainpageComponent.status != Component.Ready)
+ // pageStack.push(mainpageComponent);
+ // else
+ console.log("Error loading component:", mainpageComponent.errorString());
+ dialogComponent = Qt.createComponent("ConfigDialog.qml");
+
+ }
+// Component.onCompleted: {
+// mainWindow.fullscreen = true ;
+// dialogComponent = Qt.createComponent("ConfigDialog.qml");
+// mainWindow.nextPage(mainpageComponent)
+// }
+ }