b283f6100b18b5c573f4484719f9262d87326540
[mdictionary] / src / mdictionary / qml / StarDictDialog.qml
1 import Qt 4.7
2
3 Rectangle{
4     property bool newPlugin:false;
5
6     function setInfo(string){
7         textInfo.text = string;
8     }
9     function setPath(string){
10         textPath.text = string;
11     }
12     function setButtonText(string){
13         saveButton.textInButton=string;
14     }
15     function setNew(bool){
16         newPlugin=bool;
17     }
18
19     signal saveButtonClicked();
20     signal browseButtonClicked();
21     signal heightChange(int intiger);
22
23     id:rectangle1
24     width: 220
25     height: newPlugin ? textPath.height+50 : textInfo.height+50
26
27     onHeightChanged:{
28         heightChange((newPlugin ? textPath.height+50 : textInfo.height+50));
29         //console.log( "debug" + (newPlugin ? textPath.paintedHeight+55 : textInfo.paintedHeight+55));
30     }
31
32
33
34     SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
35     color : myPalette.window;
36
37     Text {
38         id: textInfo
39         text: "Tekst: "
40         height: paintedHeight+5;
41         anchors.right: parent.right
42         anchors.left: parent.left
43         anchors.top: parent.top
44         wrapMode: Text.Wrap;
45         transformOrigin: Item.Left
46         font.pixelSize: 12
47     }
48
49     Text {
50         id: textPath
51         text: qsTr("Dictionary file: not selected")
52         height: paintedHeight+5;
53         anchors.top: parent.top
54         anchors.right: browseButton.left
55         anchors.left: parent.left
56         wrapMode: Text.Wrap;
57         transformOrigin: Item.Left
58         font.pixelSize: 12
59         opacity: 0
60     }
61
62     Button {
63         id: browseButton
64         width: 80;
65         height: 25;
66         textInButton: qsTr("Browse");
67         anchors.top: parent.top
68         anchors.topMargin: 10
69         anchors.right: parent.right
70         opacity: 0
71         onClicked: rectangle1.browseButtonClicked();
72     }
73
74     Button {
75         id: saveButton
76         height: 30
77         anchors.bottom: parent.bottom
78         textInButton: qsTr("Save")
79         anchors.right: parent.right
80         anchors.left: parent.left
81         onClicked: rectangle1.saveButtonClicked();
82     }
83
84     states: [
85         State {
86             name: "new"
87             when: newPlugin==true
88             PropertyChanges { target: textInfo; opacity: 0}
89             PropertyChanges { target: textPath; opacity: 1}
90             PropertyChanges { target: browseButton; opacity: 1 }
91         }
92     ]
93 }