sync repository
[mardrone] / mardrone / ConfigDialog.qml
index a4fed33..655cc0f 100644 (file)
-import Qt 4.7
-import com.meego 1.0
+import QtQuick 1.0
+import com.nokia.meego 1.0
+import JoyStick 1.0
 Page {
+        property color textColor:"black"
+        property int textSize:30
         id:dialog
+       tools:commonTools
+        Menu {
+            id:uiMenu
+            visualParent:pageStack
+            MenuLayout {
+                MenuItem { text:"MeeGo/Harmattan 854x480";  onClicked: { drone.confActiveUI="ardrone_harmattan.qml" }}
+                MenuItem { text:"Desktop";  onClicked: { drone.confActiveUI="ardrone_desktop.qml"}}
+           }
+        }
         Flickable {
           id: dialogscrolarea
-          anchors.top: parent.top
-          anchors.bottom: parent.bottom
-          width: parent.width
-          anchors.leftMargin:50;anchors.rightMargin:50
-
-      /*    anchors.horizontalCenter:parent.horizontalCenter */
-
+          anchors.fill: parent
+ //         anchors.leftMargin:50;anchors.rightMargin:50
           contentHeight: dialogcontent.height
           contentWidth: parent.width
 
           Grid {
               columns:2
               id: dialogcontent
-        //      width: parent.width
-        anchors.left:parent.left;anchors.right:parent.right
-          anchors.leftMargin:50;anchors.rightMargin:50
-
-           spacing: 30
-           Text {
-              width:400
+              anchors.leftMargin:50;anchors.rightMargin:150
+              spacing: 20
+
+              Text {
+                  font.pixelSize  :textSize
+                  text:"UI Style"
+
+              }
+              Button {
+                  text:drone.confActiveUI
+                  anchors.right:parent.right
+                  onClicked:uiMenu.open()
+              }
+          Text {
+              width:350
               text: "Drone IP"
-
+              color:textColor
+              font.pixelSize  :textSize
            }
-           LineEdit {
+
+           TextField {
                   id: droneip
-                  width:300
+                  width: 300
+                  height: 40
+                  anchors.right: parent.right
                   text: drone.confDroneIp
                   onTextChanged:{drone.confDroneIp=text;}
            }
 
+//          }
+
            Text {
-              text: "Video 640x480 / Full Screen"
+              text: "Video 640x480/Full Screen"
+             color:textColor
+              font.pixelSize  :textSize
            }
            Switch {
               id: fullScreen
-        //      enabled:drone.confFullScreen
               checked:drone.confFullScreen
               anchors.right:parent.right
-        //      onEnabledChanged:{drone.confFullScreen=enabled;}
               onCheckedChanged:{drone.confFullScreen=checked;}
            }
+           Text {
+              text: "Acceleration Sensor controll"
+             color:textColor
+              font.pixelSize  :textSize
+           }
+           Switch {
+              id: useAccelSw
+              checked:drone.confUseAccel
+              anchors.right:parent.right
+              onCheckedChanged:{drone.confUseAccel=checked;}
+           }
+           Text {
+               text: "Joystick"
+             color:textColor
+              font.pixelSize  :textSize
+           }
+           Switch {
+              id: useJoySw
+              checked:drone.confUseJoyStick
+              anchors.right:parent.right
+              enabled:js.haveJoyStick
+              onCheckedChanged:{drone.confUseJoyStick=checked;}
+           }
+
+           Text {
+               visible:drone.confUseJoyStick
+               font.pixelSize  :textSize
+               text:"\"" + js.joyStickName + "\""
+
+           }
+           Button {
+               visible:drone.confUseJoyStick
+               text:"Calibrate"
+               anchors.right:parent.right
+               onClicked:{
+                   js.calibrate=true
+                   pageStack.push(calibrateDialog);
+               }
+           }
+           Text {
+               visible:drone.confUseJoyStick
+               font.pixelSize  :textSize
+               text:"Show JoyStick Indicators"
+
+           }
+            Switch {
+               visible:drone.confUseJoyStick
+               checked:drone.confShowJSIndicators
+               anchors.right:parent.right
+               enabled:js.haveJoyStick
+               onCheckedChanged:{drone.confShowJSIndicators=checked;}
 
+           }
            Text {
+             color:textColor
               text: "Show debug"
+              font.pixelSize  :textSize
            }
            Switch {
               id: showDebug
-          //    enabled:drone.confShowDebug
               checked:drone.confShowDebug
               anchors.right:parent.right
-//              onEnabledChanged:{drone.confShowDebug=enabled;}
               onCheckedChanged:{drone.confShowDebug=checked;}
            }
 
            Text {
               text: "Show engine gauges"
+             color:textColor
+              font.pixelSize  :textSize
 
            }
            Switch {
               id: showGauges
-//              enabled:drone.confShowGauges
               checked:drone.confShowGauges
               anchors.right:parent.right
-//              onEnabledChanged:{drone.confShowGauges=enabled;}
               onCheckedChanged:{drone.confShowGauges=checked;}
            }
 
            Text {
               text: "Show horizon"
+             color:textColor
+              font.pixelSize  :textSize
 
            }
            Switch {
               id: showHorizon
               checked:drone.confShowHorizon
               anchors.right:parent.right
-              onCheckedChanged:{drone.onfconfShowHorizon=enabled;}
+              onCheckedChanged:{drone.confShowHorizon=checked;}
            }
 
            Text {
-              text: "Forward gain"
+              text: "Forward/backward gain"
+             color:textColor
+              font.pixelSize  :textSize
            }
 
            Slider {
               id: forwardGain
               anchors.right:parent.right
               maximumValue:1.0
-      //        stepSize:0.01
-              steps:0.01
+              stepSize:0.01
               value:drone.confForwardGain
               onValueChanged:{drone.confForwardGain=value;}
            }
            Text {
-              text: "Backward gain"
-           }
-
-           Slider {
-              id: backwardGain
-              anchors.right:parent.right
-              maximumValue:1.0
-        //      stepSize:0.01
-              steps:0.01
-              value:drone.confBackwardGain
-              onValueChanged:{drone.confBackwardGain=value;}
-           }
-
-           Text {
-              text: "Left gain"
+              text: "Right/Left gain"
+             color:textColor
+              font.pixelSize  :textSize
            }
 
            Slider {
-              id: leftGain
+              id: rightGain
               anchors.right:parent.right
               maximumValue:1.0
-         //     stepSize:0.01
-              steps:0.01
-              value:drone.confLeftGain
-              onValueChanged:{drone.confLeftGain=value;}
+              stepSize:0.01
+              value:drone.confRightGain
+              onValueChanged:{drone.confRightGain=value;}
            }
-
            Text {
-              text: "Right gain"
+              text: "accel ctrl treshold"
+             color:textColor
+              font.pixelSize  :textSize
            }
 
            Slider {
-              id: rightGain
+              id: ctrlTreshold
               anchors.right:parent.right
-              maximumValue:1.0
-         //     stepSize:0.01
-              steps:0.01
-              value:drone.confRightGain
-              onValueChanged:{drone.confRightGain=value;}
+              maximumValue:25.0
+              value:drone.confCtrlTrsh
+              onValueChanged:{drone.confCtrlTrsh=value;}
            }
-
           }
        }
+        Page {
+                property color textColor:"black"
+                property int textSize:30
+                id:calibrateDialog
+                tools:commonTools
+                JoyStickCalibrator {
+                    id:jc
+                //    jStick:js
+                    Component.onCompleted: {
+                        if (jc.status != Component.Ready)
+                                    console.log("Error loading component:", jc.errorString());
+                    }
+                }
+
+        }
      }
+