Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
[mdictionary] / src / mdictionary / qml / GoogleDialog.qml
index 13e9526..d27cec6 100644 (file)
@@ -26,12 +26,185 @@ Rectangle{
 
     signal saveButtonClicked(string langFrom, string langTo);
 
+
+    id:rectangle1
     height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
     width: 200
+    color : myPalette.window;
 
-    id:rectangle1
+    SystemPalette {
+        id: myPalette;
+        colorGroup:SystemPalette.Active
+    }
+
+    Item {
+        id: comboField
+        anchors.bottomMargin: 6
+        anchors.rightMargin: 0
+        anchors.left: fromLabel.right
+        anchors.right: revertButton.left
+        anchors.bottom: saveButton.top
+        anchors.top: parent.top
+        anchors.leftMargin: 2
+        z:2;
+    }
+
+    Text {
+        id: infoLabel
+        height: paintedHeight+5;
+        anchors.right: parent.right
+        anchors.left: parent.left
+        anchors.top: parent.top
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+
+    Text {
+        id: fromLabel
+        text: qsTr("From: ")
+        height: paintedHeight+5;
+        anchors.top: infoLabel.bottom
+        anchors.left: parent.left
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+    Text {
+        id: toLabel
+        text: qsTr("To: ")
+        anchors.topMargin: 3
+        height: paintedHeight+5;
+        anchors.top: fromLabel.bottom
+        anchors.left: parent.left
+        wrapMode: Text.Wrap;
+        transformOrigin: Item.Left
+        font.pixelSize: 12
+    }
+
+    ComboBox{
+        id: comboFrom
+        model: comboBoxModel
+        anchors.right: revertButton.left
+        anchors.rightMargin: 5
+        anchors.left: fromLabel.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: fromLabel.verticalCenter
+
+        parentField: comboField
+        expanded: false
+        basicHeight: fromLabel.height
+        onExpandedChanged: {
+            if(expanded==true)
+                z=2;
+            else
+                z=0;
+        }
+    }
+
+    ComboBox{
+        id: comboTo
+        model:  comboBoxModel
+        anchors.right: revertButton.left
+        anchors.rightMargin: 5
+        anchors.left: fromLabel.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: toLabel.verticalCenter
+
+        parentField: comboField;
+        expanded: false
+        basicHeight: fromLabel.height
+
+        onExpandedChanged: {
+            if(expanded==true)
+                z=2;
+            else
+                z=0;
+        }
+    }
+
+    IconButton{
+        id: revertButton
+        width: height
+        height: fromLabel.height
+        anchors.top: fromLabel.bottom
+        anchors.topMargin: -8
+        anchors.right: parent.right
+        pathToIcon: "qrc:/button/revert.png"
+        onClicked: { rectangle1.revertLang() }
+    }
+
+    Button {
+        id: saveButton
+        height: 30
+        anchors.bottom: parent.bottom
+        anchors.right: parent.right
+        anchors.left: parent.left
+        onClicked: {
+            rectangle1.saveButtonClicked(comboFrom.value, comboTo.value);
+        }
+    }
+
+    MouseArea {
+        id: mouse_area1
+        anchors.fill: parent
+        z:-1
+        onClicked: {
+            comboTo.expanded=false;
+            comboFrom.expanded=false;
+        }
+    }
+
+
+
+    states: [
+        State {
+            name: "new"
+            when: newPlugin==true
+            PropertyChanges { target: saveButton; textInButton: qsTr("Add") }
+        },
+        State {
+            name: "edit"
+            when: newPlugin==false
+            PropertyChanges { target: saveButton; textInButton: qsTr("Save settings") }
+        }
+    ]
+}
+
+
+/*
+Rectangle{
+    property bool newPlugin:false;
+
+    function setInfo(string){
+        infoLabel.text = string;
+    }
+    function setStartValues(startFrom, startTo, startFromIndex, startToIndex){
+        comboFrom.setStartValue(startFrom, startFromIndex)
+        comboTo.setStartValue(startTo, startToIndex)
+    }
+    function revertLang(){
+        var tmpidx = comboFrom.index
+        comboFrom.index = comboTo.index
+        comboTo.index = tmpidx
 
+        var tmpval = comboFrom.value
+        comboFrom.value = comboTo.value
+        comboTo.value = tmpval
+    }
 
+    function setNew(bool){
+        newPlugin=bool;
+    }
+
+    signal saveButtonClicked(string langFrom, string langTo);
+
+
+    id:rectangle1
+    height: infoLabel.height + fromLabel.height + toLabel.height + saveButton.height + 50
+    width: 200
 
     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
     color : myPalette.window;
@@ -72,6 +245,8 @@ Rectangle{
     }
 
     ComboBox{
+        //parentField: rectangle1
+
         id: comboFrom
         model: comboBoxModel
         anchors.left: parent.left
@@ -96,6 +271,7 @@ Rectangle{
     }
 
     ComboBox{
+        //parentField: rectangle1;
         id: comboTo
         model:  comboBoxModel
         anchors.left: parent.left
@@ -155,4 +331,5 @@ Rectangle{
         }
     ]
 }
+*/