improved desktop UI
[mardrone] / mardrone / JoyStickCalibratorDesktop.qml
index 5893d42..6e78f5f 100644 (file)
@@ -4,11 +4,12 @@ import QtDesktop 0.1
 
 Item {
     width: 600
 
 Item {
     width: 600
-    height: 800
+    height: 600
     property int textSize:22
     property int ctrlSize:40
     ListModel {
           id: axisMapModel
     property int textSize:22
     property int ctrlSize:40
     ListModel {
           id: axisMapModel
+          ListElement { text:"none";     mapAxis:0 }
           ListElement { text:"Aileron";  mapAxis:1 }
           ListElement { text:"Elevator"; mapAxis:2 }
           ListElement { text:"Throtle";  mapAxis:3 }
           ListElement { text:"Aileron";  mapAxis:1 }
           ListElement { text:"Elevator"; mapAxis:2 }
           ListElement { text:"Throtle";  mapAxis:3 }
@@ -156,17 +157,17 @@ Item {
             }
             Column {
                 Button{
             }
             Column {
                 Button{
-                    text:"Reset"
+                    width:160
+                    text:"Calibrate"
                     onClicked:{
                     onClicked:{
-                        js.calibrate=false
-                        pageStack.pop();
+                        js.calibrate=true
                     }
                 }
                 Button{
                     }
                 }
                 Button{
+                    width:160
                     text:"Save"
                     onClicked:{
                         js.calibrate=false
                     text:"Save"
                     onClicked:{
                         js.calibrate=false
-                        pageStack.pop();
                     }
                 }
         }
                     }
                 }
         }
@@ -176,7 +177,7 @@ Item {
             columns:7
             Text {
                 font.pixelSize  :textSize
             columns:7
             Text {
                 font.pixelSize  :textSize
-                text:"     Raw"
+                text:"      Raw"
             }
             Text {
                 font.pixelSize  :textSize
             }
             Text {
                 font.pixelSize  :textSize
@@ -238,18 +239,17 @@ Item {
                 width:200;
                 model: axisMapModel
                 onSelectedIndexChanged: {
                 width:200;
                 model: axisMapModel
                 onSelectedIndexChanged: {
-                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
-                    js.mapAxis1=selectedIndex+1;
+                    console.debug("onSelectedIndexChanged axis1:" + selectedText + ", " + selectedIndex);
+                //    js.mapAxis1=selectedIndex;
                 }
                 }
-               selectedIndex:js.mapAxis1-1
+
+              selectedIndex:js.mapAxis1
              }
              }
-/*            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis1==1?"Aileron":js.mapAxis1==2?"Elevator":js.mapAxis1==3?"Throtle":js.mapAxis1==4?"Rudder":"none"
-                onClicked:js1map.open()
+            Binding {
+                target:js
+                property:"mapAxis1"
+                value:axisMap1UICombo.selectedIndex
             }
             }
-*/
-
 
             Text {
                 font.pixelSize  :textSize
 
             Text {
                 font.pixelSize  :textSize
@@ -278,12 +278,16 @@ Item {
                 checked:js.invertAxis2
                 onCheckedChanged:{js.invertAxis2=checked;}
             }
                 checked:js.invertAxis2
                 onCheckedChanged:{js.invertAxis2=checked;}
             }
-            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis2==1?"Aileron":js.mapAxis2==2?"Elevator":js.mapAxis2==3?"Throtle":js.mapAxis2==4?"Rudder":"none"
-                onClicked:js2map.open()
-            }
-
+            ComboBox {
+                id: axisMap2UICombo;
+                width:200;
+                model: axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+                //    js.mapAxis2=selectedIndex+1;
+                }
+               selectedIndex:js.mapAxis2
+             }
 
 
             Text {
 
 
             Text {
@@ -313,12 +317,16 @@ Item {
                 checked:js.invertAxis3
                 onCheckedChanged:{js.invertAxis3=checked;}
             }
                 checked:js.invertAxis3
                 onCheckedChanged:{js.invertAxis3=checked;}
             }
-            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis3==1?"Aileron":js.mapAxis3==2?"Elevator":js.mapAxis3==3?"Throtle":js.mapAxis3==4?"Rudder":"none"
-                onClicked:js3map.open()
-            }
-
+            ComboBox {
+                id: axisMap3UICombo;
+                width:200;
+                model: axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+                 //   js.mapAxis3=selectedIndex+1;
+                }
+               selectedIndex:js.mapAxis3
+             }
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis4
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis4
@@ -346,12 +354,16 @@ Item {
                 checked:js.invertAxis4
                 onCheckedChanged:{js.invertAxis4=checked;}
             }
                 checked:js.invertAxis4
                 onCheckedChanged:{js.invertAxis4=checked;}
             }
-            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis4==1?"Aileron":js.mapAxis4==2?"Elevator":js.mapAxis4==3?"Throtle":js.mapAxis4==4?"Rudder":"none"
-                onClicked:js4map.open()
-            }
-
+            ComboBox {
+                id: axisMap4UICombo;
+                width:200;
+                model: axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+                 //   js.mapAxis4=selectedIndex+1;
+                }
+               selectedIndex:js.mapAxis4
+             }
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis5
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis5
@@ -379,12 +391,16 @@ Item {
                 checked:js.invertAxis5
                 onCheckedChanged:{js.invertAxis5=checked;}
             }
                 checked:js.invertAxis5
                 onCheckedChanged:{js.invertAxis5=checked;}
             }
-            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis5==1?"Aileron":js.mapAxis5==2?"Elevator":js.mapAxis5==3?"Throtle":js.mapAxis5==4?"Rudder":"none"
-                onClicked:js5map.open()
-            }
-
+            ComboBox {
+                id: axisMap5UICombo;
+                width:200;
+                model: axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+                 //   js.mapAxis5=selectedIndex+1;
+                }
+               selectedIndex:js.mapAxis5
+             }
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis6
             Text {
                 font.pixelSize  :textSize
                 text:js.rawAxis6
@@ -412,11 +428,16 @@ Item {
                 checked:js.invertAxis6
                 onCheckedChanged:{js.invertAxis6=checked;}
             }
                 checked:js.invertAxis6
                 onCheckedChanged:{js.invertAxis6=checked;}
             }
-            Button{
-                width:200;height:ctrlSize
-                text:js.mapAxis6==1?"Aileron":js.mapAxis6==2?"Elevator":js.mapAxis6==3?"Throtle":js.mapAxis6==4?"Rudder":"none"
-                onClicked:js6map.open()
-            }
+            ComboBox {
+                id: axisMap6UICombo;
+                width:200;
+                model: axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + selectedIndex);
+                   // js.mapAxis6=selectedIndex+1;
+                }
+               selectedIndex:js.mapAxis6
+             }
         }
 
     }
         }
 
     }