+import QtQuick 1.0
+import com.nokia.android 1.1
+import JoyStick 1.0
+Page {
+ property color textColor:"white"
+ 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"}}
+ }
+ }
+ Component.onCompleted: {
+ console.debug("Appending items to choices",uiList.count())
+ for(var j = 0; j < uiList.count();++j ) {
+ var data = {'name':uiList.get(j).name,'modelData':uiList.get(j).name,'file':uiList.get(j).file };
+ console.debug("appending ",uiList.get(j).name,uiList.get(j).file);
+ choices.append(data);
+ if(uiList.get(j).file==drone.confActiveUI) { activeUIDialog.selectedIndex=j; uiDialogButton.text=uiList.get(j).name }
+ }
+ }
+
+ ListModel {
+ id: choices
+ }
+ SelectionDialog {
+ id: activeUIDialog;
+ model:choices
+
+ onSelectedIndexChanged: {
+ console.debug("onSelectedIndexChanged " + model.get(selectedIndex).name + ", " + model.get(selectedIndex).file);
+ drone.confActiveUI=choices.get(selectedIndex).file;
+ uiDialogButton.text=uiList.get(selectedIndex).name
+ }
+ }
+ Flickable {
+ id: dialogscrolarea
+ anchors.fill: parent
+ // anchors.leftMargin:50;anchors.rightMargin:50
+ contentHeight: dialogcontent.height
+ contentWidth: parent.width
+
+ Grid {
+ columns:2
+ id: dialogcontent
+ anchors.leftMargin:50;anchors.rightMargin:150
+ spacing: 20
+
+ Text {
+ font.pixelSize :textSize
+ text:"UI Style"
+
+ }
+ Button {
+ width:200
+ id:uiDialogButton
+ text:""
+ anchors.right:parent.right
+ onClicked:activeUIDialog.open()
+ // onClicked:uiMenu.open()
+ }
+ Text {
+ width:350
+ text: "Drone IP"
+ color:textColor
+ font.pixelSize :textSize
+ }
+
+ TextField {
+ id: droneip
+ width: 300
+ height: 40
+ anchors.right: parent.right
+ text: drone.confDroneIp
+ onTextChanged:{drone.confDroneIp=text;}
+ }
+
+// }
+
+ Text {
+ text: "Video 640x480/Full Screen"
+ color:textColor
+ font.pixelSize :textSize
+ }
+ Switch {
+ id: fullScreen
+ checked:drone.confFullScreen
+ anchors.right:parent.right
+ 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
+ checked:drone.confShowDebug
+ anchors.right:parent.right
+ onCheckedChanged:{drone.confShowDebug=checked;}
+ }
+
+ Text {
+ text: "Show engine gauges"
+ color:textColor
+ font.pixelSize :textSize
+
+ }
+ Switch {
+ id: showGauges
+ checked:drone.confShowGauges
+ anchors.right:parent.right
+ 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.confShowHorizon=checked;}
+ }
+
+ Text {
+ text: "Forward/backward gain"
+ color:textColor
+ font.pixelSize :textSize
+ }
+
+ Slider {
+ id: forwardGain
+ anchors.right:parent.right
+ maximumValue:1.0
+ stepSize:0.01
+ value:drone.confForwardGain
+ onValueChanged:{drone.confForwardGain=value;}
+ }
+ Text {
+ text: "Right/Left gain"
+ color:textColor
+ font.pixelSize :textSize
+ }
+
+ Slider {
+ id: rightGain
+ anchors.right:parent.right
+ maximumValue:1.0
+ stepSize:0.01
+ value:drone.confRightGain
+ onValueChanged:{drone.confRightGain=value;}
+ }
+ Text {
+ text: "accel ctrl treshold"
+ color:textColor
+ font.pixelSize :textSize
+ }
+
+ Slider {
+ id: ctrlTreshold
+ anchors.right:parent.right
+ 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());
+ }
+ }
+*/
+ }
+ }
+