improved desktop UI
[mardrone] / mardrone / ConfigDialog.qml
index 655cc0f..c680851 100644 (file)
@@ -2,18 +2,38 @@ import QtQuick 1.0
 import com.nokia.meego 1.0
 import JoyStick 1.0
 Page {
-        property color textColor:"black"
+        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 };
+ //                 var data = {'name':uiList.get(j).name };
+                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
+      /*       ListElement {name:"xyzzy" ;file:"plugh.qml"}
+             ListElement {name:"xyzzy2" ;file:"plugh.qml"}*/
+        }
+        SelectionDialog {
+            id: activeUIDialog;
+            height:400
+            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
@@ -33,9 +53,14 @@ Page {
 
               }
               Button {
-                  text:drone.confActiveUI
+                  id:uiDialogButton
+                  text:""
                   anchors.right:parent.right
-                  onClicked:uiMenu.open()
+                  onClicked: {
+                  //    activeUIDialog.setSelectedIndex(text);
+                      activeUIDialog.open();
+                  }
+             //     onClicked:uiMenu.open()
               }
           Text {
               width:350
@@ -86,7 +111,7 @@ Page {
               id: useJoySw
               checked:drone.confUseJoyStick
               anchors.right:parent.right
-              enabled:js.haveJoyStick
+           //   enabled:js.haveJoyStick
               onCheckedChanged:{drone.confUseJoyStick=checked;}
            }
 
@@ -133,7 +158,7 @@ Page {
 
            Text {
               text: "Show engine gauges"
-             color:textColor
+              color:textColor
               font.pixelSize  :textSize
 
            }
@@ -207,11 +232,7 @@ Page {
                 tools:commonTools
                 JoyStickCalibrator {
                     id:jc
-                //    jStick:js
-                    Component.onCompleted: {
-                        if (jc.status != Component.Ready)
-                                    console.log("Error loading component:", jc.errorString());
-                    }
+
                 }
 
         }