fd6bb81b2c7e044219b77267d8011fe16bf02023
[vietkaralist] / qml / vietkaralist / SongList.qml
1 /*
2 Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16 */
17
18 import QtQuick 1.1
19
20 Item {
21
22     id:songList
23
24     anchors.fill: parent
25     anchors.leftMargin: 0
26     anchors.rightMargin: 0
27
28     SongListView {
29         id:songlistview
30     }
31
32
33     Rectangle {
34         width: parent.width
35         height: 50
36         color:"lightblue"
37
38         radius: 4
39
40         border.color: "grey"
41
42         Rectangle {
43             id: rec_tag
44
45             width: parent.width-80
46             x:9
47             height: 35
48             anchors.verticalCenter: parent.verticalCenter
49             border.color: "grey"
50             radius: 4
51             TextInput {
52                 id: txt_searchText
53                 width: parent.width-1
54                 height: 27
55                 x:10
56                 text: ""
57                 font.pixelSize: 20
58                 anchors.verticalCenter: parent.verticalCenter
59
60                 Keys.onEnterPressed: {
61                     doSearch();
62                 }
63             }
64         }
65
66         Rectangle {
67             x:rec_tag.width+20
68             width:50
69             height: 35
70             anchors.verticalCenter: parent.verticalCenter
71             radius:4
72
73             color: "white"
74             border.color: "grey"
75
76             Image {
77                 id: btn_search
78                 source: "imgs/search.png"
79                 anchors.verticalCenter: parent.verticalCenter
80                 anchors.horizontalCenter: parent.horizontalCenter
81             }
82
83             MouseArea {
84                 anchors.fill: parent
85                 onClicked: {
86                     doSearch();
87                 }
88                 onPressed: {
89                     parent.color = "lightblue";
90                 }
91                 onReleased : {
92                     parent.color = "white"
93                 }
94             }
95         }
96
97     }
98
99     WaitingDlg {
100         id:waitingdlg
101         anchors.centerIn:parent
102         visible: false
103     }
104
105     function doSearch(){
106         waitingdlg.visible = true;
107         DBMan.doSearch(txt_searchText.text);
108     }
109
110     Connections {
111         target: DBMan
112         onStopSearch:{
113             waitingdlg.visible = false;
114         }
115     }
116
117 }