smf/smfservermodule/smfclient/common/smfpicturealbum.cpp
changeset 14 a469c0e6e7fb
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
       
     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 album data as QImage
       
   134  * @return The album as QImage
       
   135  */
       
   136 qint32 SmfPictureAlbum::pictureCount( ) const
       
   137 	{
       
   138 	return d->m_picCount;
       
   139 	}
       
   140 	
       
   141 /**
       
   142  * Method to get the id of the album
       
   143  * @return The ID value 
       
   144  */
       
   145 QString SmfPictureAlbum::id( ) const
       
   146 	{
       
   147 	return d->m_albumId;
       
   148 	}
       
   149 
       
   150 
       
   151 /**
       
   152  * Method to set a album title
       
   153  * @param aTitle The title of the album
       
   154  */
       
   155 void SmfPictureAlbum::setTitle( const QString &aTitle )
       
   156 	{
       
   157 	d->m_title = aTitle;
       
   158 	}
       
   159 
       
   160 /**
       
   161  * Method to set a album description
       
   162  * @param aDescription The description of the album
       
   163  */
       
   164 void SmfPictureAlbum::setDescription( const QString &aDescription )
       
   165 	{
       
   166 	d->m_description = aDescription;
       
   167 	}
       
   168 
       
   169 /**
       
   170  * Method to set a visibility of a album for public
       
   171  * @param aVisibility aVisibility The visibility mode of 
       
   172  * this album for others
       
   173  */
       
   174 void SmfPictureAlbum::setVisibility( const SmfPictureVisibility &aVisibility )
       
   175 	{
       
   176 	d->m_albumVisibility = aVisibility;
       
   177 	}
       
   178 
       
   179 /**
       
   180  * Method to set the date of posting the album
       
   181  * @param aDate The post date of the album
       
   182  */
       
   183 void SmfPictureAlbum::setPostedDate( const QDateTime &aDate )
       
   184 	{
       
   185 	d->m_postedOn = aDate;
       
   186 	}
       
   187 
       
   188 /**
       
   189  * Method to add comment on the album
       
   190  * @param aComment The comment for the album
       
   191  */
       
   192 void SmfPictureAlbum::addComment( const SmfComment &aComment )
       
   193 	{
       
   194 	d->m_comments.append(aComment);
       
   195 	}
       
   196 
       
   197 /**
       
   198  * Method to add tags for the album
       
   199  * @param aTag The tag for the album
       
   200  */
       
   201 void SmfPictureAlbum::addKeywords(const QStringList &aKeywords )
       
   202 	{
       
   203 	d->m_keywords = aKeywords;
       
   204 	}
       
   205 
       
   206 /**
       
   207  * Method to set the url of the album
       
   208  * @param aUrl The url of the album
       
   209  */
       
   210 void SmfPictureAlbum::setUrl( const QUrl &aUrl )
       
   211 	{
       
   212 	d->m_url = aUrl;
       
   213 	}
       
   214 
       
   215 /**
       
   216  * Method to set the album data as QImage
       
   217  * @param aData The album as QImage
       
   218  */
       
   219 void SmfPictureAlbum::setThumbnail( const QImage &aData )
       
   220 	{
       
   221 	d->m_thumbnail = aData;
       
   222 	}
       
   223 
       
   224 /**
       
   225  * Method to set the id of the album
       
   226  * @param aId The ID value 
       
   227  */
       
   228 void SmfPictureAlbum::setId( const QString &aId )
       
   229 	{
       
   230 	d->m_albumId = aId;
       
   231 	}
       
   232 
       
   233 
       
   234 /**
       
   235  * Method for Externalization. Writes the SmfPictureAlbum object to 
       
   236  * the stream and returns a reference to the stream.
       
   237  * @param aDataStream Stream to be written
       
   238  * @param aPic The SmfPictureAlbum object to be externalized
       
   239  * @return reference to the written stream
       
   240  */
       
   241 QDataStream& operator<<( QDataStream &aDataStream, 
       
   242 		const SmfPictureAlbum &aAlbm )
       
   243 	{
       
   244 	//serialize d->m_albumId;
       
   245 	aDataStream << aAlbm.d->m_albumId;
       
   246 
       
   247 	//serialize d->m_title;
       
   248 	aDataStream << aAlbm.d->m_title;
       
   249 
       
   250 	//serialize d->m_description;
       
   251 	aDataStream << aAlbm.d->m_description;
       
   252 
       
   253 	//serialize d->m_albumVisibility;
       
   254 	quint32 val = aAlbm.d->m_albumVisibility;
       
   255 	aDataStream << val;
       
   256 
       
   257 	//serialize d->m_postedOn;
       
   258 	aDataStream << aAlbm.d->m_postedOn;
       
   259 
       
   260 	//serialize d->m_comments;
       
   261 	aDataStream << aAlbm.d->m_comments;
       
   262 
       
   263 	//serialize d->m_keywords;
       
   264 	aDataStream << aAlbm.d->m_keywords;
       
   265 
       
   266 	//serialize d->m_url;
       
   267 	aDataStream << aAlbm.d->m_url;
       
   268 
       
   269 	//serialize d->m_picCount;
       
   270 	aDataStream << aAlbm.d->m_picCount;
       
   271 
       
   272 	//serialize d->m_thumbnail ;	
       
   273 	aDataStream << aAlbm.d->m_thumbnail ;	
       
   274 
       
   275 
       
   276 	
       
   277 	return aDataStream;
       
   278 	}
       
   279 
       
   280 /**
       
   281  * Method for Internalization. Reads a SmfPictureAlbum object from 
       
   282  * the stream and returns a reference to the stream.
       
   283  * @param aDataStream Stream to be read
       
   284  * @param aPic The SmfPictureAlbum object to be internalized
       
   285  * @return reference to the stream
       
   286  */
       
   287 QDataStream& operator>>( QDataStream &aDataStream, 
       
   288 		SmfPictureAlbum &aAlbm)
       
   289 	{
       
   290 	//deserialize d->m_albumId;
       
   291 	aDataStream >> aAlbm.d->m_albumId;
       
   292 
       
   293 	//deserialize d->m_title;
       
   294 	aDataStream >> aAlbm.d->m_title;
       
   295 
       
   296 	//deserialize d->m_description;
       
   297 	aDataStream >> aAlbm.d->m_description;
       
   298 
       
   299 	//deserialize d->m_albumVisibility;
       
   300 	quint32 val =  0;
       
   301 	aDataStream >>val;
       
   302 	aAlbm.d->m_albumVisibility = (SmfPictureVisibility)val;
       
   303 
       
   304 	//deserialize d->m_postedOn;
       
   305 	aDataStream >> aAlbm.d->m_postedOn;
       
   306 
       
   307 	//deserialize d->m_comments;
       
   308 	aDataStream >> aAlbm.d->m_comments;
       
   309 
       
   310 	//deserialize d->m_keywords;
       
   311 	aDataStream >> aAlbm.d->m_keywords;
       
   312 
       
   313 	//deserialize d->m_url;
       
   314 	aDataStream >> aAlbm.d->m_url;
       
   315 
       
   316 	//deserialize d->m_picCount;
       
   317 	aDataStream >> aAlbm.d->m_picCount;
       
   318 
       
   319 	//deserialize d->m_thumbnail ;	
       
   320 	aDataStream >> aAlbm.d->m_thumbnail ;	
       
   321 
       
   322 	return aDataStream;
       
   323 	}