Merge branch 'qml' of ssh://drop.maemo.org/git/mdictionary into 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     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;
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     Checkbox {
109         id: optimalizeCheckbox
110         width: 20
111         height: 20
112         anchors.left: parent.left
113         anchors.leftMargin: 5
114         anchors.top: textInfo.bottom
115         onChanged: rectangle1.optimalizeCheckboxChanged(selected);
116     }
117
118     Checkbox {
119         id: stripCheckbox
120         width: 20
121         height: 20
122         anchors.top: optimalizeCheckbox.bottom
123         anchors.topMargin: 5
124         anchors.horizontalCenter: optimalizeCheckbox.horizontalCenter
125         onChanged: rectangle1.stripCheckboxChanged(selected);
126     }
127
128     Text {
129         id: textOptimalize
130         width: 80
131         height: 20
132         text: qsTr("Optimize")
133         anchors.left: optimalizeCheckbox.right
134         anchors.leftMargin: 5
135         anchors.verticalCenterOffset: 3
136         anchors.verticalCenter: optimalizeCheckbox.verticalCenter
137         font.pixelSize: 12
138     }
139
140     Text {
141         id: textStrip
142         width: 80
143         height: 20
144         text: qsTr("Strip accents")
145         anchors.verticalCenterOffset: 3
146         anchors.verticalCenter: stripCheckbox.verticalCenter
147         anchors.horizontalCenter: textOptimalize.horizontalCenter
148         font.pixelSize: 12
149     }
150
151     Button {
152         id: saveButton
153         height: 30
154         textInButton: qsTr("Save")
155         anchors.top: stripCheckbox.bottom
156         anchors.topMargin: 10
157         anchors.right: parent.right
158         anchors.left: parent.left
159         onClicked: rectangle1.saveButtonClicked();
160     }
161
162     Text {
163         id: textPath
164         height: paintedHeight+5;
165         text: qsTr("Dictionary file: not selected")
166         wrapMode: Text.Wrap;
167         anchors.top: parent.top
168         anchors.topMargin: 10
169         anchors.right: browseButton.left
170         anchors.rightMargin: 0
171         anchors.left: parent.left
172         anchors.leftMargin: 0
173         font.pixelSize: 12
174         opacity: 0
175     }
176
177     Button {
178         id: browseButton
179         width: 80;
180         height: 25;
181         textInButton: qsTr("Browse");
182         anchors.top: parent.top
183         anchors.topMargin: 10
184         anchors.right: parent.right
185         anchors.rightMargin: 10
186         opacity: 0
187         onClicked: rectangle1.browseButtonClicked();
188     }
189
190     Button {
191         id: downloadButton
192         width: 80;
193         height: 25;
194         textInButton: qsTr("Download");
195         anchors.right: parent.right
196         anchors.rightMargin: 10
197         anchors.top: browseButton.bottom
198         anchors.topMargin: 10
199         opacity: 0
200         onClicked: rectangle1.downloadButtonClicked();
201     }
202
203     states: [
204         State {
205             name: "Stan1"
206             when: newPlugin==true
207             PropertyChanges { target: textPlugin; opacity: 0}
208             PropertyChanges { target: textFrom; opacity: 0}
209             PropertyChanges { target: textTo; opacity: 0}
210             PropertyChanges { target: textDescription; opacity: 0}
211             PropertyChanges { target: textInfo; opacity: 0}
212
213             PropertyChanges { target: textPath; opacity: 1}
214             PropertyChanges { target: browseButton; opacity: 1 }
215             PropertyChanges { target: downloadButton; opacity: 1}
216         }
217     ]
218 }