improved desktop UI
[mardrone] / mardrone / ardrone_harmattan.qml
index 32d2fba..49c3fe5 100644 (file)
@@ -25,6 +25,7 @@ PageStackWindow {
 
   DroneControl {
         id:drone
+  //      logSeq:initialPage.frameSeq
     }
   JoyStick {
       id:js
@@ -34,27 +35,48 @@ PageStackWindow {
       onRudderChanged:  {if(drone.confUseJoyStick) drone.yaw=rudder;}
 
   }
+  Keys.onPressed: {
+      console.debug("QML:Keys.onPressed",event.key)
+                if (event.key == Qt.Key_TopMenu)
+                    console.debug("QML: opening menu!")
+                else if (event.key == Qt.Key_Close) {
+                    console.debug("QML: closing! (maybe)")
+                    pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+                }
+            }
+
+  function backKey() {
+       console.debug("QML: backKey")
+      pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
+    }
 
     Component {
       id: mainpageComponent
 
       Page {
         id:mainPage
+        property int frameSeq:0
         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
-            x:100
+            anchors.horizontalCenter: parent.horizontalCenter
             visible:drone.confShowHorizon
             roll:drone.droneRoll
             pitch:drone.dronePitch
@@ -63,9 +85,7 @@ PageStackWindow {
             indicatorColor:"#00FF00"
             skyColor:"#00000000"
             groundColor:"#00000000"
-//            value:lj.xv
-//            value2:lj.yv
-            width:560;height:400;
+            width:500;height:400;
         }
 
 
@@ -211,8 +231,8 @@ PageStackWindow {
         }
 
         Button {
-            x:400
-            width:60
+            x:300
+            width:80
             id:flyButton
             anchors.bottom:parent.bottom
             anchors.margins:15
@@ -223,17 +243,35 @@ PageStackWindow {
             }
         }
         Button {
-            x:500
-            width:140
+            x:450
+            width:100
             id:emergencyButton
             anchors.bottom:parent.bottom
 
             anchors.margins:15
-            text:"Energency";
+            text:"Emrg";
             checkable:true
             onClicked:{drone.emergency=checked;}
         }
-
+        Button {
+            x:600;
+            width:100
+            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