add setingWidget Qml
[mdictionary] / src / mdictionary / qml / SettingsWidget.qml
index df60531..74d3a9f 100644 (file)
 import Qt 4.7
 
 Rectangle {
-    width: 500
-    height:500
+    id: rectangle1
+    width: 230
+    height:170
+
+    SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
+    color : myPalette.window;
+
+    signal historySizeValueChanged(int intiger);
+    signal searchResulValueChanged(int intiger);
+    signal dictionariesCheckBoxChanged(bool Boolean);
+    signal bookmarksCheckBoxChanged(bool Boolean);
+    signal saveButtonClicked();
+
+    function setMinHistory(intiger){
+        historySpinbox.minValue=intiger;
+    }
+    function setMaxHistory(intiger){
+        historySpinbox.maxValue=intiger;
+    }
+    function setValueHistory(intiger){
+        historySpinbox.value=intiger;
+    }
+
+    function setMaxSearchResult(intiger){
+        searchSpinbox.maxValue=intiger;
+    }
+    function setMinSearchResult(intiger){
+        searchSpinbox.minValue=intiger;
+    }
+    function setValueSearchResult(intiger){
+        searchSpinbox.value=intiger;
+    }
+
+    function setCheckedBookmarks(bool){
+        bookmarkCheckBox.selected=bool;
+    }
+    function setCheckedDictionaries(bool){
+        dictionariesCheckBox.selected=bool;
+    }
 
     Text {
-        id: text1
-        x: 36
-        y: 11
-        width: 80
-        height: 20
-        text: "Search result size"
+        id: textSearch
+        width: 120
+        height: paintedHeight+5;
+        text: qsTr("Search result size")
+        anchors.verticalCenterOffset: 2
+        anchors.left: parent.left
+        anchors.verticalCenter: searchSpinbox.verticalCenter
         font.pixelSize: 12
     }
 
     Text {
-        id: text2
-        x: 36
-        y: 83
-        width: 80
-        height: 20
-        text: "History size"
+        id: textHistory
+        width: 120
+        height: paintedHeight+5;
+        text: qsTr("History size")
+        anchors.verticalCenterOffset: 2
+        anchors.left: parent.left
+        anchors.verticalCenter: historySpinbox.verticalCenter
         font.pixelSize: 12
     }
 
     Text {
-        id: text3
-        x: 36
-        y: 131
-        width: 80
-        height: 20
-        text: "Search in:"
+        id: textSearchIn
+        width: 120
+        height: paintedHeight+5;
+        text: qsTr("Search in:")
+        anchors.top: textHistory.bottom
+        anchors.topMargin: 15
+        anchors.left: parent.left
         font.pixelSize: 12
     }
 
     Text {
-        id: text4
-        x: 94
-        y: 150
-        width: 80
+        id: textBookmark
+        width: 120
         height: 20
-        text: "Bookmarks"
+        text: qsTr("Bookmarks")
+        anchors.verticalCenterOffset: 2
+        anchors.left: bookmarkCheckBox.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: bookmarkCheckBox.verticalCenter
         font.pixelSize: 12
     }
 
     Text {
-        id: text5
-        x: 94
-        y: 177
-        width: 80
+        id: textDictionaries
+        width: 120
         height: 20
-        text: "Dictionaries"
+        text: qsTr("Dictionaries")
+        anchors.verticalCenterOffset: 2
+        anchors.left: dictionariesCheckBox.right
+        anchors.leftMargin: 10
+        anchors.verticalCenter: dictionariesCheckBox.verticalCenter
         font.pixelSize: 12
     }
 
     MySpinBox {
-        id: myspinbox1
+        id: searchSpinbox
         width: 40
         height: 20;
-        x: 152
-        y: 9
+        anchors.top: parent.top
+        anchors.topMargin: 10
+        anchors.left: textSearch.right
+        anchors.leftMargin: 20
+        onValueChange: rectangle1.searchResulValueChanged(intiger);
     }
 
     MySpinBox {
-        id: myspinbox2
+        id: historySpinbox
         width: 40
         height: 20;
-        x: 152
-        y: 81
+        anchors.horizontalCenter: searchSpinbox.horizontalCenter
+        anchors.top: searchSpinbox.bottom
+        anchors.topMargin: 10
+        onValueChange: rectangle1.historySizeValueChanged(intiger);
     }
 
     Checkbox {
-        id: checkbox1
+        id: bookmarkCheckBox
         width: 20
-        x: 36
-        y: 157
+        height: 20
+        anchors.left: parent.left
+        anchors.leftMargin: 20
+        anchors.top: textSearchIn.bottom
+        anchors.topMargin: 0
+        onChanged: rectangle1.bookmarksCheckBoxChanged(selected);
     }
 
     Checkbox {
-        id: checkbox2
+        id: dictionariesCheckBox
         width: 20
-        x: 36
-        y: 177
+        height: 20
+        anchors.horizontalCenter: bookmarkCheckBox.horizontalCenter
+        anchors.top: bookmarkCheckBox.bottom
+        anchors.topMargin: 3
+        onChanged: rectangle1.dictionariesCheckBoxChanged(selected);
+    }
+
+    Button {
+        id: saveButton
+        width: 66
+        height:26
+        anchors.bottom: parent.bottom
+        anchors.bottomMargin: 5
+        anchors.right: parent.right
+        anchors.rightMargin: 5
+        textInButton: qsTr("Save")
+        onClicked: rectangle1.saveButtonClicked();
     }
 }