6db4c3ac99a935878b7f22e5d10274f91cfe0e19
[qwp] / qml / qwp / content / Config.qml
1 import QtQuick 1.0
2
3 ShadowRectangle {
4     y: parent.height
5     anchors.horizontalCenter: parent.horizontalCenter
6     opacity: 1
7     width: parent.width
8     height: wrappersc.height
9     color: "#7d7b97"
10
11     Flow {
12         id: wrappersc
13         flow: Flow.TopToBottom
14         anchors.horizontalCenter: parent.horizontalCenter
15         anchors.verticalCenter: parent.verticalCenter
16         spacing:  10
17         anchors.bottomMargin: 5
18         anchors.topMargin: 5
19         Text {
20             text: "Language:"
21             font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
22             horizontalAlignment: Qt.AlignRight
23         }
24         Input{
25             id: fromIn
26             KeyNavigation.backtab: searchbutton
27             KeyNavigation.tab:phraseIn
28             onAccepted:searchbutton.doSearch();
29             focus: true
30             text: schModel.from
31         }
32         Text {
33             text: "Search:"
34             font.bold: true; color: "white"; style: Text.Raised; styleColor: "black"
35             horizontalAlignment: Qt.AlignRight
36         }
37         Input{
38             id: phraseIn
39             KeyNavigation.backtab: fromIn
40             KeyNavigation.tab:searchbutton
41             onAccepted:searchbutton.doSearch();
42             text: schModel.phrase
43         }
44
45         Button {
46             x: 2
47             width: menu.width-4
48             height: menu.height
49             id: searchbutton
50             keyUsing: true;
51             opacity: 1
52             text: "Go"
53             KeyNavigation.tab: fromIn
54             Keys.onReturnPressed: searchbutton.doSearch();
55             Keys.onEnterPressed: searchbutton.doSearch();
56             Keys.onSelectPressed: searchbutton.doSearch();
57             Keys.onSpacePressed: searchbutton.doSearch();
58             onClicked: searchbutton.doSearch();
59
60             function doSearch() {
61                 // Search ! allowed
62                 if (wrappersc.state=="invalidinput")
63                     return;
64
65                 schModel.from=fromIn.text;
66                 schModel.phrase = phraseIn.text;
67                 fond.focus = true;
68                 fond.state = ""
69             }
70         }
71     }
72
73     states:
74         State {
75         name: "invalidinput"
76         when: fromIn.text=="" // && phraseIn.text==""
77         PropertyChanges { target: searchbutton ; opacity: 0.6 ; }
78     }
79
80     transitions:
81         Transition {
82         NumberAnimation { target: searchbutton; property: "opacity"; duration: 200 }
83     }
84 }
85
86
87
88