videocollection/tsrc/stubs/src/videoservices.cpp
changeset 52 e3cecb93e76a
parent 24 7d93ee07fb27
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    13 *
    13 *
    14 * Description:  Implementation of VideoServices
    14 * Description:  Implementation of VideoServices
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 // Version : %version: %
       
    19 
    18 #include <qobject.h>
    20 #include <qobject.h>
    19 #include "videoplayerappexport.h"
    21 #include "videoplayerappexport.h"
    20 #include "videoservices.h"
    22 #include "videoservices.h"
    21 #include "videoserviceurifetch.h"
    23 #include "videoserviceurifetch.h"
    22 #include "videoservicebrowse.h"
    24 #include "videoservicebrowse.h"
    23 #include "xqserviceutilxtra.h"
    25 #include "xqserviceutilxtra.h"
    24 
    26 
    25 VideoServices* g_Instance = 0;
    27 VideoServices* g_Instance = 0;
    26 
    28 
    27 VideoServices* VideoServices::instance(QVideoPlayerEngine* engine)
    29 VideoServices* VideoServices::instance( VideoPlayerEngine* engine )
    28 {
    30 {
    29     static VideoServices* g_Instance = 0;
    31     static VideoServices* g_Instance = 0;
    30     
    32     
    31     if(!g_Instance)
    33     if ( ! g_Instance )
    32     {
    34     {
    33         g_Instance = new VideoServices(engine);
    35         g_Instance = new VideoServices( engine );
    34     }
    36     }
    35     else if(engine && !g_Instance->engine())
    37     else if ( engine && !g_Instance->engine() )
    36     {
    38     {
    37     	g_Instance->setEngine(engine);
    39     	g_Instance->setEngine( engine );
    38     }
    40     }
       
    41     
    39     g_Instance->mReferenceCount++;
    42     g_Instance->mReferenceCount++;
       
    43     
    40     return g_Instance;
    44     return g_Instance;
    41 }
    45 }
    42 
    46 
    43 void VideoServices::decreaseReferenceCount()
    47 void VideoServices::decreaseReferenceCount()
    44 {
    48 {
    45     if(g_Instance)
    49     if ( g_Instance )
    46     {
    50     {
    47         if(--g_Instance->mReferenceCount == 0)
    51         if ( --g_Instance->mReferenceCount == 0 )
    48         {
    52         {
    49             delete g_Instance;
    53             delete g_Instance;
    50             g_Instance = NULL;
    54             g_Instance = NULL;
    51         }
    55         }
    52     }
    56     }
    53 }
    57 }
    54 
    58 
    55 void VideoServices::setEngine(QVideoPlayerEngine* engine)
    59 void VideoServices::setEngine( VideoPlayerEngine* engine )
    56 {
    60 {
    57     Q_UNUSED(engine);
    61     Q_UNUSED(engine);
    58     // not stubbed
    62     // not stubbed
    59 }
    63 }
    60 
    64 
    61 QVideoPlayerEngine* VideoServices::engine()
    65 VideoPlayerEngine* VideoServices::engine()
    62 {
    66 {
    63     // not stubbed
    67     // not stubbed
    64     return 0;
    68     return 0;
    65 }
    69 }
    66 
    70 
    67 VideoServices::VideoServices(QVideoPlayerEngine* engine):
    71 VideoServices::VideoServices( VideoPlayerEngine* engine )
    68     mReferenceCount(0),
    72     : mReferenceCount( 0 )
    69     mEngine(engine),
    73     , mEngine( engine )
    70     mCurrentService(VideoServices::ENoService),
    74     , mCurrentService( VideoServices::ENoService )
    71     mSortRole(0)
    75     , mSortRole( 0 )
    72 {
    76 {
    73     mServiceUriFetch = new VideoServiceUriFetch(this, QLatin1String("TestListView"));
    77     mServiceUriFetch = new VideoServiceUriFetch( this, QLatin1String("TestListView") );
    74     mServiceBrowse = new VideoServiceBrowse(this, QLatin1String("TestListView"));
    78     mServiceBrowse = new VideoServiceBrowse( this, QLatin1String("TestListView") );
    75 }
    79 }
    76 
    80 
    77 VideoServices::~VideoServices()
    81 VideoServices::~VideoServices()
    78 {
    82 {
    79     delete mServiceUriFetch;
    83     delete mServiceUriFetch;
    87 
    91 
    88 int VideoServices::getBrowseCategory() const
    92 int VideoServices::getBrowseCategory() const
    89 {
    93 {
    90     int category = 0;
    94     int category = 0;
    91     
    95     
    92     if (mServiceBrowse)
    96     if ( mServiceBrowse )
    93     {
    97     {
    94         category = mServiceBrowse->getBrowseCategory();
    98         category = mServiceBrowse->getBrowseCategory();
    95     }
    99     }
    96     
   100     
    97     return category;
   101     return category;
    98 }
   102 }
    99 
   103 
   100 void VideoServices::setCurrentService(VideoServices::TVideoService service)
   104 void VideoServices::setCurrentService( VideoServices::TVideoService service )
   101 {
   105 {
   102 	mCurrentService = service;
   106 	mCurrentService = service;
   103 }
   107 }
   104 
   108 
   105 QString VideoServices::contextTitle() const
   109 QString VideoServices::contextTitle() const
   112 {
   116 {
   113     // not stubbed
   117     // not stubbed
   114     return mSortRole;
   118     return mSortRole;
   115 }
   119 }
   116 
   120 
   117 void VideoServices::itemSelected(const QString& item)
   121 void VideoServices::itemSelected( const QString& item )
   118 {
   122 {
   119     Q_UNUSED(item);
   123     Q_UNUSED(item);
   120     // not stubbed
   124     // not stubbed
   121 }
   125 }
   122 
   126