example/clientapi/smf/inc/smfclient/smfgallery.h
changeset 1 4b1e636e8a71
child 2 86af6c333601
equal deleted inserted replaced
0:5d2360e70d9f 1:4b1e636e8a71
       
     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 "{License}"
       
     6 * which accompanies  this distribution, and is available
       
     7 * at the URL "{LicenseUrl}".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Interface spefication for a remote picture gallery
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef SMFGALLERY_H
       
    20 #define SMFGALLERY_H
       
    21 
       
    22 
       
    23 #include "smfprovider.h"
       
    24 #include "../common/SmfClientGlobal.h"
       
    25 class SmfProvider;
       
    26 class SmfPicture;
       
    27 class SmfGalleryModel;
       
    28 class SmfComment; //user id, string, and url
       
    29 
       
    30 
       
    31 #include <QObject>
       
    32 #include <QDateTime>
       
    33 #include <QStringList>
       
    34 //List of SmfPicture
       
    35 typedef QList<SmfPicture> SmfPictureList;
       
    36 /**
       
    37  * Interface to a remote gallery service. This class
       
    38  * provides some basic gallery functionality to allow applications
       
    39  * to interact with a picture gallery in a social network.
       
    40  *
       
    41  * Note that branding information for the particular service implementation
       
    42  * is available from getProvider() API. See also:
       
    43  * SmfProvider::serviceName(), SmfProvider::serviceIcon()
       
    44  *
       
    45  * All of the functionality described here should be implemented by a service
       
    46  * specific plug-in object.
       
    47  * Interface name for SmfGallery org.symbian.smf.client.gallery
       
    48  */
       
    49 class SMFCLIENT_EXPORT SmfGallery : public QObject
       
    50 {
       
    51   Q_OBJECT
       
    52 
       
    53 public:
       
    54   /**
       
    55    * Constructs SmfGallery.
       
    56    * @param baseProvider The base provider info
       
    57    * Seeing as this is a plug-in implementation, these will realistically
       
    58    be generated by SMF factory of some kind
       
    59    */
       
    60 
       
    61   SmfGallery(SmfProvider* baseprovider = 0);
       
    62   ~SmfGallery();
       
    63 
       
    64 public:
       
    65   /**
       
    66    * Get the picture listing asynchronously.
       
    67    * The picturesAvailable() signal is emitted with SmfPictureList once the pictures have arrived.
       
    68    */
       
    69   virtual void pictures() = 0; 
       
    70   
       
    71   /**
       
    72    * Returns model
       
    73    */
       
    74   virtual SmfGalleryModel model() = 0; // maybe we can make a QItemModel-derived model?
       
    75   
       
    76   /**
       
    77    * Returns a user title/caption for the picture
       
    78    */
       
    79   virtual QString description() = 0; // A user title or caption, maybe?
       
    80   
       
    81   //APIs to get/set base provider info (SmfProvider)
       
    82   
       
    83   /**
       
    84    * Gets the base provider info
       
    85    */
       
    86   virtual SmfProvider* getProvider() = 0;
       
    87   
       
    88   /**
       
    89    * Sets the base provider info
       
    90    */
       
    91   virtual void setProvider(SmfProvider* provider) = 0;
       
    92 
       
    93 public slots:
       
    94 	/**
       
    95 	 * Upload an image.Implemented as slot to connect to UI controls more easily
       
    96 	 * uploadFinished() signal is emitted with the success value of the upload
       
    97 	 * @param image the image to be uploaded
       
    98 	 */
       
    99   virtual void upload(SmfPicture* image) = 0;
       
   100   
       
   101 	/**
       
   102 	 * Upload an list image.Implemented as slot to connect to UI controls more easily
       
   103 	 * uploadFinished() signal is emitted with the success value of the upload
       
   104 	 * @param images the list image to be uploaded
       
   105 	 */
       
   106   virtual void upload(SmfPictureList* images) = 0;
       
   107   
       
   108   /**
       
   109    * Posts a comment for an image. uploadFinished() signal is emitted
       
   110    * with success of the post once comment is posted.
       
   111    * @param image Image to comment on
       
   112    * @param comment Comment to post
       
   113    */
       
   114   virtual void postComment(SmfPicture image, SmfComment comment) = 0;
       
   115 
       
   116 signals:
       
   117 	/*
       
   118 	 * Notification on arrival of list of SmfPicture as a result of request.
       
   119 	 * Note if number of friends is large, then it can download the list page by page.
       
   120 	 * In that case this signal is emitted multiple times.
       
   121 	 * through pictures().
       
   122 	 * @param pics Picture list
       
   123 	 * @param error Error string
       
   124 	 * @param pageNumber Page number
       
   125 	 */
       
   126 	void picturesAvailable(SmfPictureList* pics, QString error, int pageNumber=0);
       
   127   
       
   128   /**
       
   129    * Notification of the success of the uploading of image/comment
       
   130    * @param success The success of the post
       
   131    */
       
   132   void uploadFinished(bool success);
       
   133 private:
       
   134   SmfProvider* m_baseProvider;
       
   135 };
       
   136 
       
   137 SMF_GETSERVICES(SmfGallery, "org.symbian.smf.client.gallery\0.2")
       
   138 
       
   139 #endif // SMFGALLERY_H
       
   140