1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html" |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The playlist class represents an instance of a playlist. |
|
17 * SmfPlaylist class is in accordance with the XML Shareable Playlist Format (XSPF) |
|
18 * as mentioned in http://xspf.org/xspf-v1.html |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef SMFPLAYLIST_H_ |
|
23 #define SMFPLAYLIST_H_ |
|
24 |
|
25 #include <qdatastream.h> |
|
26 #include <QSharedData> |
|
27 #include <QMetaType> |
|
28 #include <QVariant> |
|
29 |
|
30 #include "smfclientglobal.h" |
|
31 #include "smftrackinfo.h" |
|
32 #include "smfcomment.h" |
|
33 |
|
34 class SmfPlaylistPrivate; |
|
35 |
|
36 /** |
|
37 * @ingroup smf_common_group |
|
38 * The playlist class represents an instance of a playlist. |
|
39 * SmfPlaylist class is in accordance with the XML Shareable Playlist Format (XSPF) |
|
40 * as mentioned in http://xspf.org/xspf-v1.html |
|
41 */ |
|
42 class SMFCLIENT_EXPORT SmfPlaylist |
|
43 { |
|
44 public: |
|
45 /** |
|
46 * Constructor with default argument |
|
47 */ |
|
48 SmfPlaylist( ); |
|
49 |
|
50 /** |
|
51 * Copy Constructor |
|
52 * @param aOther The reference object |
|
53 */ |
|
54 SmfPlaylist( const SmfPlaylist &aOther ); |
|
55 |
|
56 /** |
|
57 * Overloaded = operator |
|
58 * @param aOther The reference object |
|
59 */ |
|
60 SmfPlaylist& operator=( const SmfPlaylist &aOther ); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 ~SmfPlaylist( ); |
|
66 |
|
67 /** |
|
68 * Method to get the version of the playlist |
|
69 * @return The version of the playlist |
|
70 */ |
|
71 QString version( ) const; |
|
72 |
|
73 /** |
|
74 * Method to get the playlist title |
|
75 * @return The title of the playlist |
|
76 */ |
|
77 QString playListTitle( ) const; |
|
78 |
|
79 /** |
|
80 * Method to get the author of the playlist |
|
81 * @return The author of the playlist |
|
82 */ |
|
83 QString author( ) const; |
|
84 |
|
85 /** |
|
86 * Method to get the comments on the playlist |
|
87 * @return The comments on the playlist |
|
88 */ |
|
89 QList<SmfComment> comments( ) const; |
|
90 |
|
91 /** |
|
92 * Method to get the URI of a web page to find out more about this playlist |
|
93 * @return The info Url |
|
94 */ |
|
95 QUrl info( ) const; |
|
96 |
|
97 /** |
|
98 * Method to get the Source URI for this playlist |
|
99 * @return The Source URI for this playlist |
|
100 */ |
|
101 QUrl location( ) const; |
|
102 |
|
103 /** |
|
104 * Method to get the id of the playlist |
|
105 * @return The ID value |
|
106 */ |
|
107 QString id( ) const; |
|
108 |
|
109 /** |
|
110 * Method to get the URI of an image to display in the absence |
|
111 * of an image for playlist's tracks |
|
112 * @return The deafult image Url |
|
113 */ |
|
114 QUrl image( ) const; |
|
115 |
|
116 /** |
|
117 * Method to get the creation date of the playlist |
|
118 * @return The date and time of creation of the playlist |
|
119 */ |
|
120 QDateTime creationDate( ) const; |
|
121 |
|
122 /** |
|
123 * Method to get the URI of a resource that describes the license |
|
124 * under which this playlist was released |
|
125 * @return The license Url |
|
126 */ |
|
127 QUrl license( ) const; |
|
128 |
|
129 /** |
|
130 * Method to get the ordered list of URIs. The purpose is to satisfy |
|
131 * licenses allowing modification but requiring attribution |
|
132 * @return The list of license Urls |
|
133 */ |
|
134 QList<QUrl> attribution( ) const; |
|
135 |
|
136 /** |
|
137 * Method to get the meta element that allows metadata fields to be added to XSPF |
|
138 * @return The meta elements as a QVarintMap |
|
139 */ |
|
140 QVariantMap metadata( ) const; |
|
141 |
|
142 /** |
|
143 * Method to get the extension element that allows non-XSPF XML |
|
144 * to be included in XSPF documents |
|
145 * @return The extension elements as a QVarintMap |
|
146 */ |
|
147 QVariantMap extension( ) const; |
|
148 |
|
149 /** |
|
150 * Method to get the list of tracks in the playlist |
|
151 * @return The list of tracks in the playlist |
|
152 */ |
|
153 QList<SmfTrackInfo> trackList( ) const; |
|
154 |
|
155 /** |
|
156 * Method to set the version of the playlist |
|
157 * @param aVersion The version of the playlist |
|
158 */ |
|
159 void setVersion( const QString& aVersion ); |
|
160 |
|
161 /** |
|
162 * Method to set the playlist title |
|
163 * @param aTitle The title of the playlist |
|
164 */ |
|
165 void setPlayListTitle( const QString &aTitle ); |
|
166 |
|
167 /** |
|
168 * Method to set the author of the playlist |
|
169 * @param aAuthor The author of the playlist |
|
170 */ |
|
171 void setAuthor( const QString& aAuthor ); |
|
172 |
|
173 /** |
|
174 * Method to set the comments on the playlist |
|
175 * @param aComments The comments on the playlist |
|
176 */ |
|
177 void setComments( const QList<SmfComment>& aComments ); |
|
178 |
|
179 /** |
|
180 * Method to set the URI of a web page to find out more about this playlist |
|
181 * @param aInfoUrl The info Url |
|
182 */ |
|
183 void setInfo( const QUrl& aInfoUrl ); |
|
184 |
|
185 /** |
|
186 * Method to set the Source URI for this playlist |
|
187 * @param aLocation The Source URI for this playlist |
|
188 */ |
|
189 void setLocation( const QUrl& aLocation ); |
|
190 |
|
191 /** |
|
192 * Method to set the id of the playlist |
|
193 * @param aId The ID value |
|
194 */ |
|
195 void setId( const QString &aId); |
|
196 |
|
197 /** |
|
198 * Method to set the URI of an image to display in the absence |
|
199 * of an image for playlist's tracks |
|
200 * @param aImage The default image Url |
|
201 */ |
|
202 void setImage( const QUrl& aImage ); |
|
203 |
|
204 /** |
|
205 * Method to set the creation date of the playlist |
|
206 * @param aDate The date and time of creation of the playlist |
|
207 */ |
|
208 void setCreationDate( const QDateTime& aDate ); |
|
209 |
|
210 /** |
|
211 * Method to set the URI of a resource that describes the license |
|
212 * under which this playlist was released |
|
213 * @param aLicense The license Url |
|
214 */ |
|
215 void setLicense( const QUrl& aLicense ); |
|
216 |
|
217 /** |
|
218 * Method to set the ordered list of URIs. The purpose is to satisfy |
|
219 * licenses allowing modification but requiring attribution |
|
220 * @param aAttribution The list of license Urls |
|
221 */ |
|
222 void setAttribution( const QList<QUrl>& aAttribution ); |
|
223 |
|
224 /** |
|
225 * Method to set the meta element that allows metadata fields to be added to XSPF |
|
226 * @param aMetaData The meta elements as a QVarintMap |
|
227 */ |
|
228 void setMetadata( const QVariantMap& aMetaData ); |
|
229 |
|
230 /** |
|
231 * Method to set the extension element that allows non-XSPF XML |
|
232 * to be included in XSPF documents |
|
233 * @param aExtension The extension elements as a QVarintMap |
|
234 */ |
|
235 void setExtension( const QVariantMap& aExtension ); |
|
236 |
|
237 /** |
|
238 * Method to set the list of tracks in the playlist |
|
239 * @param aList The new list of tracks in the playlist |
|
240 */ |
|
241 void setTrackList( const QList<SmfTrackInfo> &aList ); |
|
242 |
|
243 private: |
|
244 QSharedDataPointer<SmfPlaylistPrivate> d; |
|
245 |
|
246 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
247 const SmfPlaylist &aPlaylist ); |
|
248 |
|
249 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
250 SmfPlaylist &aPlaylist ); |
|
251 |
|
252 }; |
|
253 |
|
254 |
|
255 /** |
|
256 * Method for Externalization. Writes the SmfPlaylist object to |
|
257 * the stream and returns a reference to the stream. |
|
258 * @param aDataStream Stream to be written |
|
259 * @param aPlaylist The SmfPlaylist object to be externalized |
|
260 * @return reference to the written stream |
|
261 */ |
|
262 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, |
|
263 const SmfPlaylist &aPlaylist ); |
|
264 |
|
265 /** |
|
266 * Method for Internalization. Reads a SmfPlaylist object from |
|
267 * the stream and returns a reference to the stream. |
|
268 * @param aDataStream Stream to be read |
|
269 * @param aPlaylist The SmfPlaylist object to be internalized |
|
270 * @return reference to the stream |
|
271 */ |
|
272 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, |
|
273 SmfPlaylist &aPlaylist); |
|
274 |
|
275 typedef QList<SmfPlaylist> SmfPlaylistList; |
|
276 |
|
277 // Make the class SmfPlaylist known to QMetaType, so that as to register it. |
|
278 Q_DECLARE_METATYPE(SmfPlaylist) |
|
279 Q_DECLARE_METATYPE(QList<SmfPlaylist>) |
|
280 |
|
281 #endif /* SMFPLAYLIST_H_ */ |
|
282 |
|