inc/videoservices.h
changeset 36 8aed59de29f9
child 20 b9e04db066d4
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   VideoServices class definition
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __VIDEOSERVICES_H__
       
    19 #define __VIDEOSERVICES_H__
       
    20 
       
    21 #include <QStringList>
       
    22 #include "videoplayerappexport.h"
       
    23 
       
    24 //FORWARD CLASS DECLARATION
       
    25 class VideoServiceUriFetch;
       
    26 class VideoServicePlay;
       
    27 class VideoServiceView;
       
    28 class VideoServiceBrowse;
       
    29 class QVideoPlayerEngine;
       
    30 
       
    31 class VIDEOPLAYERAPP_DLL_EXPORT VideoServices : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34 
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Returns singleton instance for this class.
       
    39      *
       
    40      * WARNING! Not safe to call this from destructor of another function scope static object!
       
    41      *
       
    42      * @return The singleton instance.
       
    43      */
       
    44     static VideoServices *instance(QVideoPlayerEngine* engine = 0);
       
    45 
       
    46     /**
       
    47      * Decreases the reference count, when count reaches zero cleanup is done.
       
    48      *
       
    49      */
       
    50     void decreaseReferenceCount();
       
    51 
       
    52     /**
       
    53      * Returns the context title set by service requestee
       
    54      *
       
    55      * @return QString the title
       
    56      *
       
    57      */
       
    58     QString contextTitle() const;
       
    59 
       
    60 	/*
       
    61 	 * Enum reflecting the services provided 
       
    62 	 */
       
    63     enum TVideoService
       
    64     {
       
    65         ENoService,
       
    66         EUriFetcher,
       
    67         EPlayback,
       
    68 		EView,
       
    69         EBrowse
       
    70     };
       
    71 
       
    72     /**
       
    73      * Returns service active status
       
    74      *
       
    75      * @return bool true if active, false if not active
       
    76      *
       
    77      */
       
    78     VideoServices::TVideoService currentService();
       
    79 
       
    80     /**
       
    81      * Returns browsing category.
       
    82      * 
       
    83      * @return see vcxmyvideosdef.h for default categories.
       
    84      */
       
    85     int getBrowseCategory() const;
       
    86 
       
    87 public slots:
       
    88     void itemSelected(const QString& item);
       
    89     void browsingEnded();
       
    90 
       
    91 signals:
       
    92 	/*
       
    93 	 * Emitted when service user has set the title
       
    94 	 */    
       
    95 	void titleReady(const QString& title);
       
    96 
       
    97 	/*
       
    98 	 * Emitted to acticate requested plugin
       
    99 	 */
       
   100 	void activated(int command);
       
   101 
       
   102 private:
       
   103 
       
   104     /**
       
   105      * Constructor
       
   106      */
       
   107     VideoServices();
       
   108 
       
   109     /**
       
   110      * Constructor
       
   111      */
       
   112     VideoServices(QVideoPlayerEngine* engine);
       
   113 
       
   114     /**
       
   115      * Destructor.
       
   116      */
       
   117     virtual ~VideoServices();
       
   118 
       
   119     void setEngine(QVideoPlayerEngine* engine);
       
   120 
       
   121     /**
       
   122      * Sets the active service
       
   123      *
       
   124      * @param service
       
   125      *
       
   126      */
       
   127     void setCurrentService(VideoServices::TVideoService service);
       
   128 
       
   129     /**
       
   130      * Returns the current engine
       
   131      *
       
   132      * @return engine
       
   133      *
       
   134      */
       
   135     QVideoPlayerEngine* engine();
       
   136 
       
   137     Q_DISABLE_COPY(VideoServices)
       
   138 
       
   139 private:
       
   140 
       
   141     /**
       
   142      * Reference count.
       
   143      */
       
   144     int mReferenceCount;
       
   145 
       
   146     /**
       
   147      * Singleton instance.
       
   148      */
       
   149     static VideoServices* mInstance;
       
   150 
       
   151     /**
       
   152      * VideoServiceUriFetch service instance.
       
   153      */
       
   154     VideoServiceUriFetch* mServiceUriFetch;
       
   155 
       
   156     /**
       
   157      * VideoServicePlay service instance.
       
   158      */
       
   159     VideoServicePlay* mServicePlay;
       
   160     
       
   161     /**
       
   162      * VideoServiceView service instance.
       
   163      */    
       
   164     VideoServiceView* mServiceView; 
       
   165     
       
   166     /**
       
   167      * VideoServiceBrowse service instance.
       
   168      */
       
   169     VideoServiceBrowse *mServiceBrowse;
       
   170 
       
   171     /**
       
   172      * Pointer of QVideoPlayerEngine.
       
   173      */
       
   174     QVideoPlayerEngine* mEngine;
       
   175 
       
   176 	/*
       
   177 	 * Current service
       
   178 	 */
       
   179     VideoServices::TVideoService mCurrentService;
       
   180 
       
   181     friend class VideoServiceUriFetch;
       
   182 
       
   183     friend class VideoServicePlay;
       
   184 	
       
   185 	friend class VideoServiceView;
       
   186     
       
   187     friend class VideoServiceBrowse;
       
   188     };
       
   189 
       
   190 #endif //__VIDEOSERVICES_H__