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 album to contain a set pf pictures
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include <smfpicturealbum.h>
|
|
21 |
#include <smfpicturealbum_p.h>
|
|
22 |
|
|
23 |
/**
|
|
24 |
* Constructor with default argument
|
|
25 |
*/
|
|
26 |
SmfPictureAlbum::SmfPictureAlbum( )
|
|
27 |
{
|
|
28 |
d = new SmfPictureAlbumPrivate;
|
|
29 |
}
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Copy Constructor
|
|
33 |
* @param aOther The reference object
|
|
34 |
*/
|
|
35 |
SmfPictureAlbum::SmfPictureAlbum( const SmfPictureAlbum &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 |
SmfPictureAlbum& SmfPictureAlbum::operator=( const SmfPictureAlbum &aOther )
|
|
46 |
{
|
|
47 |
d->m_albumId = aOther.d->m_albumId;
|
|
48 |
d->m_title = aOther.d->m_title;
|
|
49 |
d->m_description = aOther.d->m_description;
|
|
50 |
d->m_albumVisibility = aOther.d->m_albumVisibility;
|
|
51 |
d->m_postedOn = aOther.d->m_postedOn;
|
|
52 |
d->m_comments = aOther.d->m_comments;
|
|
53 |
d->m_keywords = aOther.d->m_keywords;
|
|
54 |
d->m_url = aOther.d->m_url;
|
|
55 |
d->m_picCount =aOther.d->m_picCount;
|
|
56 |
d->m_thumbnail = aOther.d->m_thumbnail ;
|
|
57 |
return *this;
|
|
58 |
}
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor
|
|
62 |
*/
|
|
63 |
SmfPictureAlbum::~SmfPictureAlbum( )
|
|
64 |
{
|
|
65 |
|
|
66 |
}
|
|
67 |
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Method to get a album title
|
|
71 |
* @return The title of the album
|
|
72 |
*/
|
|
73 |
QString SmfPictureAlbum::title( ) const
|
|
74 |
{
|
|
75 |
return d->m_title;
|
|
76 |
}
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Method to get a album description
|
|
80 |
* @return The description of the album
|
|
81 |
*/
|
|
82 |
QString SmfPictureAlbum::description( ) const
|
|
83 |
{
|
|
84 |
return d->m_description;
|
|
85 |
}
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Method to get a visibility of a album for public
|
|
89 |
* @return The visibility mode of this album for others
|
|
90 |
*/
|
|
91 |
SmfPictureVisibility SmfPictureAlbum::visibility( ) const
|
|
92 |
{
|
|
93 |
return d->m_albumVisibility;
|
|
94 |
}
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Method to get the date of posting the album
|
|
98 |
* @return The posted date of the album
|
|
99 |
*/
|
|
100 |
QDateTime SmfPictureAlbum::postedDate( ) const
|
|
101 |
{
|
|
102 |
return d->m_postedOn;
|
|
103 |
}
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Method to get the comments for the album
|
|
107 |
* @return The comments for the album
|
|
108 |
*/
|
|
109 |
QList<SmfComment> SmfPictureAlbum::comments( ) const
|
|
110 |
{
|
|
111 |
return d->m_comments;
|
|
112 |
}
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Method to get the tags for the album
|
|
116 |
* @return The tags for the album
|
|
117 |
*/
|
|
118 |
QStringList SmfPictureAlbum::keywords( ) const
|
|
119 |
{
|
|
120 |
return d->m_keywords;
|
|
121 |
}
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Method to get the url of the album
|
|
125 |
* @return The url of the album
|
|
126 |
*/
|
|
127 |
QUrl SmfPictureAlbum::url( ) const
|
|
128 |
{
|
|
129 |
return d->m_url;
|
|
130 |
}
|
|
131 |
|
|
132 |
/**
|
|
133 |
* Method to get the thumbnail for this album as QImage
|
|
134 |
* @return The picture as QImage
|
|
135 |
*/
|
|
136 |
QImage SmfPictureAlbum::thumbnail( ) const
|
|
137 |
{
|
|
138 |
return d->m_thumbnail;
|
|
139 |
}
|
|
140 |
|
|
141 |
/**
|
|
142 |
* Method to get the album data as QImage
|
|
143 |
* @return The album as QImage
|
|
144 |
*/
|
|
145 |
qint32 SmfPictureAlbum::pictureCount( ) const
|
|
146 |
{
|
|
147 |
return d->m_picCount;
|
|
148 |
}
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Method to get the id of the album
|
|
152 |
* @return The ID value
|
|
153 |
*/
|
|
154 |
QString SmfPictureAlbum::id( ) const
|
|
155 |
{
|
|
156 |
return d->m_albumId;
|
|
157 |
}
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Method to set a album title
|
|
161 |
* @param aTitle The title of the album
|
|
162 |
*/
|
|
163 |
void SmfPictureAlbum::setTitle( const QString &aTitle )
|
|
164 |
{
|
|
165 |
d->m_title = aTitle;
|
|
166 |
}
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Method to set a album description
|
|
170 |
* @param aDescription The description of the album
|
|
171 |
*/
|
|
172 |
void SmfPictureAlbum::setDescription( const QString &aDescription )
|
|
173 |
{
|
|
174 |
d->m_description = aDescription;
|
|
175 |
}
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Method to set a visibility of a album for public
|
|
179 |
* @param aVisibility aVisibility The visibility mode of
|
|
180 |
* this album for others
|
|
181 |
*/
|
|
182 |
void SmfPictureAlbum::setVisibility( const SmfPictureVisibility &aVisibility )
|
|
183 |
{
|
|
184 |
d->m_albumVisibility = aVisibility;
|
|
185 |
}
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Method to set the date of posting the album
|
|
189 |
* @param aDate The post date of the album
|
|
190 |
*/
|
|
191 |
void SmfPictureAlbum::setPostedDate( const QDateTime &aDate )
|
|
192 |
{
|
|
193 |
d->m_postedOn = aDate;
|
|
194 |
}
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Method to add comment on the album
|
|
198 |
* @param aComment The comment for the album
|
|
199 |
*/
|
|
200 |
void SmfPictureAlbum::addComment( const SmfComment &aComment )
|
|
201 |
{
|
|
202 |
d->m_comments.append(aComment);
|
|
203 |
}
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Method to add tags for the album
|
|
207 |
* @param aTag The tag for the album
|
|
208 |
*/
|
|
209 |
void SmfPictureAlbum::addKeywords(const QStringList &aKeywords )
|
|
210 |
{
|
|
211 |
d->m_keywords = aKeywords;
|
|
212 |
}
|
|
213 |
|
|
214 |
/**
|
|
215 |
* Method to set the url of the album
|
|
216 |
* @param aUrl The url of the album
|
|
217 |
*/
|
|
218 |
void SmfPictureAlbum::setUrl( const QUrl &aUrl )
|
|
219 |
{
|
|
220 |
d->m_url = aUrl;
|
|
221 |
}
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Method to set the album data as QImage
|
|
225 |
* @param aData The album as QImage
|
|
226 |
*/
|
|
227 |
void SmfPictureAlbum::setThumbnail( const QImage &aData )
|
|
228 |
{
|
|
229 |
d->m_thumbnail = aData;
|
|
230 |
}
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Method to get the number of pictures in this album
|
|
234 |
* @return number of pictures in this album
|
|
235 |
*/
|
|
236 |
void SmfPictureAlbum::setPictureCount( const qint32 aCount)
|
|
237 |
{
|
|
238 |
d->m_picCount = aCount;
|
|
239 |
}
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Method to set the id of the album
|
|
243 |
* @param aId The ID value
|
|
244 |
*/
|
|
245 |
void SmfPictureAlbum::setId( const QString &aId )
|
|
246 |
{
|
|
247 |
d->m_albumId = aId;
|
|
248 |
}
|
|
249 |
|
|
250 |
|
|
251 |
/**
|
|
252 |
* Method for Externalization. Writes the SmfPictureAlbum object to
|
|
253 |
* the stream and returns a reference to the stream.
|
|
254 |
* @param aDataStream Stream to be written
|
|
255 |
* @param aPic The SmfPictureAlbum object to be externalized
|
|
256 |
* @return reference to the written stream
|
|
257 |
*/
|
|
258 |
QDataStream& operator<<( QDataStream &aDataStream,
|
|
259 |
const SmfPictureAlbum &aAlbm )
|
|
260 |
{
|
|
261 |
//serialize d->m_albumId;
|
|
262 |
aDataStream << aAlbm.d->m_albumId;
|
|
263 |
|
|
264 |
//serialize d->m_title;
|
|
265 |
aDataStream << aAlbm.d->m_title;
|
|
266 |
|
|
267 |
//serialize d->m_description;
|
|
268 |
aDataStream << aAlbm.d->m_description;
|
|
269 |
|
|
270 |
//serialize d->m_albumVisibility;
|
|
271 |
quint32 val = aAlbm.d->m_albumVisibility;
|
|
272 |
aDataStream << val;
|
|
273 |
|
|
274 |
//serialize d->m_postedOn;
|
|
275 |
aDataStream << aAlbm.d->m_postedOn;
|
|
276 |
|
|
277 |
//serialize d->m_comments;
|
|
278 |
aDataStream << aAlbm.d->m_comments;
|
|
279 |
|
|
280 |
//serialize d->m_keywords;
|
|
281 |
aDataStream << aAlbm.d->m_keywords;
|
|
282 |
|
|
283 |
//serialize d->m_url;
|
|
284 |
aDataStream << aAlbm.d->m_url;
|
|
285 |
|
|
286 |
//serialize d->m_picCount;
|
|
287 |
aDataStream << aAlbm.d->m_picCount;
|
|
288 |
|
|
289 |
//serialize d->m_thumbnail ;
|
|
290 |
aDataStream << aAlbm.d->m_thumbnail ;
|
|
291 |
|
|
292 |
return aDataStream;
|
|
293 |
}
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Method for Internalization. Reads a SmfPictureAlbum object from
|
|
297 |
* the stream and returns a reference to the stream.
|
|
298 |
* @param aDataStream Stream to be read
|
|
299 |
* @param aPic The SmfPictureAlbum object to be internalized
|
|
300 |
* @return reference to the stream
|
|
301 |
*/
|
|
302 |
QDataStream& operator>>( QDataStream &aDataStream,
|
|
303 |
SmfPictureAlbum &aAlbm)
|
|
304 |
{
|
|
305 |
//deserialize d->m_albumId;
|
|
306 |
aDataStream >> aAlbm.d->m_albumId;
|
|
307 |
|
|
308 |
//deserialize d->m_title;
|
|
309 |
aDataStream >> aAlbm.d->m_title;
|
|
310 |
|
|
311 |
//deserialize d->m_description;
|
|
312 |
aDataStream >> aAlbm.d->m_description;
|
|
313 |
|
|
314 |
//deserialize d->m_albumVisibility;
|
|
315 |
quint32 val = 0;
|
|
316 |
aDataStream >>val;
|
|
317 |
aAlbm.d->m_albumVisibility = (SmfPictureVisibility)val;
|
|
318 |
|
|
319 |
//deserialize d->m_postedOn;
|
|
320 |
aDataStream >> aAlbm.d->m_postedOn;
|
|
321 |
|
|
322 |
//deserialize d->m_comments;
|
|
323 |
aDataStream >> aAlbm.d->m_comments;
|
|
324 |
|
|
325 |
//deserialize d->m_keywords;
|
|
326 |
aDataStream >> aAlbm.d->m_keywords;
|
|
327 |
|
|
328 |
//deserialize d->m_url;
|
|
329 |
aDataStream >> aAlbm.d->m_url;
|
|
330 |
|
|
331 |
//deserialize d->m_picCount;
|
|
332 |
aDataStream >> aAlbm.d->m_picCount;
|
|
333 |
|
|
334 |
//deserialize d->m_thumbnail ;
|
|
335 |
aDataStream >> aAlbm.d->m_thumbnail ;
|
|
336 |
|
|
337 |
return aDataStream;
|
|
338 |
}
|