|
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 track info class represents information about a music track |
|
17 * |
|
18 */ |
|
19 |
|
20 #include <smftrackinfo.h> |
|
21 #include <smftrackinfo_p.h> |
|
22 |
|
23 /** |
|
24 * Constructor with default argument |
|
25 */ |
|
26 SmfTrackInfo::SmfTrackInfo( ) |
|
27 { |
|
28 d = new SmfTrackInfoPrivate( ); |
|
29 } |
|
30 |
|
31 /** |
|
32 * Copy Constructor |
|
33 * @param aOther The reference object |
|
34 */ |
|
35 SmfTrackInfo::SmfTrackInfo( const SmfTrackInfo &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 SmfTrackInfo& SmfTrackInfo::operator=( const SmfTrackInfo &aOther ) |
|
46 { |
|
47 d->m_trackId = aOther.d->m_trackId; |
|
48 d->m_title = aOther.d->m_title; |
|
49 d->m_album = aOther.d->m_album; |
|
50 d->m_artists = aOther.d->m_artists; |
|
51 d->m_genre = aOther.d->m_genre; |
|
52 d->m_tags = aOther.d->m_tags; |
|
53 d->m_year = aOther.d->m_year; |
|
54 d->m_rating = aOther.d->m_rating; |
|
55 d->m_comments = aOther.d->m_comments; |
|
56 d->m_duration = aOther.d->m_duration; |
|
57 return *this; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 */ |
|
63 SmfTrackInfo::~SmfTrackInfo( ) |
|
64 { |
|
65 } |
|
66 |
|
67 /** |
|
68 * Method to get the track title |
|
69 * @return The title of the track |
|
70 */ |
|
71 QString SmfTrackInfo::title( ) const |
|
72 { |
|
73 return d->m_title; |
|
74 } |
|
75 |
|
76 /** |
|
77 * Method to get the track album |
|
78 * @return The album of the track |
|
79 */ |
|
80 SmfAlbum SmfTrackInfo::album( ) const |
|
81 { |
|
82 return d->m_album; |
|
83 } |
|
84 |
|
85 /** |
|
86 * Method to get the track's artists |
|
87 * @return The artists of the track |
|
88 */ |
|
89 SmfArtists SmfTrackInfo::artists( ) const |
|
90 { |
|
91 return d->m_artists; |
|
92 } |
|
93 |
|
94 /** |
|
95 * Method to get the genre of the track |
|
96 * @return The genre of the track |
|
97 */ |
|
98 QString SmfTrackInfo::genre( ) const |
|
99 { |
|
100 return d->m_genre; |
|
101 } |
|
102 |
|
103 /** |
|
104 * Method to get the track's tag |
|
105 * @return The tag of the track |
|
106 */ |
|
107 QStringList SmfTrackInfo::tags( ) const |
|
108 { |
|
109 return d->m_tags; |
|
110 } |
|
111 |
|
112 /** |
|
113 * Method to get the release year of the track |
|
114 * @return The release year of the track |
|
115 */ |
|
116 QDateTime SmfTrackInfo::year( ) const |
|
117 { |
|
118 return d->m_year; |
|
119 } |
|
120 |
|
121 /** |
|
122 * Method to get the track's rating |
|
123 * @return The rating of the track |
|
124 */ |
|
125 SmfMusicRating SmfTrackInfo::rating( ) const |
|
126 { |
|
127 return d->m_rating; |
|
128 } |
|
129 |
|
130 /** |
|
131 * Method to get the comments on the track |
|
132 * @return The comments on the track |
|
133 */ |
|
134 QList<SmfComment> SmfTrackInfo::comments( ) const |
|
135 { |
|
136 return d->m_comments; |
|
137 } |
|
138 |
|
139 /** |
|
140 * Method to get the track's duration |
|
141 * @return The duration of the track |
|
142 */ |
|
143 QTime SmfTrackInfo::duration( ) const |
|
144 { |
|
145 return d->m_duration; |
|
146 } |
|
147 |
|
148 /** |
|
149 * Method to get the id of the track |
|
150 * @return The ID value |
|
151 */ |
|
152 QString SmfTrackInfo::id( ) const |
|
153 { |
|
154 return d->m_trackId; |
|
155 } |
|
156 |
|
157 /** |
|
158 * Method to set the track title |
|
159 * @param aTitle The new title of the track |
|
160 */ |
|
161 void SmfTrackInfo::setTitle( const QString &aTitle ) |
|
162 { |
|
163 d->m_title = aTitle; |
|
164 } |
|
165 |
|
166 /** |
|
167 * Method to set the track album |
|
168 * @param aAlbum The new album of the track |
|
169 */ |
|
170 void SmfTrackInfo::setAlbum( const SmfAlbum &aAlbum ) |
|
171 { |
|
172 d->m_album = aAlbum; |
|
173 } |
|
174 |
|
175 /** |
|
176 * Method to set the track's artists |
|
177 * @param aArtists The new artists of the track |
|
178 */ |
|
179 void SmfTrackInfo::setArtists( const SmfArtists &aArtists ) |
|
180 { |
|
181 d->m_artists = aArtists; |
|
182 } |
|
183 |
|
184 /** |
|
185 * Method to set the genre of the track |
|
186 * @param aGenre The new genre of the track |
|
187 */ |
|
188 void SmfTrackInfo::setGenre( const QString &aGenre ) |
|
189 { |
|
190 d->m_genre = aGenre; |
|
191 } |
|
192 |
|
193 /** |
|
194 * Method to set the track's tag |
|
195 * @param aTag The tag of the track |
|
196 */ |
|
197 void SmfTrackInfo::setTags( const QStringList &aTags ) |
|
198 { |
|
199 d->m_tags = aTags; |
|
200 } |
|
201 |
|
202 /** |
|
203 * Method to set the release year of the track |
|
204 * @param aYear The new release year of the track |
|
205 */ |
|
206 void SmfTrackInfo::setYear( const QDateTime &aYear ) |
|
207 { |
|
208 d->m_year = aYear; |
|
209 } |
|
210 |
|
211 /** |
|
212 * Method to set the track's rating |
|
213 * @param aRating The new rating of the track |
|
214 */ |
|
215 void SmfTrackInfo::setRating( const SmfMusicRating &aRating ) |
|
216 { |
|
217 d->m_rating = aRating; |
|
218 } |
|
219 |
|
220 /** |
|
221 * Method to set the comments on the track |
|
222 * @param aComment The new comment of the track |
|
223 */ |
|
224 void SmfTrackInfo::setComment( const QList<SmfComment> &aComments ) |
|
225 { |
|
226 d->m_comments = aComments; |
|
227 } |
|
228 |
|
229 /** |
|
230 * Method to set the duration of the track |
|
231 * @param aDuration The new duration of the track |
|
232 */ |
|
233 void SmfTrackInfo::setDuration( const QTime &aDuration ) |
|
234 { |
|
235 d->m_duration = aDuration; |
|
236 } |
|
237 |
|
238 /** |
|
239 * Method to set the id of the track |
|
240 * @param aId The ID value |
|
241 */ |
|
242 void SmfTrackInfo::setId( const QString &aId ) |
|
243 { |
|
244 d->m_trackId = aId; |
|
245 } |
|
246 |
|
247 |
|
248 /** |
|
249 * Method for Externalization. Writes the SmfTrackInfo object to |
|
250 * the stream and returns a reference to the stream. |
|
251 * @param aDataStream Stream to be written |
|
252 * @param aTrackInfo The SmfTrackInfo object to be externalized |
|
253 * @return reference to the written stream |
|
254 */ |
|
255 QDataStream &operator<<( QDataStream &aDataStream, |
|
256 const SmfTrackInfo &aTrackInfo ) |
|
257 { |
|
258 // Serialize d->m_trackId |
|
259 aDataStream<<aTrackInfo.d->m_trackId; |
|
260 |
|
261 // Serialize d->m_title |
|
262 aDataStream<<aTrackInfo.d->m_title; |
|
263 |
|
264 // Serialize d->m_album |
|
265 aDataStream<<aTrackInfo.d->m_album; |
|
266 |
|
267 // Serialize d->m_artists |
|
268 aDataStream<<aTrackInfo.d->m_artists; |
|
269 |
|
270 // Serialize d->m_genre |
|
271 aDataStream<<aTrackInfo.d->m_genre; |
|
272 |
|
273 // Serialize d->m_tags |
|
274 aDataStream<<aTrackInfo.d->m_tags; |
|
275 |
|
276 // Serialize d->m_year |
|
277 aDataStream<<aTrackInfo.d->m_year; |
|
278 |
|
279 // Serialize d->m_rating |
|
280 aDataStream<<aTrackInfo.d->m_rating; |
|
281 |
|
282 // Serialize d->m_comments |
|
283 aDataStream<<aTrackInfo.d->m_comments; |
|
284 |
|
285 // Serialize d->m_duration |
|
286 aDataStream<<aTrackInfo.d->m_duration; |
|
287 |
|
288 return aDataStream; |
|
289 } |
|
290 |
|
291 /** |
|
292 * Method for Internalization. Reads a SmfTrackInfo object from |
|
293 * the stream and returns a reference to the stream. |
|
294 * @param aDataStream Stream to be read |
|
295 * @param aTrackInfo The SmfTrackInfo object to be internalized |
|
296 * @return reference to the stream |
|
297 */ |
|
298 QDataStream &operator>>( QDataStream &aDataStream, |
|
299 SmfTrackInfo &aTrackInfo) |
|
300 { |
|
301 // Deserialize d->m_trackId |
|
302 aDataStream>>aTrackInfo.d->m_trackId; |
|
303 |
|
304 // Deserialize d->m_title |
|
305 aDataStream>>aTrackInfo.d->m_title; |
|
306 |
|
307 // Deserialize d->m_album |
|
308 aDataStream>>aTrackInfo.d->m_album; |
|
309 |
|
310 // Deserialize d->m_artists |
|
311 aDataStream>>aTrackInfo.d->m_artists; |
|
312 |
|
313 // Deserialize d->m_genre |
|
314 aDataStream>>aTrackInfo.d->m_genre; |
|
315 |
|
316 // Deserialize d->m_tags |
|
317 aDataStream>>aTrackInfo.d->m_tags; |
|
318 |
|
319 // Deserialize d->m_year |
|
320 aDataStream>>aTrackInfo.d->m_year; |
|
321 |
|
322 // Deserialize d->m_rating |
|
323 aDataStream>>aTrackInfo.d->m_rating; |
|
324 |
|
325 // Deserialize d->m_comments |
|
326 aDataStream>>aTrackInfo.d->m_comments; |
|
327 |
|
328 // Deserialize d->m_duration |
|
329 aDataStream>>aTrackInfo.d->m_duration; |
|
330 |
|
331 return aDataStream; |
|
332 } |
|
333 |