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