example/clientapi/smf/inc/common/smfpictures/smfpicture.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
equal deleted inserted replaced
1:4b1e636e8a71 2:86af6c333601
     1 /**
     1 /**
     2  * @file	smfpicture.h
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
     3  * @author  Nalina Hariharan, Sasken Communication Technologies Ltd - Initial contribution
     3  * All rights reserved.
     4  * @version 1.0
     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"
     5  *
     8  *
     6  * @section LICENSE
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
     7  *
    11  *
     8  * Copyright (c) 2010 Sasken Communication Technologies Ltd. 
    12  * Contributors:
     9  * All rights reserved.
    13  * Manasij Roy, Nalina Hariharan
    10  * This component and the accompanying materials are made available 
       
    11  * under the terms of the "{License}" 
       
    12  * which accompanies  this distribution, and is available 
       
    13  * at the URL "{LicenseUrl}".
       
    14  * 
    14  * 
    15  * @section DESCRIPTION
    15  * Description:
       
    16  * The picture class represents an instance of a picture
    16  *
    17  *
    17  * The picture class represents an instance of a picture
       
    18  */
    18  */
    19 
    19 
    20 #ifndef SMFPICTURE_H_
    20 #ifndef SMFPICTURE_H_
    21 #define SMFPICTURE_H_
    21 #define SMFPICTURE_H_
    22 
    22 
    23 #include <QDateTime>
    23 #include <QDateTime>
    24 #include <QStringList>
    24 #include <QStringList>
    25 #include <QUrl>
    25 #include <QUrl>
    26 #include <qdatastream.h>
    26 #include <qdatastream.h>
    27 #include "SmfClientGlobal.h"
    27 #include <QSharedData>
       
    28 #include <smfclientglobal.h>
       
    29 
       
    30 class SmfPicturePrivate;
       
    31 
    28 /**
    32 /**
    29  * SmfPictureVisibility enumeration
    33  * SmfPictureVisibility enumeration
    30  */
    34  */
    31 enum SmfPictureVisibility
    35 enum SmfPictureVisibility
    32 	{
    36 	{
    34 	SMFVisibilityPersonal,
    38 	SMFVisibilityPersonal,
    35 	SMFVisibilityFamily,
    39 	SMFVisibilityFamily,
    36 	SMFVisibilityGroup,
    40 	SMFVisibilityGroup,
    37 	SMFVisibilityPublic
    41 	SMFVisibilityPublic
    38 	};
    42 	};
    39 /**
    43 
       
    44 /**
       
    45  * @ingroup smf_common_group
    40  * The picture class represents an instance of a picture
    46  * The picture class represents an instance of a picture
    41  */
    47  */
    42 class SMFCLIENT_EXPORT SmfPicture : public QObject
    48 class SMFCLIENT_EXPORT SmfPicture : public QObject
    43 	{
    49 	{
    44 	Q_OBJECT
    50 	Q_OBJECT
    48 	 * @param aParent The parent object
    54 	 * @param aParent The parent object
    49 	 */
    55 	 */
    50 	SmfPicture( QObject *aParent = 0 );
    56 	SmfPicture( QObject *aParent = 0 );
    51 	
    57 	
    52 	/**
    58 	/**
       
    59 	 * Copy Constructor
       
    60 	 * @param aOther The reference object
       
    61 	 */
       
    62 	SmfPicture( const SmfPicture &aOther );
       
    63 	
       
    64 	/**
       
    65 	 * CConstructs SmfPicture from QImage
       
    66 	 * @param aOther The QImage
       
    67 	 */
       
    68 	SmfPicture( const QImage &image );
       
    69 	
       
    70 	/**
    53 	 * Destructor
    71 	 * Destructor
    54 	 */
    72 	 */
    55 	~SmfPicture( );
    73 	~SmfPicture( );
    56 	
    74 	
    57 	
       
    58 	/**
    75 	/**
    59 	 * Method to get the id of the picture
    76 	 * Method to get the id of the picture
    60 	 * @param aId The ID value 
    77 	 * @return The ID value 
    61 	 */
    78 	 */
    62 	void getId( QString &aId );
    79 	QString id( ) const;
    63 	
    80 	
    64 	/**
    81 	/**
    65 	 * Method to get a picture owner
    82 	 * Method to get a picture owner
    66 	 * @param aOwner The owner of the picture
    83 	 * @return The owner of the picture
    67 	 */
    84 	 */
    68 	void getOwner( QString &aOwner );
    85 	QString owner( ) const;
    69 	
    86 	
    70 	/**
    87 	/**
    71 	 * Method to get a picture title
    88 	 * Method to get a picture title
    72 	 * @param aTitle The title of the picture
    89 	 * @return The title of the picture
    73 	 */
    90 	 */
    74 	void getTitle( QString &aTitle );
    91 	QString title( ) const;
    75 	
    92 	
    76 	/**
    93 	/**
    77 	 * Method to get a picture description
    94 	 * Method to get a picture description
    78 	 * @param aDescription The description of the picture
    95 	 * @return The description of the picture
    79 	 */
    96 	 */
    80 	void getDescription( QString &aDescription );
    97 	QString description( ) const;
    81 	
    98 	
    82 	/**
    99 	/**
    83 	 * Method to get a visibility of a picture for public
   100 	 * Method to get a visibility of a picture for public
    84 	 * @param aVisibility The visibility mode of 
   101 	 * @return The visibility mode of this picture for others
    85 	 * this picture for others
   102 	 */
    86 	 */
   103 	SmfPictureVisibility visibility( ) const;
    87 	void getVisibility( SmfPictureVisibility &aVisibility );
       
    88 	
   104 	
    89 	/**
   105 	/**
    90 	 * Method to get the date of posting the picture
   106 	 * Method to get the date of posting the picture
    91 	 * @param aPostedOn The posted date of the picture
   107 	 * @return The posted date of the picture
    92 	 */
   108 	 */
    93 	void getPostedDate( QDateTime &aPostedOn );
   109 	QDateTime postedDate( ) const;
    94 	
   110 	
    95 	/**
   111 	/**
    96 	 * Method to get the comments for the picture
   112 	 * Method to get the comments for the picture
    97 	 * @param aComments The comments for the picture
   113 	 * @return The comments for the picture
    98 	 */
   114 	 */
    99 	void getComments( QStringList &aComments );
   115 	QStringList comments( ) const;
   100 	
   116 	
   101 	/**
   117 	/**
   102 	 * Method to get the tags for the picture
   118 	 * Method to get the tags for the picture
   103 	 * @param aTags The tags for the picture
   119 	 * @return The tags for the picture
   104 	 */
   120 	 */
   105 	void getTags( QStringList &aTags );
   121 	QStringList tags( ) const;
   106 	
   122 	
   107 	/**
   123 	/**
   108 	 * Method to get the url of the picture
   124 	 * Method to get the url of the picture
   109 	 * @param aUrl The url of the picture
   125 	 * @return The url of the picture
   110 	 */
   126 	 */
   111 	void getUrl( QUrl &aUrl );
   127 	QUrl url( ) const;
   112 	
   128 	
   113 	/**
   129 	/**
   114 	 * Method to get the picture data as a byte array
   130 	 * Method to get the picture data as QImage
   115 	 * @param aData The picture as a byte array
   131 	 * @return The picture as QImage
   116 	 */
   132 	 */
   117 	void getPicture( QByteArray &aData );
   133 	QImage picture( ) const;
   118 		
   134 		
   119 	/**
   135 	/**
   120 	 * Method to set a picture owner
   136 	 * Method to set a picture owner
   121 	 * @param aOwner The owner of the picture
   137 	 * @param aOwner The owner of the picture
   122 	 */
   138 	 */
   140 	 * this picture for others
   156 	 * this picture for others
   141 	 */
   157 	 */
   142 	void setVisibility( const SmfPictureVisibility &aVisibility );
   158 	void setVisibility( const SmfPictureVisibility &aVisibility );
   143 	
   159 	
   144 	/**
   160 	/**
   145 	 * Method to set the date of posting the picture
   161 	 * Method to add comment on the picture
   146 	 * @param aPostedOn The posted date of the picture
       
   147 	 */
       
   148 	void setPostedDate( const QDateTime &aPostedOn );
       
   149 	
       
   150 	/**
       
   151 	 * Method to set the comments for the picture
       
   152 	 * @param aComment The comment for the picture
   162 	 * @param aComment The comment for the picture
   153 	 */
   163 	 */
   154 	void setComment( const QString &aComment );
   164 	void addComment( const QString &aComment );
   155 	
   165 	
   156 	/**
   166 	/**
   157 	 * Method to set the tags for the picture
   167 	 * Method to add tags for the picture
   158 	 * @param aTag The tag for the picture
   168 	 * @param aTag The tag for the picture
   159 	 */
   169 	 */
   160 	void setTag( const QString &aTag );
   170 	void addTags( const QStringList &aTags );
   161 	
   171 	
   162 	/**
   172 	/**
   163 	 * Method to set the picture data as a byte array
   173 	 * Method to set the picture data as QImage
   164 	 * @param aData The picture as a byte array
   174 	 * @param aData The picture as QImage
   165 	 */
   175 	 */
   166 	void setPicture( const QByteArray &aData );
   176 	void setPicture( const QImage &aData );
   167 	
   177 	
   168 private:
   178 private:
   169 	QString m_photoid;		// unique ID of the picture, service provider specific
   179 	QSharedDataPointer<SmfPicturePrivate> d;
   170 	QString m_owner;	// owner of the picture
   180 	
   171 	QString m_title;	// picture title
   181 	friend QDataStream &operator<<( QDataStream &aDataStream, 
   172 	QString m_descrition;// description
   182 			const SmfPicture &aPic );
   173 	bool m_ispublic;// visibility for public, Set to 0 for no, 1 for yes.
   183 
   174 	bool m_isfriend;// visilibility for friends Set to 0 for no, 1 for yes.
   184 	friend QDataStream &operator>>( QDataStream &aDataStream, 
   175 	bool m_isfamily;// visilibility for family Set to 0 for no, 1 for yes.
   185 			SmfPicture &aPic );
   176 	QDateTime m_postedon;// date posted
       
   177 	QStringList m_comments;// comments
       
   178 	QStringList m_tags;	// tags
       
   179 	QUrl m_url;			// url
       
   180 	QByteArray* m_picture;	// picture data as bytearray
       
   181 	QString m_caption;	// caption
       
   182 	
   186 	
   183 	};
   187 	};
   184 /**
   188 
   185 * Externalization
   189 
   186 */
   190 /**
   187 QDataStream &operator<<(QDataStream &, const SmfPicture&);
   191  * Method for Externalization. Writes the SmfPicture object to 
   188 /**
   192  * the stream and returns a reference to the stream.
   189  * Internalization
   193  * @param aDataStream Stream to be written
   190  */
   194  * @param aPic The SmfPicture object to be externalized
   191 QDataStream &operator>>(QDataStream &, SmfPicture&);
   195  * @return reference to the written stream
       
   196  */
       
   197 QDataStream &operator<<( QDataStream &aDataStream, 
       
   198 		const SmfPicture &aPic );
       
   199 
       
   200 /**
       
   201  * Method for Internalization. Reads a SmfPicture object from 
       
   202  * the stream and returns a reference to the stream.
       
   203  * @param aDataStream Stream to be read
       
   204  * @param aPic The SmfPicture object to be internalized
       
   205  * @return reference to the stream
       
   206  */
       
   207 QDataStream &operator>>( QDataStream &aDataStream, 
       
   208 		SmfPicture &aPic);
       
   209 
   192 #endif /* SMFPICTURE_H_ */
   210 #endif /* SMFPICTURE_H_ */