example/clientapi/smf/inc/smfclient/smfgallery.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
equal deleted inserted replaced
1:4b1e636e8a71 2:86af6c333601
     1 /*
     1 /**
     2 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the "{License}"
     5  * under the terms of the "Eclipse Public License v1.0"
     6 * which accompanies  this distribution, and is available
     6  * which accompanies  this distribution, and is available
     7 * at the URL "{LicenseUrl}".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  * Manasij Roy, Nalina Hariharan
    14 * Description:
    14  *
    15 * Interface spefication for a remote picture gallery
    15  * Description:
    16 *
    16  * The SmfEvent class represents an event
    17 */
    17  *
       
    18  */
    18 
    19 
    19 #ifndef SMFGALLERY_H
    20 #ifndef SMFGALLERY_H
    20 #define SMFGALLERY_H
    21 #define SMFGALLERY_H
    21 
    22 
    22 
    23 #include "smfglobal.h"
    23 #include "smfprovider.h"
    24 #include "smfprovider.h"
    24 #include "../common/SmfClientGlobal.h"
    25 #include "../common/SmfClientGlobal.h"
    25 class SmfProvider;
    26 class SmfProvider;
       
    27 class SmfComment; //user id, string, and url
    26 class SmfPicture;
    28 class SmfPicture;
    27 class SmfGalleryModel;
       
    28 class SmfComment; //user id, string, and url
       
    29 
    29 
    30 
    30 
    31 #include <QObject>
    31 #include <QObject>
    32 #include <QDateTime>
    32 #include <QDateTime>
    33 #include <QStringList>
    33 #include <QStringList>
    34 //List of SmfPicture
    34 //List of SmfPicture
    35 typedef QList<SmfPicture> SmfPictureList;
    35 typedef QList<SmfPicture> SmfPictureList;
    36 /**
    36 /**
       
    37  * @ingroup smf_client_group 
    37  * Interface to a remote gallery service. This class
    38  * Interface to a remote gallery service. This class
    38  * provides some basic gallery functionality to allow applications
    39  * provides some basic gallery functionality to allow applications
    39  * to interact with a picture gallery in a social network.
    40  * to interact with a picture gallery in a social network.
    40  *
    41  *
    41  * Note that branding information for the particular service implementation
    42  * Note that branding information for the particular service implementation
    63 
    64 
    64 public:
    65 public:
    65   /**
    66   /**
    66    * Get the picture listing asynchronously.
    67    * Get the picture listing asynchronously.
    67    * The picturesAvailable() signal is emitted with SmfPictureList once the pictures have arrived.
    68    * The picturesAvailable() signal is emitted with SmfPictureList once the pictures have arrived.
       
    69    * When the list is big user can specify the page number and per page item data.
       
    70    * If not supplied by the user default values are used.
       
    71    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    72    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
    68    */
    73    */
    69   virtual void pictures() = 0; 
    74   void pictures(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
    70   
    75 
    71   /**
       
    72    * Returns model
       
    73    */
       
    74   virtual SmfGalleryModel model() = 0; // maybe we can make a QItemModel-derived model?
       
    75   
       
    76   /**
    76   /**
    77    * Returns a user title/caption for the picture
    77    * Returns a user title/caption for the picture
    78    */
    78    */
    79   virtual QString description() = 0; // A user title or caption, maybe?
    79   QString description(SmfPicture& picture); // A user title or caption, maybe?
    80   
    80 
    81   //APIs to get/set base provider info (SmfProvider)
    81   //APIs to get/set base provider info (SmfProvider)
    82   
    82 
    83   /**
    83   /**
    84    * Gets the base provider info
    84    * Gets the base provider info
    85    */
    85    */
    86   virtual SmfProvider* getProvider() = 0;
    86    SmfProvider* getProvider() ;
    87   
       
    88   /**
       
    89    * Sets the base provider info
       
    90    */
       
    91   virtual void setProvider(SmfProvider* provider) = 0;
       
    92 
    87 
    93 public slots:
    88 public slots:
    94 	/**
    89 	/**
    95 	 * Upload an image.Implemented as slot to connect to UI controls more easily
    90 	 * 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
    91 	 * uploadFinished() signal is emitted with the success value of the upload
    97 	 * @param image the image to be uploaded
    92 	 * @param image the image to be uploaded
    98 	 */
    93 	 */
    99   virtual void upload(SmfPicture* image) = 0;
    94    void upload(SmfPicture* image) ;
   100   
    95 
   101 	/**
    96 	/**
   102 	 * Upload an list image.Implemented as slot to connect to UI controls more easily
    97 	 * 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
    98 	 * uploadFinished() signal is emitted with the success value of the upload
   104 	 * @param images the list image to be uploaded
    99 	 * @param images the list image to be uploaded
   105 	 */
   100 	 */
   106   virtual void upload(SmfPictureList* images) = 0;
   101    void upload(SmfPictureList* images) ;
   107   
   102 
   108   /**
   103   /**
   109    * Posts a comment for an image. uploadFinished() signal is emitted
   104    * Posts a comment for an image. uploadFinished() signal is emitted
   110    * with success of the post once comment is posted.
   105    * with success of the post once comment is posted.
   111    * @param image Image to comment on
   106    * @param image Image to comment on
   112    * @param comment Comment to post
   107    * @param comment Comment to post
   113    */
   108    */
   114   virtual void postComment(SmfPicture image, SmfComment comment) = 0;
   109    void postComment(SmfPicture image, SmfComment comment) ;
   115 
   110 
   116 signals:
   111 signals:
   117 	/*
   112 	/*
   118 	 * Notification on arrival of list of SmfPicture as a result of request.
   113 	 * 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.
   114 	 * 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.
   115 	 * In that case this signal is emitted multiple times.
   121 	 * through pictures().
   116 	 * through pictures().
   122 	 * @param pics Picture list
   117 	 * @param pics Picture list
   123 	 * @param error Error string
   118 	 * @param error Error string
   124 	 * @param pageNumber Page number
   119 	 * @param resultPage Page number info
   125 	 */
   120 	 */
   126 	void picturesAvailable(SmfPictureList* pics, QString error, int pageNumber=0);
   121 	void picturesAvailable(SmfPictureList* pics, QString error, SmfResultPage resultPage);
   127   
   122 
   128   /**
   123   /**
   129    * Notification of the success of the uploading of image/comment
   124    * Notification of the success of the uploading of image/comment
   130    * @param success The success of the post
   125    * @param error The upload success result of each individual pictures
   131    */
   126    */
   132   void uploadFinished(bool success);
   127   void uploadFinished(QList<bool> error);
   133 private:
   128 private:
   134   SmfProvider* m_baseProvider;
   129   SmfProvider* m_baseProvider;
   135 };
   130 };
   136 
   131 
   137 SMF_GETSERVICES(SmfGallery, "org.symbian.smf.client.gallery\0.2")
   132 SMF_SERVICE_NAME(SmfGallery, "org.symbian.smf.client.gallery\0.2")
   138 
   133 
   139 #endif // SMFGALLERY_H
   134 #endif // SMFGALLERY_H
   140 
   135