videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolpolicy.cpp
changeset 52 e3cecb93e76a
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
       
     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:  Implementation of VideoPlaybackControlPolicy
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: da1mmcf#15 %
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include "mpxvideo_debug.h"
       
    25 #include "videoplaybackcontrolpolicy.h"
       
    26 #include "videoplaybackviewfiledetails.h"
       
    27 
       
    28 // ================= MEMBER FUNCTIONS ==============================================================
       
    29 
       
    30 // -------------------------------------------------------------------------------------------------
       
    31 // CMPXVideoPlaybackControlPolicy::CMPXVideoPlaybackControlPolicy()
       
    32 // C++ default constructor can NOT contain any code, that might leave.
       
    33 // -------------------------------------------------------------------------------------------------
       
    34 //
       
    35 VideoPlaybackControlPolicy::VideoPlaybackControlPolicy()
       
    36 {
       
    37     MPX_DEBUG(_L("VideoPlaybackControlPolicy::VideoPlaybackControlPolicy()"));
       
    38 }
       
    39 
       
    40 // -------------------------------------------------------------------------------------------------
       
    41 // VideoPlaybackControlPolicy::~VideoPlaybackControlPolicy()
       
    42 // Destructor.
       
    43 // -------------------------------------------------------------------------------------------------
       
    44 //
       
    45 VideoPlaybackControlPolicy::~VideoPlaybackControlPolicy()
       
    46 {
       
    47     MPX_DEBUG(_L("VideoPlaybackControlPolicy::~VideoPlaybackControlPolicy()"));
       
    48 }
       
    49 
       
    50 // -------------------------------------------------------------------------------------------------
       
    51 // VideoPlaybackControlPolicy::setControlProperties()
       
    52 // -------------------------------------------------------------------------------------------------
       
    53 //
       
    54 void 
       
    55 VideoPlaybackControlPolicy::setControlProperties( TVideoPlaybackControls controlIndex,
       
    56                                                   TUint& properties,
       
    57                                                   VideoPlaybackViewFileDetails *details,
       
    58                                                   TPlaybackViewMode viewMode )
       
    59 {
       
    60     MPX_DEBUG(_L("VideoPlaybackControlPolicy::setControlProperties()"));
       
    61 
       
    62     properties = 0;
       
    63 
       
    64     switch ( controlIndex )
       
    65     {
       
    66         case EBufferingAnimation:
       
    67         {
       
    68             properties = EShownWhenInitializing |
       
    69                          EShownWhenBuffering;
       
    70             break;
       
    71         }
       
    72         case EStatusPane:
       
    73         {
       
    74             //
       
    75             // If it is local playback & full screen view, show the controls while buffering
       
    76             // If not, won't show
       
    77             //
       
    78             if ( details->mPlaybackMode == EMPXVideoLocal && viewMode == EFullScreenView )
       
    79             {
       
    80                 properties = EShownWhenPlaying |
       
    81                              EShownWhenPaused |
       
    82                              EShownWhenSeeking |
       
    83                              EShownWhenBuffering;
       
    84             }
       
    85             else
       
    86             {                
       
    87                 properties = EAllProperties;
       
    88             }
       
    89             break;
       
    90         }
       
    91         case EControlBar:
       
    92         {
       
    93             //
       
    94             // We don't delete Tool Bar and Progress Bar from the controlsList 
       
    95             // to update information all the time though it's not visible or activated
       
    96             // So just hide these if it is details view
       
    97             //
       
    98             if ( viewMode == EDetailsView )
       
    99             {
       
   100                 properties = 0;
       
   101             }
       
   102             else if ( viewMode == EAudioOnlyView )
       
   103             {
       
   104                 properties = EAllProperties;
       
   105             }
       
   106             else
       
   107             {
       
   108                 //
       
   109                 // If it is local playback, show the controls while buffering
       
   110                 // If not, won't show
       
   111                 //
       
   112                 if ( details->mPlaybackMode == EMPXVideoLocal )
       
   113                 {
       
   114                     properties = EShownWhenPlaying |
       
   115                                  EShownWhenPaused |
       
   116                                  EShownWhenSeeking |
       
   117                                  EShownWhenBuffering;                    
       
   118                 }
       
   119                 else
       
   120                 {
       
   121                     properties = EShownWhenPlaying |
       
   122                                  EShownWhenPaused |
       
   123                                  EShownWhenSeeking;                    
       
   124                 }
       
   125             }
       
   126             break;
       
   127         }
       
   128         case EFileDetailsWidget:
       
   129         case EIndicatorBitmap:
       
   130         case ERealLogoBitmap:
       
   131         case EDetailsViewPlaybackWindow:
       
   132         {
       
   133             //
       
   134             // Add all these controls when it is details view or audio only view
       
   135             // Once it's added to controlsList, these are visible always
       
   136             //
       
   137             properties = EAllProperties;
       
   138             break;
       
   139         }
       
   140     }
       
   141 }
       
   142 
       
   143 // End of File