Added Search functionality, and fixed navigation
[spotify:spotify.git] / qmlify / PlaylistView.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QMLify research project.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file.  Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 **
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import Qt 4.7
43
44 Item {
45     id: playlistView
46     focus: true
47
48     property string status: "Storred Playlists"
49
50     function backButton() {
51         if (state == "showPlaylist") {
52             state = "";
53         }
54     }
55
56     Item {
57         id: playlistStatus
58         anchors.top: parent.top
59         anchors.left: parent.left
60         anchors.right: parent.right
61         height: 40
62
63         state: playlistView.state
64         Image {
65             id: backbutton
66
67             anchors.verticalCenter: parent.verticalCenter
68             anchors.left: parent.left
69             anchors.leftMargin: 5
70             anchors.top: parent.top
71             anchors.topMargin: 5
72             anchors.bottom: parent.bottom
73             anchors.bottomMargin: 5
74
75             visible: false
76
77             width: 30
78             source:  "images/back_arrow.png"
79
80             MouseArea
81             {
82                 anchors.fill: parent
83                 onClicked: {
84                     backButton();
85                 }
86             }
87         }
88         Text {
89             anchors.verticalCenter: parent.verticalCenter
90             anchors.left: backbutton.right
91             anchors.leftMargin: 5
92             anchors.right: parent.right
93             anchors.rightMargin: 5
94             anchors.top: parent.top
95             anchors.bottom: parent.bottom
96             horizontalAlignment: Text.AlignHCenter
97             verticalAlignment: Text.AlignVCenter
98             elide: Text.ElideMiddle
99             clip: true
100
101             text: playlistView.status
102             font.pixelSize: 30
103
104         }
105     }
106
107     PlaylistContainer
108     {
109         id: playlistContainer
110         enabled: parent.enabled
111
112         x: parent.x
113         anchors.bottom: parent.bottom
114         anchors.top: playlistStatus.bottom
115         width: parent.width
116     }
117
118     Playlist
119     {
120         id: playlist
121         x: parent.x + (parent.width * 2)
122         anchors.bottom: parent.bottom
123         anchors.top: playlistStatus.bottom
124         width:parent.width
125     }
126
127     states: [
128         State {
129             name: "showPlaylist"
130             PropertyChanges {
131                 target: playlistContainer
132                 x: parent.x - parent.width
133             }
134             PropertyChanges {
135                 target: playlist
136                 x: parent.x
137             }
138             PropertyChanges {
139                 target: backbutton
140                 visible: true
141             }
142             PropertyChanges {
143                 target: playlistView
144                 status: playlist.model.name
145             }
146         }
147     ]
148     transitions: Transition {
149              NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
150          }
151 }