smf/smfservermodule/smfcommon/smfalbum.cpp
changeset 25 a180113055cb
parent 18 013a02bf2bb0
--- a/smf/smfservermodule/smfcommon/smfalbum.cpp	Thu Sep 23 17:20:22 2010 +0530
+++ b/smf/smfservermodule/smfcommon/smfalbum.cpp	Thu Sep 23 17:43:31 2010 +0530
@@ -13,7 +13,7 @@
  * Manasij Roy, Nalina Hariharan
  * 
  * Description:
- * The SmfAlbum class represents a music album
+ * The SmfAlbum class represents an album
  *
  */
 
@@ -46,9 +46,13 @@
 SmfAlbum& SmfAlbum::operator=( const SmfAlbum &aOther )
 	{
 	d->m_name = aOther.d->m_name;
-	d->m_image = aOther.d->m_image;
+	d->m_imageUrl = aOther.d->m_imageUrl;
 	d->m_artists = aOther.d->m_artists;
+	d->m_location = aOther.d->m_location;
+	d->m_itemCount = aOther.d->m_itemCount;
+	d->m_type = aOther.d->m_type;
 	d->m_albumId = aOther.d->m_albumId;
+	d->m_secondaryId = aOther.d->m_secondaryId;
 	return *this;
 	}
 
@@ -69,12 +73,12 @@
 	}
 
 /**
- * Method to get the album's image
- * @return The album's image
+ * Method to get the album's image url if any
+ * @return The album's image url if any
  */
-QImage SmfAlbum::image( ) const
+QUrl SmfAlbum::imageUrl( ) const
 	{
-	return d->m_image;
+	return d->m_imageUrl;
 	}
 
 /**
@@ -87,6 +91,33 @@
 	}
 
 /**
+ * Method to get the location of this album
+ * @return The location of this album
+ */
+SmfLocation SmfAlbum::location( ) const
+	{
+	return d->m_location;
+	}
+
+/**
+ * Method to get the number of items in this album
+ * @return The number of items in this album
+ */
+int SmfAlbum::itemsCount( ) const
+	{
+	return d->m_itemCount;
+	}
+
+/**
+ * Method to get the type of this album
+ * @return The type of this album
+ */
+SmfAlbumMediaType SmfAlbum::type( ) const
+	{
+	return d->m_type;
+	}
+
+/**
  * Method to get the id of the album
  * @return The ID value 
  */
@@ -96,6 +127,16 @@
 	}
 
 /**
+ * Method to get the secondary id of the album, e.g. musicbrainz id of the album for a music album
+ * @return The ID value 
+ */
+QString SmfAlbum::secondaryId( ) const
+	{
+	return d->m_secondaryId;
+	}	
+
+
+/**
  * Method to set the album name
  * @param aName The album name
  */
@@ -105,12 +146,12 @@
 	}
 
 /**
- * Method to set the album's image
- * @param aImage The album's image
+ * Method to set the album's image url
+ * @param aUrl The album's image url
  */
-void SmfAlbum::setImage( const QImage &aImage )
+void SmfAlbum::setImageUrl( const QUrl &aUrl )
 	{
-	d->m_image = aImage;
+	d->m_imageUrl = aUrl;
 	}
 
 /**
@@ -123,6 +164,33 @@
 	}
 
 /**
+ * Method to set the location of this album
+ * @param aLoc The location of the album
+ */
+void SmfAlbum::setLocation(const SmfLocation &aLoc )
+	{
+	d->m_location = aLoc;
+	}
+
+/**
+ * Method to set the number of items in this album
+ * @param aCount the number of items in this album
+ */
+void SmfAlbum::setItemsCount( const int aCount )
+	{
+	d->m_itemCount = aCount;
+	}
+
+/**
+ * Method to set the type of this album
+ * @param aType the type of this album
+ */
+void SmfAlbum::setType(SmfAlbumMediaType aType)
+	{
+	d->m_type = aType;
+	}
+
+/**
  * Method to set the id of the album
  * @param aId The ID value 
  */
@@ -132,6 +200,16 @@
 	}
 
 /**
+ * Method to set the secondary id of the album, e.g. musicbrainz id of the album for a music album
+ * @param aSecondaryID the secondaryID of this album 
+ */
+void SmfAlbum::setSecondaryId( const QString &aSecondaryID )
+	{
+	d->m_secondaryId = aSecondaryID;
+	}
+
+
+/**
  * Method for Externalization. Writes the SmfAlbum object to 
  * the stream and returns a reference to the stream.
  * @param aDataStream Stream to be written
@@ -144,15 +222,27 @@
 	// Serialize d->m_name
 	aDataStream<<aAlbum.d->m_name;
 	
-	// Serialize d->m_image
-	aDataStream<<aAlbum.d->m_image;
+	// Serialize d->m_imageUrl
+	aDataStream<<aAlbum.d->m_imageUrl;
 	
 	// Serialize d->m_artists
 	aDataStream<<aAlbum.d->m_artists;
 	
+	// Serialize d->m_location
+	aDataStream<<aAlbum.d->m_location;
+	
+	// Serialize d->m_itemCount
+	aDataStream<<aAlbum.d->m_itemCount;
+	
+	// Serialize d->m_type
+	aDataStream<<aAlbum.d->m_type;
+	
 	// Serialize d->m_albumId
 	aDataStream<<aAlbum.d->m_albumId;
 	
+	// Serialize d->m_secondaryId
+	aDataStream<<aAlbum.d->m_secondaryId;
+	
 	return aDataStream;
 	}
 
@@ -169,14 +259,28 @@
 	// Deserialize d->m_name
 	aDataStream>>aAlbum.d->m_name;
 	
-	// Deserialize d->m_image
-	aDataStream>>aAlbum.d->m_image;
+	// Deserialize d->m_imageUrl
+	aDataStream>>aAlbum.d->m_imageUrl;
 	
 	// Deserialize d->m_artists
 	aDataStream>>aAlbum.d->m_artists;
 	
+	// Deserialize d->m_location
+	aDataStream>>aAlbum.d->m_location;
+	
+	// Deserialize d->m_itemCount
+	aDataStream>>aAlbum.d->m_itemCount;
+	
+	// Deserialize d->m_type
+	int val;
+	aDataStream>>val;
+	aAlbum.d->m_type = (SmfAlbumMediaType)val;
+	
 	// Deserialize d->m_albumId
 	aDataStream>>aAlbum.d->m_albumId;
 	
+	// Deserialize d->m_secondaryId
+	aDataStream>>aAlbum.d->m_secondaryId;
+	
 	return aDataStream;
 	}