smf/smfservermodule/smfclient/client/smfgallery.h
changeset 10 1d94eb8df9c2
parent 9 b85b0c039c14
equal deleted inserted replaced
9:b85b0c039c14 10:1d94eb8df9c2
     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 SmfGallery class 
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFGALLERY_H
       
    21 #define SMFGALLERY_H
       
    22 
       
    23 #include "smfglobal.h"
       
    24 #include "smfprovider.h"
       
    25 #include "smfclientglobal.h"
       
    26 #include "smfpicture.h"
       
    27 #include "smfcomment.h"
       
    28 
       
    29 #include <QObject>
       
    30 #include <QDateTime>
       
    31 #include <QStringList>
       
    32 
       
    33 #include <qmobilityglobal.h>
       
    34 
       
    35 
       
    36 
       
    37 class SmfGalleryPrivate;
       
    38 /**
       
    39  * @ingroup smf_client_group 
       
    40  * Interface to a remote gallery service. This class
       
    41  * provides some basic gallery functionality to allow applications
       
    42  * to interact with a picture gallery in a social network.
       
    43  *
       
    44  * Note that branding information for the particular service implementation
       
    45  * is available from getProvider() API. See also:
       
    46  * SmfProvider::serviceName(), SmfProvider::serviceIcon()
       
    47  *
       
    48  * All of the functionality described here should be implemented by a service
       
    49  * specific plug-in object.
       
    50  * Interface name for SmfGallery org.symbian.smf.client.gallery
       
    51  */
       
    52 class SMFCLIENT_EXPORT SmfGallery : public QObject
       
    53 {
       
    54   Q_OBJECT
       
    55 
       
    56 public:
       
    57   /**
       
    58    * Constructs SmfGallery.
       
    59    * @param baseProvider The base provider info
       
    60    * Seeing as this is a plug-in implementation, these will realistically
       
    61    be generated by SMF factory of some kind
       
    62    */
       
    63 
       
    64   SmfGallery(SmfProvider* baseprovider);
       
    65   ~SmfGallery();
       
    66 
       
    67 public:
       
    68   /**
       
    69    * Get the picture listing asynchronously.
       
    70    * The picturesAvailable() signal is emitted with SmfPictureList once the pictures have arrived.
       
    71    * When the list is big user can specify the page number and per page item data.
       
    72    * If not supplied by the user default values are used.
       
    73    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    74    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    75    */
       
    76   void pictures(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    77 
       
    78   /**
       
    79    * Returns a user title/caption for the picture
       
    80    */
       
    81   QString description(SmfPicture& picture);
       
    82   /**
       
    83    * Gets the base provider info
       
    84    */
       
    85    SmfProvider* getProvider() ;
       
    86 	//friend so that it can directly emit SmfPostProvider's signal
       
    87 	friend class SmfGalleryPrivate;
       
    88 public slots:
       
    89 	/**
       
    90 	 * Upload an image.Implemented as slot to connect to UI controls more easily
       
    91 	 * uploadFinished() signal is emitted with the success value of the upload
       
    92 	 * @param image the image to be uploaded
       
    93 	 */
       
    94    void upload(SmfPicture* image) ;
       
    95 
       
    96 	/**
       
    97 	 * Upload an list image.Implemented as slot to connect to UI controls more easily
       
    98 	 * uploadFinished() signal is emitted with the success value of the upload
       
    99 	 * @param images the list image to be uploaded
       
   100 	 */
       
   101    void upload(SmfPictureList* images) ;
       
   102 
       
   103   /**
       
   104    * Posts a comment for an image. uploadFinished() signal is emitted
       
   105    * with success of the post once comment is posted.
       
   106    * @param image Image to comment on
       
   107    * @param comment Comment to post
       
   108    */
       
   109    void postComment(SmfPicture image, SmfComment comment) ;
       
   110    /**
       
   111 	* Request for a custom operation.
       
   112 	* @param operationId OperationId
       
   113 	* @param customData Custom data to be sent
       
   114 	* Note:-Interpretation of operationId and customData is upto the concerned
       
   115 	* plugin and client application. service provider should provide some
       
   116 	* serializing-deserializing utilities for these custom data
       
   117 	*/
       
   118    void customRequest(const int& operationId,QByteArray* customData){/*to be implemented*/};
       
   119 signals:
       
   120 	/*
       
   121 	 * Notification on arrival of list of SmfPicture as a result of request.
       
   122 	 * Note if number of friends is large, then it can download the list page by page.
       
   123 	 * In that case this signal is emitted multiple times.
       
   124 	 * through pictures().
       
   125 	 * @param pics Picture list
       
   126 	 * @param error Error string
       
   127 	 * @param resultPage Page number info
       
   128 	 */
       
   129 	void picturesAvailable(SmfPictureList* pics, SmfError error, SmfResultPage resultPage);
       
   130 
       
   131   /**
       
   132    * Notification of the success of the uploading of image/comment
       
   133    * @param error The upload success result of each individual pictures
       
   134    */
       
   135   void uploadFinished(QList<bool> error);
       
   136 	/**
       
   137 	 * Emitted when custom data is available
       
   138 	 * @param operationId Requested operation id
       
   139 	 * @param customData Custom data received, interpretation is not the responsibility of Smf
       
   140 	 */
       
   141 	void customDataAvailable(int operationId, QByteArray* customData);
       
   142 private:
       
   143 	SmfProvider* m_baseProvider;
       
   144 	//private impl wrapper
       
   145 	SmfGalleryPrivate* m_private;
       
   146 
       
   147 };
       
   148 
       
   149 SMF_SERVICE_NAME(SmfGallery, "org.symbian.smf.client.gallery\0.2")
       
   150 
       
   151 #endif // SMFGALLERY_H
       
   152