add setingWidget Qml
[mdictionary] / src / mdictionary / qml / SettingsWidget.qml
1 import Qt 4.7
2
3 Rectangle {
4     id: rectangle1
5     width: 230
6     height:170
7
8     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
9     color : myPalette.window;
10
11     signal historySizeValueChanged(int intiger);
12     signal searchResulValueChanged(int intiger);
13     signal dictionariesCheckBoxChanged(bool Boolean);
14     signal bookmarksCheckBoxChanged(bool Boolean);
15     signal saveButtonClicked();
16
17     function setMinHistory(intiger){
18         historySpinbox.minValue=intiger;
19     }
20     function setMaxHistory(intiger){
21         historySpinbox.maxValue=intiger;
22     }
23     function setValueHistory(intiger){
24         historySpinbox.value=intiger;
25     }
26
27     function setMaxSearchResult(intiger){
28         searchSpinbox.maxValue=intiger;
29     }
30     function setMinSearchResult(intiger){
31         searchSpinbox.minValue=intiger;
32     }
33     function setValueSearchResult(intiger){
34         searchSpinbox.value=intiger;
35     }
36
37     function setCheckedBookmarks(bool){
38         bookmarkCheckBox.selected=bool;
39     }
40     function setCheckedDictionaries(bool){
41         dictionariesCheckBox.selected=bool;
42     }
43
44     Text {
45         id: textSearch
46         width: 120
47         height: paintedHeight+5;
48         text: qsTr("Search result size")
49         anchors.verticalCenterOffset: 2
50         anchors.left: parent.left
51         anchors.verticalCenter: searchSpinbox.verticalCenter
52         font.pixelSize: 12
53     }
54
55     Text {
56         id: textHistory
57         width: 120
58         height: paintedHeight+5;
59         text: qsTr("History size")
60         anchors.verticalCenterOffset: 2
61         anchors.left: parent.left
62         anchors.verticalCenter: historySpinbox.verticalCenter
63         font.pixelSize: 12
64     }
65
66     Text {
67         id: textSearchIn
68         width: 120
69         height: paintedHeight+5;
70         text: qsTr("Search in:")
71         anchors.top: textHistory.bottom
72         anchors.topMargin: 15
73         anchors.left: parent.left
74         font.pixelSize: 12
75     }
76
77     Text {
78         id: textBookmark
79         width: 120
80         height: 20
81         text: qsTr("Bookmarks")
82         anchors.verticalCenterOffset: 2
83         anchors.left: bookmarkCheckBox.right
84         anchors.leftMargin: 10
85         anchors.verticalCenter: bookmarkCheckBox.verticalCenter
86         font.pixelSize: 12
87     }
88
89     Text {
90         id: textDictionaries
91         width: 120
92         height: 20
93         text: qsTr("Dictionaries")
94         anchors.verticalCenterOffset: 2
95         anchors.left: dictionariesCheckBox.right
96         anchors.leftMargin: 10
97         anchors.verticalCenter: dictionariesCheckBox.verticalCenter
98         font.pixelSize: 12
99     }
100
101     MySpinBox {
102         id: searchSpinbox
103         width: 40
104         height: 20;
105         anchors.top: parent.top
106         anchors.topMargin: 10
107         anchors.left: textSearch.right
108         anchors.leftMargin: 20
109         onValueChange: rectangle1.searchResulValueChanged(intiger);
110     }
111
112     MySpinBox {
113         id: historySpinbox
114         width: 40
115         height: 20;
116         anchors.horizontalCenter: searchSpinbox.horizontalCenter
117         anchors.top: searchSpinbox.bottom
118         anchors.topMargin: 10
119         onValueChange: rectangle1.historySizeValueChanged(intiger);
120     }
121
122     Checkbox {
123         id: bookmarkCheckBox
124         width: 20
125         height: 20
126         anchors.left: parent.left
127         anchors.leftMargin: 20
128         anchors.top: textSearchIn.bottom
129         anchors.topMargin: 0
130         onChanged: rectangle1.bookmarksCheckBoxChanged(selected);
131     }
132
133     Checkbox {
134         id: dictionariesCheckBox
135         width: 20
136         height: 20
137         anchors.horizontalCenter: bookmarkCheckBox.horizontalCenter
138         anchors.top: bookmarkCheckBox.bottom
139         anchors.topMargin: 3
140         onChanged: rectangle1.dictionariesCheckBoxChanged(selected);
141     }
142
143     Button {
144         id: saveButton
145         width: 66
146         height:26
147         anchors.bottom: parent.bottom
148         anchors.bottomMargin: 5
149         anchors.right: parent.right
150         anchors.rightMargin: 5
151         textInButton: qsTr("Save")
152         onClicked: rectangle1.saveButtonClicked();
153     }
154 }