videocollection/tsrc/stubs/inc/videoservices.h
changeset 52 e3cecb93e76a
parent 20 b9e04db066d4
child 66 adb51f74b890
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    13 *
    13 *
    14 * Description:   VideoServices class definition
    14 * Description:   VideoServices class definition
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 // Version : %version: %
       
    19 
    18 #ifndef __VIDEOSERVICES_H__
    20 #ifndef __VIDEOSERVICES_H__
    19 #define __VIDEOSERVICES_H__
    21 #define __VIDEOSERVICES_H__
    20 
    22 
    21 /**
    23 /**
    22  *
    24  *
    29 //FORWARD CLASS DECLARATION
    31 //FORWARD CLASS DECLARATION
    30 class VideoServiceUriFetch;
    32 class VideoServiceUriFetch;
    31 class VideoServicePlay;
    33 class VideoServicePlay;
    32 class VideoServiceView;
    34 class VideoServiceView;
    33 class VideoServiceBrowse;
    35 class VideoServiceBrowse;
    34 class QVideoPlayerEngine;
    36 class VideoPlayerEngine;
    35 
    37 
    36 class VideoServices : public QObject
    38 class VideoServices : public QObject
    37 {
    39 {
    38     Q_OBJECT
    40     Q_OBJECT
    39 
    41 
    40 public:
    42     public:
    41 
    43 
    42     /**
    44         /**
    43      * Returns singleton instance for this class.
    45          * Returns singleton instance for this class.
    44      *
    46          * WARNING! Not safe to call this from destructor of another function scope static object!
    45      * WARNING! Not safe to call this from destructor of another function scope static object!
    47          * @return The singleton instance.
    46      *
    48          */
    47      * @return The singleton instance.
    49         static VideoServices *instance( VideoPlayerEngine* engine = 0 );
    48      */
       
    49     static VideoServices *instance(QVideoPlayerEngine* engine = 0);
       
    50 
       
    51     /**
       
    52      * Decreases the reference count, when count reaches zero cleanup is done.
       
    53      *
       
    54      */
       
    55     void decreaseReferenceCount();
       
    56 
       
    57     /**
       
    58      * Returns the context title set by service requestee
       
    59      *
       
    60      * @return QString the title
       
    61      *
       
    62      */
       
    63     QString contextTitle() const;
       
    64 
       
    65     /**
       
    66      * Returns sort type defined by the service client.
       
    67      * 
       
    68      * @param None.
       
    69      * @return int.
       
    70      */
       
    71     int sortRole() const;
       
    72 
       
    73 	/*
       
    74 	 * Enum reflecting the services provided 
       
    75 	 */
       
    76     enum TVideoService
       
    77     {
       
    78         ENoService,
       
    79         EUriFetcher,
       
    80         EPlayback,
       
    81 		EView,
       
    82         EBrowse
       
    83     };
       
    84 
       
    85     /**
       
    86      * Returns service active status
       
    87      *
       
    88      * @return bool true if active, false if not active
       
    89      *
       
    90      */
       
    91     VideoServices::TVideoService currentService();
       
    92 
       
    93     /**
       
    94      * Returns browsing category.
       
    95      * 
       
    96      * @return see vcxmyvideosdef.h for default categories.
       
    97      */
       
    98     int getBrowseCategory() const;
       
    99 
       
   100 public slots:
       
   101     void itemSelected(const QString& item);
       
   102     void browsingEnded();
       
   103 
       
   104 signals:
       
   105 	/*
       
   106 	 * Emitted when service user has set the title
       
   107 	 */    
       
   108 	void titleReady(const QString& title);
       
   109 
       
   110 	/*
       
   111 	 * Emitted to acticate requested plugin
       
   112 	 */
       
   113 	void activated(int command);
       
   114 
       
   115 private:
       
   116 
       
   117     /**
       
   118      * Constructor
       
   119      */
       
   120     VideoServices();
       
   121 
       
   122     /**
       
   123      * Constructor
       
   124      */
       
   125     VideoServices(QVideoPlayerEngine* engine);
       
   126 
       
   127     /**
       
   128      * Destructor.
       
   129      */
       
   130     virtual ~VideoServices();
       
   131 
       
   132     void setEngine(QVideoPlayerEngine* engine);
       
   133 
       
   134     /**
       
   135      * Sets the active service
       
   136      *
       
   137      * @param service
       
   138      *
       
   139      */
       
   140     void setCurrentService(VideoServices::TVideoService service);
       
   141 
       
   142     /**
       
   143      * Returns the current engine
       
   144      *
       
   145      * @return engine
       
   146      *
       
   147      */
       
   148     QVideoPlayerEngine* engine();
       
   149 
       
   150     Q_DISABLE_COPY(VideoServices)
       
   151 
       
   152 private:
       
   153 
       
   154     /**
       
   155      * Reference count.
       
   156      */
       
   157     int mReferenceCount;
       
   158 
       
   159     /**
       
   160      * VideoServiceUriFetch service instance.
       
   161      */
       
   162     VideoServiceUriFetch* mServiceUriFetch;
       
   163 
       
   164     /**
       
   165      * VideoServicePlay service instance.
       
   166      */
       
   167     VideoServicePlay* mServicePlay;
       
   168     
    50     
   169     /**
    51         /**
   170      * VideoServiceView service instance.
    52          * Decreases the reference count, when count reaches zero cleanup is done.
   171      */    
    53          *
   172     VideoServiceView* mServiceView; 
    54          */
       
    55         void decreaseReferenceCount();
   173     
    56     
   174     /**
    57         /**
   175      * VideoServiceBrowse service instance.
    58          * Returns the context title set by service requestee
   176      */
    59          * @return QString the title
   177     VideoServiceBrowse *mServiceBrowse;
    60          */
   178 
    61         QString contextTitle() const;
   179     /**
       
   180      * Pointer of QVideoPlayerEngine.
       
   181      */
       
   182     QVideoPlayerEngine* mEngine;
       
   183 
       
   184 	/*
       
   185 	 * Current service
       
   186 	 */
       
   187     VideoServices::TVideoService mCurrentService;
       
   188     
    62     
   189     /**
    63         /**
   190      * Sort role.
    64          * Returns sort type defined by the service client.
   191      */
    65          * @param None.
   192     int mSortRole;
    66          * @return int.
   193 
    67          */
   194     friend class VideoServiceUriFetch;
    68         int sortRole() const;
   195 
       
   196     friend class VideoServicePlay;
       
   197 	
       
   198 	friend class VideoServiceView;
       
   199     
    69     
   200     friend class VideoServiceBrowse;
    70         /*
   201     };
    71          * Enum reflecting the services provided 
       
    72          */
       
    73         enum TVideoService
       
    74         {
       
    75             ENoService,
       
    76             EUriFetcher,
       
    77             EPlayback,
       
    78             EView,
       
    79             EBrowse
       
    80         };
       
    81     
       
    82         /**
       
    83          * Returns service active status
       
    84          * @return bool true if active, false if not active
       
    85          */
       
    86         VideoServices::TVideoService currentService();
       
    87     
       
    88         /**
       
    89          * Returns browsing category.
       
    90          * @return see vcxmyvideosdef.h for default categories.
       
    91          */
       
    92         int getBrowseCategory() const;
       
    93     
       
    94     public slots:
       
    95         void itemSelected( const QString& item );
       
    96         void browsingEnded();
       
    97     
       
    98     signals:
       
    99         /*
       
   100          * Emitted when service user has set the title
       
   101          */    
       
   102         void titleReady( const QString& title );
       
   103     
       
   104         /*
       
   105          * Emitted to acticate requested plugin
       
   106          */
       
   107         void activated( int command );
       
   108     
       
   109     private:
       
   110     
       
   111         /**
       
   112          * Constructor
       
   113          */
       
   114         VideoServices();
       
   115     
       
   116         /**
       
   117          * Constructor
       
   118          */
       
   119         VideoServices( VideoPlayerEngine* engine );
       
   120     
       
   121         /**
       
   122          * Destructor.
       
   123          */
       
   124         virtual ~VideoServices();
       
   125     
       
   126         void setEngine( VideoPlayerEngine* engine );
       
   127     
       
   128         /**
       
   129          * Sets the active service
       
   130          * @param service
       
   131          */
       
   132         void setCurrentService( VideoServices::TVideoService service );
       
   133     
       
   134         /**
       
   135          * Returns the current engine
       
   136          * @return engine
       
   137          */
       
   138         VideoPlayerEngine* engine();
       
   139     
       
   140         Q_DISABLE_COPY( VideoServices )
       
   141     
       
   142     private:
       
   143     
       
   144         /**
       
   145          * Reference count.
       
   146          */
       
   147         int mReferenceCount;
       
   148     
       
   149         /**
       
   150          * VideoServiceUriFetch service instance.
       
   151          */
       
   152         VideoServiceUriFetch* mServiceUriFetch;
       
   153     
       
   154         /**
       
   155          * VideoServicePlay service instance.
       
   156          */
       
   157         VideoServicePlay* mServicePlay;
       
   158         
       
   159         /**
       
   160          * VideoServiceView service instance.
       
   161          */    
       
   162         VideoServiceView* mServiceView; 
       
   163         
       
   164         /**
       
   165          * VideoServiceBrowse service instance.
       
   166          */
       
   167         VideoServiceBrowse *mServiceBrowse;
       
   168     
       
   169         /**
       
   170          * Pointer of VideoPlayerEngine.
       
   171          */
       
   172         VideoPlayerEngine* mEngine;
       
   173     
       
   174         /*
       
   175          * Current service
       
   176          */
       
   177         VideoServices::TVideoService mCurrentService;
       
   178         
       
   179         /**
       
   180          * Sort role.
       
   181          */
       
   182         int mSortRole;
       
   183     
       
   184         friend class VideoServiceUriFetch;    
       
   185         friend class VideoServicePlay;        
       
   186         friend class VideoServiceView;        
       
   187         friend class VideoServiceBrowse;
       
   188         
       
   189 };
   202 
   190 
   203 #endif //__VIDEOSERVICES_H__
   191 #endif //__VIDEOSERVICES_H__