|
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 * |
|
18 */ |
|
19 |
|
20 #include <smfplaylist.h> |
|
21 #include <smfplaylist_p.h> |
|
22 |
|
23 /** |
|
24 * Constructor with default argument |
|
25 */ |
|
26 SmfPlaylist::SmfPlaylist( ) |
|
27 { |
|
28 d = new SmfPlaylistPrivate; |
|
29 } |
|
30 |
|
31 /** |
|
32 * Copy Constructor |
|
33 * @param aOther The reference object |
|
34 */ |
|
35 SmfPlaylist::SmfPlaylist( const SmfPlaylist &aOther ) |
|
36 : d( aOther.d ) |
|
37 { |
|
38 } |
|
39 |
|
40 /** |
|
41 * Overloaded = operator |
|
42 * @param aOther The reference object |
|
43 * @return The target reference value |
|
44 */ |
|
45 SmfPlaylist& SmfPlaylist::operator=( const SmfPlaylist &aOther ) |
|
46 { |
|
47 d->m_trackList = aOther.d->m_trackList; |
|
48 d->m_title = aOther.d->m_title; |
|
49 d->m_creationDate = aOther.d->m_creationDate; |
|
50 d->m_playlistId = aOther.d->m_playlistId; |
|
51 return *this; |
|
52 } |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 SmfPlaylist::~SmfPlaylist( ) |
|
58 { |
|
59 } |
|
60 |
|
61 /** |
|
62 * Method to get the list of tracks in the playlist |
|
63 * @return The list of tracks in the playlist |
|
64 */ |
|
65 QList<SmfTrackInfo> SmfPlaylist::trackList( ) const |
|
66 { |
|
67 return d->m_trackList; |
|
68 } |
|
69 |
|
70 /** |
|
71 * Method to get the playlist title |
|
72 * @return The title of the playlist |
|
73 */ |
|
74 QString SmfPlaylist::playListTitle( ) const |
|
75 { |
|
76 return d->m_title; |
|
77 } |
|
78 |
|
79 /** |
|
80 * Method to get the creation date of the playlist |
|
81 * @return The date and time of creation of the playlist |
|
82 */ |
|
83 QDateTime SmfPlaylist::creationDate( ) const |
|
84 { |
|
85 return d->m_creationDate; |
|
86 } |
|
87 /** |
|
88 * Method to get the id of the playlist |
|
89 * @return The ID value |
|
90 */ |
|
91 QString SmfPlaylist::id( ) const |
|
92 { |
|
93 return d->m_playlistId; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Method to set the list of tracks in the playlist |
|
98 * @param aList The new list of tracks in the playlist |
|
99 */ |
|
100 void SmfPlaylist::setTrackList( const QList<SmfTrackInfo> &aList ) |
|
101 { |
|
102 d->m_trackList = aList; |
|
103 } |
|
104 |
|
105 /** |
|
106 * Method to set the playlist title |
|
107 * @param aTitle The new title of the playlist |
|
108 */ |
|
109 void SmfPlaylist::setPlayListTitle( const QString &aTitle ) |
|
110 { |
|
111 d->m_title = aTitle; |
|
112 } |
|
113 |
|
114 /** |
|
115 * Method to set the creation date of the playlist |
|
116 * @param aDate The new date and time of creation of the playlist |
|
117 */ |
|
118 void SmfPlaylist::setCreationDate( const QDateTime &aDate ) |
|
119 { |
|
120 d->m_creationDate = aDate; |
|
121 } |
|
122 |
|
123 /** |
|
124 * Method to set the id of the playlist |
|
125 * @param aId The ID value |
|
126 */ |
|
127 void SmfPlaylist::setId( const QString &aId) |
|
128 { |
|
129 d->m_playlistId = aId; |
|
130 } |
|
131 |
|
132 |
|
133 /** |
|
134 * Method for Externalization. Writes the SmfPlaylist object to |
|
135 * the stream and returns a reference to the stream. |
|
136 * @param aDataStream Stream to be written |
|
137 * @param aPlaylist The SmfPlaylist object to be externalized |
|
138 * @return reference to the written stream |
|
139 */ |
|
140 QDataStream &operator<<( QDataStream &aDataStream, |
|
141 const SmfPlaylist &aPlaylist ) |
|
142 { |
|
143 // Serialize d->m_trackList |
|
144 aDataStream<<aPlaylist.d->m_trackList; |
|
145 |
|
146 // Serialize d->m_title |
|
147 aDataStream<<aPlaylist.d->m_title; |
|
148 |
|
149 // Serialize d->m_creationDate |
|
150 aDataStream<<aPlaylist.d->m_creationDate; |
|
151 |
|
152 // Serialize d->m_playlistId |
|
153 aDataStream<<aPlaylist.d->m_playlistId; |
|
154 |
|
155 return aDataStream; |
|
156 } |
|
157 |
|
158 /** |
|
159 * Method for Internalization. Reads a SmfPlaylist object from |
|
160 * the stream and returns a reference to the stream. |
|
161 * @param aDataStream Stream to be read |
|
162 * @param aPlaylist The SmfPlaylist object to be internalized |
|
163 * @return reference to the stream |
|
164 */ |
|
165 QDataStream &operator>>( QDataStream &aDataStream, |
|
166 SmfPlaylist &aPlaylist) |
|
167 { |
|
168 // Deserialize d->m_trackList |
|
169 aDataStream>>aPlaylist.d->m_trackList; |
|
170 |
|
171 // Deserialize d->m_title |
|
172 aDataStream>>aPlaylist.d->m_title; |
|
173 |
|
174 // Deserialize d->m_creationDate |
|
175 aDataStream>>aPlaylist.d->m_creationDate; |
|
176 |
|
177 // Deserialize d->m_playlistId |
|
178 aDataStream>>aPlaylist.d->m_playlistId; |
|
179 |
|
180 return aDataStream; |
|
181 } |