smf/inc/common/smfpictures/smfpicture.h
changeset 7 be09cf1f39dd
parent 6 c39a6cfd1fb9
child 8 4102c67b6e56
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
     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 picture class represents an instance of a picture
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFPICTURE_H_
       
    21 #define SMFPICTURE_H_
       
    22 
       
    23 #include <QImage>
       
    24 #include <QDateTime>
       
    25 #include <QStringList>
       
    26 #include <QUrl>
       
    27 #include <qdatastream.h>
       
    28 #include <QSharedData>
       
    29 #include <smfclientglobal.h>
       
    30 #include <QMetaType>
       
    31 #include <smfcomment.h>
       
    32 
       
    33 class SmfPicturePrivate;
       
    34 
       
    35 /**
       
    36  * SmfPictureVisibility enumeration
       
    37  */
       
    38 enum SmfPictureVisibility
       
    39 	{
       
    40 	SMFVisibilityFriend,
       
    41 	SMFVisibilityPersonal,
       
    42 	SMFVisibilityFamily,
       
    43 	SMFVisibilityGroup,
       
    44 	SMFVisibilityPublic
       
    45 	};
       
    46 
       
    47 /**
       
    48  * @ingroup smf_common_group
       
    49  * The picture class represents an instance of a picture
       
    50  */
       
    51 class SMFCLIENT_EXPORT SmfPicture
       
    52 	{
       
    53 public:
       
    54 	/**
       
    55 	 * Constructor with default argument
       
    56 	 */
       
    57 	SmfPicture( );
       
    58 	
       
    59 	/**
       
    60 	 * Copy Constructor
       
    61 	 * @param aOther The reference object
       
    62 	 */
       
    63 	SmfPicture( const SmfPicture &aOther );
       
    64 	
       
    65 	/**
       
    66 	 * CConstructs SmfPicture from QImage
       
    67 	 * @param aImage The QImage
       
    68 	 */
       
    69 	SmfPicture( const QImage &aImage );
       
    70 	
       
    71 	/**
       
    72 	 * Overloaded = operator
       
    73 	 * @param aOther The reference object
       
    74 	 * @return The current object reference
       
    75 	 */
       
    76 	SmfPicture& operator=(const SmfPicture &aOther);
       
    77 	
       
    78 	/**
       
    79 	 * Destructor
       
    80 	 */
       
    81 	~SmfPicture( );
       
    82 	
       
    83 	/**
       
    84 	 * Method to get a picture owner
       
    85 	 * @return The owner of the picture
       
    86 	 */
       
    87 	QString owner( ) const;
       
    88 	
       
    89 	/**
       
    90 	 * Method to get a picture title
       
    91 	 * @return The title of the picture
       
    92 	 */
       
    93 	QString title( ) const;
       
    94 	
       
    95 	/**
       
    96 	 * Method to get a picture description
       
    97 	 * @return The description of the picture
       
    98 	 */
       
    99 	QString description( ) const;
       
   100 	
       
   101 	/**
       
   102 	 * Method to get a visibility of a picture for public
       
   103 	 * @return The visibility mode of this picture for others
       
   104 	 */
       
   105 	SmfPictureVisibility visibility( ) const;
       
   106 	
       
   107 	/**
       
   108 	 * Method to get the date of posting the picture
       
   109 	 * @return The posted date of the picture
       
   110 	 */
       
   111 	QDateTime postedDate( ) const;
       
   112 	
       
   113 	/**
       
   114 	 * Method to get the comments for the picture
       
   115 	 * @return The comments for the picture
       
   116 	 */
       
   117 	QList<SmfComment> comments( ) const;
       
   118 	
       
   119 	/**
       
   120 	 * Method to get the tags for the picture
       
   121 	 * @return The tags for the picture
       
   122 	 */
       
   123 	QStringList tags( ) const;
       
   124 	
       
   125 	/**
       
   126 	 * Method to get the url of the picture
       
   127 	 * @return The url of the picture
       
   128 	 */
       
   129 	QUrl url( ) const;
       
   130 	
       
   131 	/**
       
   132 	 * Method to get the picture data as QImage
       
   133 	 * @return The picture as QImage
       
   134 	 */
       
   135 	QImage picture( ) const;
       
   136 		
       
   137 	/**
       
   138 	 * Method to get the id of the picture
       
   139 	 * @return The ID value 
       
   140 	 */
       
   141 	QString id( ) const;
       
   142 		
       
   143 	/**
       
   144 	 * Method to set a picture owner
       
   145 	 * @param aOwner The owner of the picture
       
   146 	 */
       
   147 	void setOwner( const QString &aOwner );
       
   148 	
       
   149 	/**
       
   150 	 * Method to set a picture title
       
   151 	 * @param aTitle The title of the picture
       
   152 	 */
       
   153 	void setTitle( const QString &aTitle );
       
   154 	
       
   155 	/**
       
   156 	 * Method to set a picture description
       
   157 	 * @param aDescription The description of the picture
       
   158 	 */
       
   159 	void setDescription( const QString &aDescription );
       
   160 	
       
   161 	/**
       
   162 	 * Method to set a visibility of a picture for public
       
   163 	 * @param aVisibility aVisibility The visibility mode of 
       
   164 	 * this picture for others
       
   165 	 */
       
   166 	void setVisibility( const SmfPictureVisibility &aVisibility );
       
   167 	
       
   168 	/**
       
   169 	 * Method to set the date of posting the picture
       
   170 	 * @param aDate The post date of the picture
       
   171 	 */
       
   172 	void setPostedDate( const QDateTime &aDate );
       
   173 	
       
   174 	/**
       
   175 	 * Method to add comment on the picture
       
   176 	 * @param aComment The comment for the picture
       
   177 	 */
       
   178 	void addComment( const SmfComment &aComment );
       
   179 	
       
   180 	/**
       
   181 	 * Method to add tags for the picture
       
   182 	 * @param aTag The tag for the picture
       
   183 	 */
       
   184 	void addTags( const QStringList &aTags );
       
   185 	
       
   186 	/**
       
   187 	 * Method to set the url of the picture
       
   188 	 * @param aUrl The url of the picture
       
   189 	 */
       
   190 	void setUrl( const QUrl &aUrl );
       
   191 	
       
   192 	/**
       
   193 	 * Method to set the picture data as QImage
       
   194 	 * @param aData The picture as QImage
       
   195 	 */
       
   196 	void setPicture( const QImage &aData );
       
   197 	
       
   198 	/**
       
   199 	 * Method to set the id of the picture
       
   200 	 * @param aId The ID value 
       
   201 	 */
       
   202 	void setId( const QString &aId );
       
   203 	
       
   204 private:
       
   205 	QSharedDataPointer<SmfPicturePrivate> d;
       
   206 	
       
   207 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   208 			const SmfPicture &aPic );
       
   209 
       
   210 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   211 			SmfPicture &aPic );
       
   212 	
       
   213 	};
       
   214 
       
   215 
       
   216 /**
       
   217  * Method for Externalization. Writes the SmfPicture object to 
       
   218  * the stream and returns a reference to the stream.
       
   219  * @param aDataStream Stream to be written
       
   220  * @param aPic The SmfPicture object to be externalized
       
   221  * @return reference to the written stream
       
   222  */
       
   223 QDataStream &operator<<( QDataStream &aDataStream, 
       
   224 		const SmfPicture &aPic );
       
   225 
       
   226 /**
       
   227  * Method for Internalization. Reads a SmfPicture object from 
       
   228  * the stream and returns a reference to the stream.
       
   229  * @param aDataStream Stream to be read
       
   230  * @param aPic The SmfPicture object to be internalized
       
   231  * @return reference to the stream
       
   232  */
       
   233 QDataStream &operator>>( QDataStream &aDataStream, 
       
   234 		SmfPicture &aPic);
       
   235 
       
   236 
       
   237 // Make the class SmfPicture known to QMetaType, so that as to register it.
       
   238 Q_DECLARE_METATYPE(SmfPicture)
       
   239 
       
   240 
       
   241 #endif /* SMFPICTURE_H_ */