18
|
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:
|
25
|
16 |
* The SmfAlbum class represents an album
|
18
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include <smfalbum.h>
|
|
21 |
#include <smfalbum_p.h>
|
|
22 |
|
|
23 |
|
|
24 |
/**
|
|
25 |
* Constructor with default argument
|
|
26 |
*/
|
|
27 |
SmfAlbum::SmfAlbum( )
|
|
28 |
{
|
|
29 |
d = new SmfAlbumPrivate;
|
|
30 |
}
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Copy Constructor
|
|
34 |
* @param aOther The reference object
|
|
35 |
*/
|
|
36 |
SmfAlbum::SmfAlbum( const SmfAlbum &aOther )
|
|
37 |
: d( aOther.d )
|
|
38 |
{
|
|
39 |
}
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Overloaded = operator
|
|
43 |
* @param aOther The reference object
|
|
44 |
* @return The target reference value
|
|
45 |
*/
|
|
46 |
SmfAlbum& SmfAlbum::operator=( const SmfAlbum &aOther )
|
|
47 |
{
|
|
48 |
d->m_name = aOther.d->m_name;
|
25
|
49 |
d->m_imageUrl = aOther.d->m_imageUrl;
|
18
|
50 |
d->m_artists = aOther.d->m_artists;
|
25
|
51 |
d->m_location = aOther.d->m_location;
|
|
52 |
d->m_itemCount = aOther.d->m_itemCount;
|
|
53 |
d->m_type = aOther.d->m_type;
|
18
|
54 |
d->m_albumId = aOther.d->m_albumId;
|
25
|
55 |
d->m_secondaryId = aOther.d->m_secondaryId;
|
18
|
56 |
return *this;
|
|
57 |
}
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Destructor
|
|
61 |
*/
|
|
62 |
SmfAlbum::~SmfAlbum( )
|
|
63 |
{
|
|
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Method to get the album name
|
|
68 |
* @return The album name
|
|
69 |
*/
|
|
70 |
QString SmfAlbum::name( ) const
|
|
71 |
{
|
|
72 |
return d->m_name;
|
|
73 |
}
|
|
74 |
|
|
75 |
/**
|
25
|
76 |
* Method to get the album's image url if any
|
|
77 |
* @return The album's image url if any
|
18
|
78 |
*/
|
25
|
79 |
QUrl SmfAlbum::imageUrl( ) const
|
18
|
80 |
{
|
25
|
81 |
return d->m_imageUrl;
|
18
|
82 |
}
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Method to get the artist names
|
|
86 |
* @return The list of artists in the album
|
|
87 |
*/
|
|
88 |
SmfArtists SmfAlbum::artists( ) const
|
|
89 |
{
|
|
90 |
return d->m_artists;
|
|
91 |
}
|
|
92 |
|
|
93 |
/**
|
25
|
94 |
* Method to get the location of this album
|
|
95 |
* @return The location of this album
|
|
96 |
*/
|
|
97 |
SmfLocation SmfAlbum::location( ) const
|
|
98 |
{
|
|
99 |
return d->m_location;
|
|
100 |
}
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Method to get the number of items in this album
|
|
104 |
* @return The number of items in this album
|
|
105 |
*/
|
|
106 |
int SmfAlbum::itemsCount( ) const
|
|
107 |
{
|
|
108 |
return d->m_itemCount;
|
|
109 |
}
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Method to get the type of this album
|
|
113 |
* @return The type of this album
|
|
114 |
*/
|
|
115 |
SmfAlbumMediaType SmfAlbum::type( ) const
|
|
116 |
{
|
|
117 |
return d->m_type;
|
|
118 |
}
|
|
119 |
|
|
120 |
/**
|
18
|
121 |
* Method to get the id of the album
|
|
122 |
* @return The ID value
|
|
123 |
*/
|
|
124 |
QString SmfAlbum::id( ) const
|
|
125 |
{
|
|
126 |
return d->m_albumId;
|
|
127 |
}
|
|
128 |
|
|
129 |
/**
|
25
|
130 |
* Method to get the secondary id of the album, e.g. musicbrainz id of the album for a music album
|
|
131 |
* @return The ID value
|
|
132 |
*/
|
|
133 |
QString SmfAlbum::secondaryId( ) const
|
|
134 |
{
|
|
135 |
return d->m_secondaryId;
|
|
136 |
}
|
|
137 |
|
|
138 |
|
|
139 |
/**
|
18
|
140 |
* Method to set the album name
|
|
141 |
* @param aName The album name
|
|
142 |
*/
|
|
143 |
void SmfAlbum::setName( const QString &aName )
|
|
144 |
{
|
|
145 |
d->m_name = aName;
|
|
146 |
}
|
|
147 |
|
|
148 |
/**
|
25
|
149 |
* Method to set the album's image url
|
|
150 |
* @param aUrl The album's image url
|
18
|
151 |
*/
|
25
|
152 |
void SmfAlbum::setImageUrl( const QUrl &aUrl )
|
18
|
153 |
{
|
25
|
154 |
d->m_imageUrl = aUrl;
|
18
|
155 |
}
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Method to set the artist names
|
|
159 |
* @param aArtists The list of artists in the album
|
|
160 |
*/
|
|
161 |
void SmfAlbum::setArtists( const SmfArtists &aArtists )
|
|
162 |
{
|
|
163 |
d->m_artists = aArtists;
|
|
164 |
}
|
|
165 |
|
|
166 |
/**
|
25
|
167 |
* Method to set the location of this album
|
|
168 |
* @param aLoc The location of the album
|
|
169 |
*/
|
|
170 |
void SmfAlbum::setLocation(const SmfLocation &aLoc )
|
|
171 |
{
|
|
172 |
d->m_location = aLoc;
|
|
173 |
}
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Method to set the number of items in this album
|
|
177 |
* @param aCount the number of items in this album
|
|
178 |
*/
|
|
179 |
void SmfAlbum::setItemsCount( const int aCount )
|
|
180 |
{
|
|
181 |
d->m_itemCount = aCount;
|
|
182 |
}
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Method to set the type of this album
|
|
186 |
* @param aType the type of this album
|
|
187 |
*/
|
|
188 |
void SmfAlbum::setType(SmfAlbumMediaType aType)
|
|
189 |
{
|
|
190 |
d->m_type = aType;
|
|
191 |
}
|
|
192 |
|
|
193 |
/**
|
18
|
194 |
* Method to set the id of the album
|
|
195 |
* @param aId The ID value
|
|
196 |
*/
|
|
197 |
void SmfAlbum::setId( const QString &aId )
|
|
198 |
{
|
|
199 |
d->m_albumId = aId;
|
|
200 |
}
|
|
201 |
|
|
202 |
/**
|
25
|
203 |
* Method to set the secondary id of the album, e.g. musicbrainz id of the album for a music album
|
|
204 |
* @param aSecondaryID the secondaryID of this album
|
|
205 |
*/
|
|
206 |
void SmfAlbum::setSecondaryId( const QString &aSecondaryID )
|
|
207 |
{
|
|
208 |
d->m_secondaryId = aSecondaryID;
|
|
209 |
}
|
|
210 |
|
|
211 |
|
|
212 |
/**
|
18
|
213 |
* Method for Externalization. Writes the SmfAlbum object to
|
|
214 |
* the stream and returns a reference to the stream.
|
|
215 |
* @param aDataStream Stream to be written
|
|
216 |
* @param aAlbum The SmfAlbum object to be externalized
|
|
217 |
* @return reference to the written stream
|
|
218 |
*/
|
|
219 |
QDataStream &operator<<( QDataStream &aDataStream,
|
|
220 |
const SmfAlbum &aAlbum )
|
|
221 |
{
|
|
222 |
// Serialize d->m_name
|
|
223 |
aDataStream<<aAlbum.d->m_name;
|
|
224 |
|
25
|
225 |
// Serialize d->m_imageUrl
|
|
226 |
aDataStream<<aAlbum.d->m_imageUrl;
|
18
|
227 |
|
|
228 |
// Serialize d->m_artists
|
|
229 |
aDataStream<<aAlbum.d->m_artists;
|
|
230 |
|
25
|
231 |
// Serialize d->m_location
|
|
232 |
aDataStream<<aAlbum.d->m_location;
|
|
233 |
|
|
234 |
// Serialize d->m_itemCount
|
|
235 |
aDataStream<<aAlbum.d->m_itemCount;
|
|
236 |
|
|
237 |
// Serialize d->m_type
|
|
238 |
aDataStream<<aAlbum.d->m_type;
|
|
239 |
|
18
|
240 |
// Serialize d->m_albumId
|
|
241 |
aDataStream<<aAlbum.d->m_albumId;
|
|
242 |
|
25
|
243 |
// Serialize d->m_secondaryId
|
|
244 |
aDataStream<<aAlbum.d->m_secondaryId;
|
|
245 |
|
18
|
246 |
return aDataStream;
|
|
247 |
}
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Method for Internalization. Reads a SmfAlbum object from
|
|
251 |
* the stream and returns a reference to the stream.
|
|
252 |
* @param aDataStream Stream to be read
|
|
253 |
* @param aAlbum The SmfAlbum object to be internalized
|
|
254 |
* @return reference to the stream
|
|
255 |
*/
|
|
256 |
QDataStream &operator>>( QDataStream &aDataStream,
|
|
257 |
SmfAlbum &aAlbum)
|
|
258 |
{
|
|
259 |
// Deserialize d->m_name
|
|
260 |
aDataStream>>aAlbum.d->m_name;
|
|
261 |
|
25
|
262 |
// Deserialize d->m_imageUrl
|
|
263 |
aDataStream>>aAlbum.d->m_imageUrl;
|
18
|
264 |
|
|
265 |
// Deserialize d->m_artists
|
|
266 |
aDataStream>>aAlbum.d->m_artists;
|
|
267 |
|
25
|
268 |
// Deserialize d->m_location
|
|
269 |
aDataStream>>aAlbum.d->m_location;
|
|
270 |
|
|
271 |
// Deserialize d->m_itemCount
|
|
272 |
aDataStream>>aAlbum.d->m_itemCount;
|
|
273 |
|
|
274 |
// Deserialize d->m_type
|
|
275 |
int val;
|
|
276 |
aDataStream>>val;
|
|
277 |
aAlbum.d->m_type = (SmfAlbumMediaType)val;
|
|
278 |
|
18
|
279 |
// Deserialize d->m_albumId
|
|
280 |
aDataStream>>aAlbum.d->m_albumId;
|
|
281 |
|
25
|
282 |
// Deserialize d->m_secondaryId
|
|
283 |
aDataStream>>aAlbum.d->m_secondaryId;
|
|
284 |
|
18
|
285 |
return aDataStream;
|
|
286 |
}
|