videoplayerapp/videoplayerengine/inc/videoservices.h
changeset 36 8aed59de29f9
parent 35 3738fe97f027
child 37 4eb2df7f7cbe
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 QVideoPlayerEngine;
       
    28 
       
    29 class VIDEOPLAYERAPP_DLL_EXPORT VideoServices : public QObject
       
    30 {
       
    31     Q_OBJECT
       
    32 
       
    33 public:
       
    34 
       
    35     /**
       
    36      * Returns singleton instance for this class.
       
    37      *
       
    38      * WARNING! Not safe to call this from destructor of another function scope static object!
       
    39      *
       
    40      * @return The singleton instance.
       
    41      */
       
    42     static VideoServices *instance(QVideoPlayerEngine* engine = 0);
       
    43 
       
    44     /**
       
    45      * Decreases the reference count, when count reaches zero cleanup is done.
       
    46      *
       
    47      */
       
    48     void decreaseReferenceCount();
       
    49 
       
    50     /**
       
    51      * Returns the context title set by service requestee
       
    52      *
       
    53      * @return QString the title
       
    54      *
       
    55      */
       
    56     QString contextTitle() const;
       
    57 
       
    58 	/*
       
    59 	 * Enum reflecting the services provided 
       
    60 	 */
       
    61     enum TVideoService
       
    62     {
       
    63         ENoService,
       
    64         EUriFetcher,
       
    65         EPlayback
       
    66     };
       
    67 
       
    68     /**
       
    69      * Returns service active status
       
    70      *
       
    71      * @return bool true if active, false if not active
       
    72      *
       
    73      */
       
    74     VideoServices::TVideoService currentService();
       
    75 
       
    76 public slots:
       
    77     void itemSelected(const QString& item);
       
    78 
       
    79 signals:
       
    80 	/*
       
    81 	 * Emitted when service user has set the title
       
    82 	 */    
       
    83 	void titleReady(const QString& title);
       
    84 
       
    85 	/*
       
    86 	 * Emitted to acticate requested plugin
       
    87 	 */
       
    88 	void activated(int command);
       
    89 
       
    90 private:
       
    91 
       
    92     /**
       
    93      * Constructor
       
    94      */
       
    95     VideoServices();
       
    96 
       
    97     /**
       
    98      * Constructor
       
    99      */
       
   100     VideoServices(QVideoPlayerEngine* engine);
       
   101 
       
   102     /**
       
   103      * Destructor.
       
   104      */
       
   105     virtual ~VideoServices();
       
   106 
       
   107     void setEngine(QVideoPlayerEngine* engine);
       
   108 
       
   109     /**
       
   110      * Sets the active service
       
   111      *
       
   112      * @param service
       
   113      *
       
   114      */
       
   115     void setCurrentService(VideoServices::TVideoService service);
       
   116 
       
   117     /**
       
   118      * Returns the current engine
       
   119      *
       
   120      * @return engine
       
   121      *
       
   122      */
       
   123     QVideoPlayerEngine* engine();
       
   124 
       
   125     Q_DISABLE_COPY(VideoServices)
       
   126 
       
   127 private:
       
   128 
       
   129     /**
       
   130      * Reference count.
       
   131      */
       
   132     int mReferenceCount;
       
   133 
       
   134     /**
       
   135      * Singleton instance.
       
   136      */
       
   137     static VideoServices* mInstance;
       
   138 
       
   139     /**
       
   140      * VideoServiceUriFetch service instance.
       
   141      */
       
   142     VideoServiceUriFetch* mServiceUriFetch;
       
   143 
       
   144     /**
       
   145      * VideoServicePlay service instance.
       
   146      */
       
   147     VideoServicePlay* mServicePlay;
       
   148 
       
   149     /**
       
   150      * Pointer of QVideoPlayerEngine.
       
   151      */
       
   152     QVideoPlayerEngine* mEngine;
       
   153 
       
   154 	/*
       
   155 	 * Current service
       
   156 	 */
       
   157     VideoServices::TVideoService mCurrentService;
       
   158 
       
   159     friend class VideoServiceUriFetch;
       
   160 
       
   161     friend class VideoServicePlay;
       
   162     };
       
   163 
       
   164 #endif //__VIDEOSERVICES_H__