starDict dialog in qml
[mdictionary] / src / mdictionary / qml / XdxfDialog.qml
1 import Qt 4.7
2
3 Rectangle{
4     id:rectangle1
5     width: 220
6     height: textPlugin.height + textFrom.height + textTo.height + textDescription.height + textInfo.height +90
7
8     property bool newPlugin:false;
9
10     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
11     color : myPalette.window;
12
13     function setPlugin(string){
14         textPlugin.text = qsTr("Plugin") + ": " + string;
15     }
16     function setFrom(string){
17         textFrom.text = qsTr("From") + ": " + string;
18     }
19     function setTo(string){
20         textTo.text = qsTr("To") + ": " + string;
21     }
22     function setDescription(string){
23         textDescription.text = qsTr("Description") + ": " + string;
24     }
25     function setInfo(string){
26         textInfo.text = string;
27     }
28     function setButtonText(string){
29         saveButton.textInButton=string;
30     }
31     function setCheckedOptimalize(bool){
32         optimalizeCheckbox.selected=bool;
33     }
34     function setCheckedStrip(bool){
35         stripCheckbox.selected=bool;
36     }
37     function setNew(bool){
38         newPlugin=bool;
39     }
40     function setPath(string){
41         textPath.text=string;
42     }
43
44
45     signal saveButtonClicked();
46     signal downloadButtonClicked();
47     signal browseButtonClicked();
48     signal optimalizeCheckboxChanged(bool Boolean);
49     signal stripCheckboxChanged(bool Boolean);
50
51     Text {
52         id: textPlugin
53         width: rectangle1.width
54         height: paintedHeight+5;
55         text: "Plugin: "
56         wrapMode: Text.Wrap;
57         transformOrigin: Item.Left
58         anchors.horizontalCenter: parent.horizontalCenter
59         font.pixelSize: 12
60     }
61
62     Text {
63         id: textFrom
64         width:rectangle1.width
65         height: paintedHeight+5;
66         text: "From: "
67         wrapMode: Text.Wrap;
68         anchors.top: textPlugin.bottom
69         anchors.horizontalCenter: parent.horizontalCenter
70         font.pixelSize: 12
71     }
72
73     Text {
74         id: textTo
75         width: rectangle1.width
76         height: paintedHeight+5;
77         text: "To: "
78         wrapMode: Text.Wrap;
79         anchors.top: textFrom.bottom
80         transformOrigin: Item.Left
81         anchors.horizontalCenter: parent.horizontalCenter
82         font.pixelSize: 12
83     }
84
85     Text {
86         id: textDescription
87         width: rectangle1.width
88         height: paintedHeight+5;
89         text: "Description: "
90         wrapMode: Text.Wrap;
91         anchors.top: textTo.bottom
92         transformOrigin: Item.Left
93         anchors.horizontalCenter: parent.horizontalCenter
94         font.pixelSize: 12
95     }
96
97     Text {
98         id: textInfo
99         width: rectangle1.width
100         height: paintedHeight+5;
101         text: ": "
102         wrapMode: Text.Wrap;
103         anchors.top: textDescription.bottom
104         transformOrigin: Item.Left
105         anchors.horizontalCenter: parent.horizontalCenter
106         font.pixelSize: 12
107     }
108
109     Checkbox {
110         id: optimalizeCheckbox
111         width: 20
112         height: 20
113         anchors.left: parent.left
114         anchors.leftMargin: 5
115         anchors.top: textInfo.bottom
116         onChanged: rectangle1.optimalizeCheckboxChanged(selected);
117     }
118
119     Checkbox {
120         id: stripCheckbox
121         width: 20
122         height: 20
123         anchors.top: optimalizeCheckbox.bottom
124         anchors.topMargin: 5
125         anchors.horizontalCenter: optimalizeCheckbox.horizontalCenter
126         onChanged: rectangle1.stripCheckboxChanged(selected);
127     }
128
129     Text {
130         id: textOptimalize
131         width: 80
132         height: 20
133         text: qsTr("Optimize")
134         anchors.left: optimalizeCheckbox.right
135         anchors.leftMargin: 5
136         anchors.verticalCenterOffset: 3
137         anchors.verticalCenter: optimalizeCheckbox.verticalCenter
138         font.pixelSize: 12
139     }
140
141     Text {
142         id: textStrip
143         width: 80
144         height: 20
145         text: qsTr("Strip accents")
146         anchors.verticalCenterOffset: 3
147         anchors.verticalCenter: stripCheckbox.verticalCenter
148         anchors.horizontalCenter: textOptimalize.horizontalCenter
149         font.pixelSize: 12
150     }
151
152     Button {
153         id: saveButton
154         height: 30
155         textInButton: qsTr("Save")
156         anchors.top: stripCheckbox.bottom
157         anchors.topMargin: 10
158         anchors.right: parent.right
159         anchors.left: parent.left
160         onClicked: rectangle1.saveButtonClicked();
161     }
162
163     Text {
164         id: textPath
165         height: paintedHeight+5;
166         text: qsTr("Dictionary file: not selected")
167         wrapMode: Text.Wrap;
168         anchors.top: parent.top
169         anchors.topMargin: 10
170         anchors.right: browseButton.left
171         anchors.rightMargin: 0
172         anchors.left: parent.left
173         anchors.leftMargin: 0
174         font.pixelSize: 12
175         opacity: 0
176     }
177
178     Button {
179         id: browseButton
180         width: 80;
181         height: 25;
182         textInButton: qsTr("Browse");
183         anchors.top: parent.top
184         anchors.topMargin: 10
185         anchors.right: parent.right
186         anchors.rightMargin: 10
187         opacity: 0
188         onClicked: rectangle1.browseButtonClicked();
189     }
190
191     Button {
192         id: downloadButton
193         width: 80;
194         height: 25;
195         textInButton: qsTr("Download");
196         anchors.right: parent.right
197         anchors.rightMargin: 10
198         anchors.top: browseButton.bottom
199         anchors.topMargin: 10
200         opacity: 0
201         onClicked: rectangle1.downloadButtonClicked();
202     }
203
204     states: [
205         State {
206             name: "Stan1"
207             when: newPlugin==true
208             PropertyChanges { target: textPlugin; opacity: 0}
209             PropertyChanges { target: textFrom; opacity: 0}
210             PropertyChanges { target: textTo; opacity: 0}
211             PropertyChanges { target: textDescription; opacity: 0}
212             PropertyChanges { target: textInfo; opacity: 0}
213
214             PropertyChanges { target: textPath; opacity: 1}
215             PropertyChanges { target: browseButton; opacity: 1 }
216             PropertyChanges { target: downloadButton; opacity: 1}
217         }
218     ]
219 }