Added Search functionality, and fixed navigation
[spotify:spotify.git] / qmlify / ScrollView.qml
1 import QtQuick 1.0
2
3 Item {
4
5     signal tabBarClicked
6
7     Rectangle {
8         id: homeView
9         color: "red"
10         x: parent.x
11         y: parent.y
12         width:  parent.width
13         height: parent.height
14     }
15
16     PlaylistView {
17         id: playlistView
18
19         x: homeView.x + parent.width
20         y: parent.y
21         width:  parent.width
22         height: parent.height
23
24         enabled: topLevel.playlistsAvailable
25
26     }
27
28     Rectangle {
29         id: playView
30         color:  "black"
31         x: homeView.x + (parent.width *2)
32         y: parent.y
33         width:  parent.width
34         height: parent.height
35
36     }
37
38     SearchView {
39         id : searchView
40         x: homeView.x + (parent.width * 3)
41         y: parent.y
42         width: parent.width
43         height: parent.height
44     }
45
46     onTabBarClicked: {
47         if (state == "list") {
48             playlistView.state = ""
49         } else if (state == "play") {
50             playView.state = ""
51         } else if (state == "search") {
52             searchView.state = ""
53         } else if (state == "") {
54             homeView.state = ""
55         }
56     }
57
58     states: [
59         State {
60             name: "list"
61             PropertyChanges {
62                 target: homeView
63                 x: -(width * 1)
64             }
65             PropertyChanges {
66                 target: ListView
67                 state: ""
68
69             }
70         },
71         State {
72             name: "play"
73             PropertyChanges {
74                 target: homeView
75                 x: -(width * 2)
76             }
77             PropertyChanges {
78                 target: homeVieww
79                 state: ""
80
81             }
82         },
83         State {
84             name: "search"
85             PropertyChanges {
86                 target: homeView
87                 x: -(width * 3)
88             }
89             PropertyChanges {
90                 target: searchView
91                 state: ""
92
93             }
94         }
95     ]
96 }