1b2a9606ca63818060ace695e7516acbdaed4351
[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     signal saveButtonClicked();
45     signal downloadButtonClicked();
46     signal browseButtonClicked();
47     signal optimalizeCheckboxChanged(bool Boolean);
48     signal stripCheckboxChanged(bool Boolean);
49
50     Text {
51         id: textPlugin
52         width: rectangle1.width
53         height: paintedHeight+5;
54         text: "Plugin: "
55         wrapMode: Text.Wrap;
56         transformOrigin: Item.Left
57         anchors.horizontalCenter: parent.horizontalCenter
58         font.pixelSize: 12
59     }
60
61     Text {
62         id: textFrom
63         width:rectangle1.width
64         height: paintedHeight+5;
65         text: "From: "
66         wrapMode: Text.Wrap;
67         anchors.top: textPlugin.bottom
68         anchors.horizontalCenter: parent.horizontalCenter
69         font.pixelSize: 12
70     }
71
72     Text {
73         id: textTo
74         width: rectangle1.width
75         height: paintedHeight+5;
76         text: "To: "
77         wrapMode: Text.Wrap;
78         anchors.top: textFrom.bottom
79         transformOrigin: Item.Left
80         anchors.horizontalCenter: parent.horizontalCenter
81         font.pixelSize: 12
82     }
83
84     Text {
85         id: textDescription
86         width: rectangle1.width
87         height: paintedHeight+5;
88         text: "Description: "
89         wrapMode: Text.Wrap;
90         anchors.top: textTo.bottom
91         transformOrigin: Item.Left
92         anchors.horizontalCenter: parent.horizontalCenter
93         font.pixelSize: 12
94     }
95
96     Text {
97         id: textInfo
98         width: rectangle1.width
99         height: (paintedHeight+5)>150?150:paintedHeight+5;
100         text: ": "
101         wrapMode: Text.Wrap;
102         anchors.top: textDescription.bottom
103         transformOrigin: Item.Left
104         anchors.horizontalCenter: parent.horizontalCenter
105         font.pixelSize: 12
106     }
107
108
109     Rectangle {
110         anchors.right: parent.right
111         anchors.left: parent.left
112         anchors.bottom: saveButton.bottom
113         anchors.top: optimalizeCheckbox.top
114
115         id: rectangle2
116         color: myPalette.window
117         anchors.topMargin: -2
118     }
119
120     Checkbox {
121         id: optimalizeCheckbox
122         width: 20
123         height: 20
124         anchors.bottom: stripCheckbox.top
125         anchors.bottomMargin: 5
126         anchors.left: parent.left
127         anchors.leftMargin: 5
128         onChanged: rectangle1.optimalizeCheckboxChanged(selected);
129     }
130
131     Checkbox {
132         id: stripCheckbox
133         width: 20
134         height: 20
135         anchors.bottom: saveButton.top
136         anchors.bottomMargin: 15
137         anchors.horizontalCenter: optimalizeCheckbox.horizontalCenter
138         onChanged: rectangle1.stripCheckboxChanged(selected);
139     }
140
141     Text {
142         id: textOptimalize
143         width: 80
144         height: 20
145         text: qsTr("Optimize")
146         anchors.left: optimalizeCheckbox.right
147         anchors.leftMargin: 5
148         anchors.verticalCenterOffset: 3
149         anchors.verticalCenter: optimalizeCheckbox.verticalCenter
150         font.pixelSize: 12
151     }
152
153     Text {
154         id: textStrip
155         width: 80
156         height: 20
157         text: qsTr("Strip accents")
158         anchors.verticalCenterOffset: 3
159         anchors.verticalCenter: stripCheckbox.verticalCenter
160         anchors.horizontalCenter: textOptimalize.horizontalCenter
161         font.pixelSize: 12
162     }
163
164     Button {
165         id: saveButton
166         height: 30
167         anchors.bottom: parent.bottom
168         textInButton: qsTr("Save")
169         anchors.right: parent.right
170         anchors.left: parent.left
171         onClicked: rectangle1.saveButtonClicked();
172     }
173
174     Text {
175         id: textPath
176         height: paintedHeight+5;
177         text: qsTr("Dictionary file: not selected")
178         wrapMode: Text.Wrap;
179         anchors.top: parent.top
180         anchors.topMargin: 10
181         anchors.right: browseButton.left
182         anchors.rightMargin: 0
183         anchors.left: parent.left
184         anchors.leftMargin: 0
185         font.pixelSize: 12
186         opacity: 0
187     }
188
189     Button {
190         id: browseButton
191         width: 80;
192         height: 25;
193         textInButton: qsTr("Browse");
194         anchors.top: parent.top
195         anchors.topMargin: 10
196         anchors.right: parent.right
197         anchors.rightMargin: 10
198         opacity: 0
199         onClicked: rectangle1.browseButtonClicked();
200     }
201
202     Button {
203         id: downloadButton
204         width: 80;
205         height: 25;
206         textInButton: qsTr("Download");
207         anchors.right: parent.right
208         anchors.rightMargin: 10
209         anchors.top: browseButton.bottom
210         anchors.topMargin: 10
211         opacity: 0
212         onClicked: rectangle1.downloadButtonClicked();
213     }
214
215
216     states: [
217         State {
218             name: "Stan1"
219             when: newPlugin==true
220             PropertyChanges { target: textPlugin; opacity: 0}
221             PropertyChanges { target: textFrom; opacity: 0}
222             PropertyChanges { target: textTo; opacity: 0}
223             PropertyChanges { target: textDescription; opacity: 0}
224             PropertyChanges { target: textInfo; opacity: 0}
225
226             PropertyChanges { target: textPath; opacity: 1}
227             PropertyChanges { target: browseButton; opacity: 1 }
228             PropertyChanges { target: downloadButton; opacity: 1}
229         }
230     ]
231 }