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:
|
|
16 |
* The SmfAlbum class represents a music album
|
|
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;
|
|
49 |
d->m_image = aOther.d->m_image;
|
|
50 |
d->m_artists = aOther.d->m_artists;
|
|
51 |
d->m_albumId = aOther.d->m_albumId;
|
|
52 |
return *this;
|
|
53 |
}
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Destructor
|
|
57 |
*/
|
|
58 |
SmfAlbum::~SmfAlbum( )
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Method to get the album name
|
|
64 |
* @return The album name
|
|
65 |
*/
|
|
66 |
QString SmfAlbum::name( ) const
|
|
67 |
{
|
|
68 |
return d->m_name;
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Method to get the album's image
|
|
73 |
* @return The album's image
|
|
74 |
*/
|
|
75 |
QImage SmfAlbum::image( ) const
|
|
76 |
{
|
|
77 |
return d->m_image;
|
|
78 |
}
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Method to get the artist names
|
|
82 |
* @return The list of artists in the album
|
|
83 |
*/
|
|
84 |
SmfArtists SmfAlbum::artists( ) const
|
|
85 |
{
|
|
86 |
return d->m_artists;
|
|
87 |
}
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Method to get the id of the album
|
|
91 |
* @return The ID value
|
|
92 |
*/
|
|
93 |
QString SmfAlbum::id( ) const
|
|
94 |
{
|
|
95 |
return d->m_albumId;
|
|
96 |
}
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Method to set the album name
|
|
100 |
* @param aName The album name
|
|
101 |
*/
|
|
102 |
void SmfAlbum::setName( const QString &aName )
|
|
103 |
{
|
|
104 |
d->m_name = aName;
|
|
105 |
}
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Method to set the album's image
|
|
109 |
* @param aImage The album's image
|
|
110 |
*/
|
|
111 |
void SmfAlbum::setImage( const QImage &aImage )
|
|
112 |
{
|
|
113 |
d->m_image = aImage;
|
|
114 |
}
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Method to set the artist names
|
|
118 |
* @param aArtists The list of artists in the album
|
|
119 |
*/
|
|
120 |
void SmfAlbum::setArtists( const SmfArtists &aArtists )
|
|
121 |
{
|
|
122 |
d->m_artists = aArtists;
|
|
123 |
}
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Method to set the id of the album
|
|
127 |
* @param aId The ID value
|
|
128 |
*/
|
|
129 |
void SmfAlbum::setId( const QString &aId )
|
|
130 |
{
|
|
131 |
d->m_albumId = aId;
|
|
132 |
}
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Method for Externalization. Writes the SmfAlbum object to
|
|
136 |
* the stream and returns a reference to the stream.
|
|
137 |
* @param aDataStream Stream to be written
|
|
138 |
* @param aAlbum The SmfAlbum object to be externalized
|
|
139 |
* @return reference to the written stream
|
|
140 |
*/
|
|
141 |
QDataStream &operator<<( QDataStream &aDataStream,
|
|
142 |
const SmfAlbum &aAlbum )
|
|
143 |
{
|
|
144 |
// Serialize d->m_name
|
|
145 |
aDataStream<<aAlbum.d->m_name;
|
|
146 |
|
|
147 |
// Serialize d->m_image
|
|
148 |
aDataStream<<aAlbum.d->m_image;
|
|
149 |
|
|
150 |
// Serialize d->m_artists
|
|
151 |
aDataStream<<aAlbum.d->m_artists;
|
|
152 |
|
|
153 |
// Serialize d->m_albumId
|
|
154 |
aDataStream<<aAlbum.d->m_albumId;
|
|
155 |
|
|
156 |
return aDataStream;
|
|
157 |
}
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Method for Internalization. Reads a SmfAlbum object from
|
|
161 |
* the stream and returns a reference to the stream.
|
|
162 |
* @param aDataStream Stream to be read
|
|
163 |
* @param aAlbum The SmfAlbum object to be internalized
|
|
164 |
* @return reference to the stream
|
|
165 |
*/
|
|
166 |
QDataStream &operator>>( QDataStream &aDataStream,
|
|
167 |
SmfAlbum &aAlbum)
|
|
168 |
{
|
|
169 |
// Deserialize d->m_name
|
|
170 |
aDataStream>>aAlbum.d->m_name;
|
|
171 |
|
|
172 |
// Deserialize d->m_image
|
|
173 |
aDataStream>>aAlbum.d->m_image;
|
|
174 |
|
|
175 |
// Deserialize d->m_artists
|
|
176 |
aDataStream>>aAlbum.d->m_artists;
|
|
177 |
|
|
178 |
// Deserialize d->m_albumId
|
|
179 |
aDataStream>>aAlbum.d->m_albumId;
|
|
180 |
|
|
181 |
return aDataStream;
|
|
182 |
}
|