videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/videoservices.cpp
changeset 36 8aed59de29f9
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
       
     1 /*
       
     2 * Copyright (c) 2010 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:   Implementation of VideoServices STUB
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 1 %
       
    19 
       
    20 #include "videoservices.h"
       
    21 #include "videoserviceurifetch.h"
       
    22 #include "mpxvideo_debug.h"
       
    23 
       
    24 
       
    25 VideoServices *VideoServices::mInstance = 0;
       
    26 int  VideoServices::mReferenceCount = 0;
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // VideoServices::instance()
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 VideoServices* VideoServices::instance()
       
    33 {
       
    34     MPX_DEBUG(_L("VideoServices::instance()"));
       
    35 
       
    36     if ( !mInstance )
       
    37     {
       
    38         mInstance = new VideoServices();
       
    39     }
       
    40 
       
    41     mInstance->mReferenceCount++;
       
    42 
       
    43     return mInstance;
       
    44 }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // VideoServices::decreaseReferenceCount()
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void VideoServices::decreaseReferenceCount()
       
    51 {
       
    52     MPX_DEBUG(_L("VideoServices::decreaseReferenceCount()"));
       
    53 
       
    54     if ( mInstance )
       
    55     {
       
    56         if ( --mInstance->mReferenceCount == 0 )
       
    57         {
       
    58             delete mInstance;
       
    59             mInstance = NULL;
       
    60         }
       
    61     }
       
    62 }
       
    63 
       
    64 
       
    65 // ----------------------------------------------------------------------------
       
    66 // VideoServices()
       
    67 // ----------------------------------------------------------------------------
       
    68 //
       
    69 VideoServices::VideoServices()
       
    70     : mCurrentService( VideoServices::ENoService )
       
    71     , mItemSelected( false )
       
    72 {
       
    73     MPX_DEBUG(_L("VideoServices::VideoServices()"));
       
    74 
       
    75     mServiceUriFetch = new VideoServiceUriFetch( this );
       
    76 }
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // ~VideoServices()
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 VideoServices::~VideoServices()
       
    83 {
       
    84     MPX_DEBUG(_L("VideoServices::~VideoServices()"));
       
    85 
       
    86     delete mServiceUriFetch;
       
    87 }
       
    88 
       
    89 
       
    90 // ----------------------------------------------------------------------------
       
    91 // currentService()
       
    92 // ----------------------------------------------------------------------------
       
    93 //
       
    94 VideoServices::TVideoService VideoServices::currentService()
       
    95 {
       
    96     MPX_DEBUG(_L("VideoServices::currentService() ret %d"), mCurrentService);
       
    97 
       
    98     return mCurrentService;
       
    99 }
       
   100 
       
   101 
       
   102 // ----------------------------------------------------------------------------
       
   103 // setCurrentService()
       
   104 // ----------------------------------------------------------------------------
       
   105 //
       
   106 void VideoServices::setCurrentService( VideoServices::TVideoService service )
       
   107 {
       
   108     MPX_DEBUG(_L("VideoServices::setCurrentService(%d)"), service);
       
   109 
       
   110     mCurrentService = service;
       
   111 }
       
   112 
       
   113 // ----------------------------------------------------------------------------
       
   114 // itemSelected()
       
   115 // ----------------------------------------------------------------------------
       
   116 //
       
   117 void VideoServices::itemSelected( const QString& item )
       
   118 {
       
   119     MPX_DEBUG(_L("VideoServices::itemSelected()") );
       
   120     
       
   121     Q_UNUSED( item );
       
   122 
       
   123     mItemSelected = true;
       
   124 }