0.2 version add desktop components multitouch, joystick, multicast
[mardrone] / mardrone / ardrone.meegostyle.qml
diff --git a/mardrone/ardrone.meegostyle.qml b/mardrone/ardrone.meegostyle.qml
new file mode 100644 (file)
index 0000000..c8e514b
--- /dev/null
@@ -0,0 +1,207 @@
+import Qt 4.7
+import com.nokia.meego 1.0
+import Drone 1.0
+
+
+Window {
+    id:mainWindow
+//    fullscreen:true
+    property Component dialogComponent
+// property alias m: mainPage
+      StatusBar {
+          id: statusBar
+          anchors.top: parent.top
+          anchors.bottom:myToolbar.top
+          orientation: screen.orientation
+          width: parent.width
+      }
+
+    ToolBar {
+        id: myToolbar
+        anchors.top: statusBar.bottom
+     // anchors.bottom: pageStack.top
+    }
+
+    PageStack {
+            id: pageStack
+             clip: true
+            anchors.top: toolBar.bottom
+            anchors.bottom: parent.bottom
+            width: parent.width
+            toolBar: myToolbar
+        }
+    ToolBarLayout {
+            id: commonTools
+            visible: false
+            ToolItem { iconId: "icon-m-toolbar-home"; onClicked: pageStack.pop(); }
+            ToolItem { iconId: "icon-m-toolbar-view-menu"; onClicked: myMenu.open(); }
+            ToolItem { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
+        }
+
+
+  DroneControl {
+        id:drone
+    }
+
+    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;
+        }
+
+        GaugeHorizon {
+            y:0
+            x:100
+            visible:drone.confShowHorizon
+            value:drone.droneRoll
+            value2:drone.dronePitch
+//            value:lj.xv
+//            value2:lj.yv
+            opacity:0.5
+            width:640;height:480;
+        }
+        Text {
+            y:100
+            visible:drone.confUseAccel
+            color: "#00FF00"
+            id: droneCtrlValues
+            font.pixelSize:20
+            text: "cmd:pitch=" + Math.round(drone.pitch) + " roll= " +  Math.round(drone.roll) + " yaw=" + Math.round(drone.yaw) + " vv= " +  Math.round(drone.vVelocity)
+        }
+
+        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
+            text: "conf"
+            onClicked:{   //mainWindow.fullscreen = false ;
+                     pageStack.push(dialogComponent);
+            }
+        }
+        Image {
+            visible: !drone.confUseAccel
+            x:10;y:200
+            width:280;height:280;
+            source: "joybox.png"
+
+            JoyStick {
+                id:lj
+                anchors.fill:parent
+                anchors.margins:50
+                onYvChanged:{drone.pitch=yv;}
+                onXvChanged:{drone.roll=xv;}
+
+
+            }
+        }
+        Image {
+            y:200
+            anchors.right:parent.right
+            width:280;height:280;
+            source: "joybox.png"
+            JoyStick {
+                id:rj
+                anchors.fill:parent
+                anchors.margins:50
+                onYvChanged:{drone.vVelocity=-1*yv;}
+                onXvChanged:{drone.yaw=xv;}
+                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)
+//      }
+ }