From: Kate Alhola Date: Wed, 11 Apr 2012 11:34:08 +0000 (+0300) Subject: sync repository X-Git-Url: http://vcs.maemo.org/git/?p=mardrone;a=commitdiff_plain;h=ae0a3c2dc0898400aca0dd6b439c5db8044db7b2 sync repository --- diff --git a/mardrone/ardrone_symbian.qml b/mardrone/ardrone_symbian.qml new file mode 100644 index 0000000..b396dc5 --- /dev/null +++ b/mardrone/ardrone_symbian.qml @@ -0,0 +1,269 @@ +import QtQuick 1.0 +import com.nokia.symbian 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 { + 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:50 + // visible:drone.confUseAccel + 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 + 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;} + } + + + 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("ConfigDialogSymbian.qml"); + + } + }