videoplayback/videoplaybackcontrols/src/mpxvideoplaybackcontrolpolicy.cpp
branchRCL_3
changeset 57 befca0ec475f
child 70 375929f879c2
equal deleted inserted replaced
56:839377eedc2b 57:befca0ec475f
       
     1 /*
       
     2 * Copyright (c) 2008 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 MPXVideoPlaybackControlPolicy
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Version : %version: 10 %
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include "mpxvideo_debug.h"
       
    25 #include "mpxvideoplaybackviewfiledetails.h"
       
    26 #include "mpxvideoplaybackcontrolpolicy.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 CMPXVideoPlaybackControlPolicy::CMPXVideoPlaybackControlPolicy()
       
    36 {
       
    37     MPX_DEBUG(_L("CMPXVideoPlaybackControlPolicy::CMPXVideoPlaybackControlPolicy()"));
       
    38 }
       
    39 
       
    40 // -------------------------------------------------------------------------------------------------
       
    41 // CMPXVideoPlaybackControlPolicy::ConstructL()
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -------------------------------------------------------------------------------------------------
       
    44 //
       
    45 void CMPXVideoPlaybackControlPolicy::ConstructL()
       
    46 {
       
    47     MPX_DEBUG(_L("CMPXVideoPlaybackControlPolicy::ConstructL()"));
       
    48 }
       
    49 
       
    50 // -------------------------------------------------------------------------------------------------
       
    51 // CMPXVideoPlaybackControlPolicy::NewL()
       
    52 // Two-phased constructor.
       
    53 // -------------------------------------------------------------------------------------------------
       
    54 //
       
    55 CMPXVideoPlaybackControlPolicy* CMPXVideoPlaybackControlPolicy::NewL()
       
    56 {
       
    57     MPX_DEBUG(_L("CMPXVideoPlaybackControlPolicy::NewL()"));
       
    58 
       
    59     CMPXVideoPlaybackControlPolicy* self = new (ELeave) CMPXVideoPlaybackControlPolicy();
       
    60 
       
    61     CleanupStack::PushL(self);
       
    62     self->ConstructL();
       
    63     CleanupStack::Pop();
       
    64 
       
    65     return self;
       
    66 }
       
    67 
       
    68 // -------------------------------------------------------------------------------------------------
       
    69 // CMPXVideoPlaybackControlPolicy::~CMPXVideoPlaybackControlPolicy()
       
    70 // Destructor.
       
    71 // -------------------------------------------------------------------------------------------------
       
    72 //
       
    73 CMPXVideoPlaybackControlPolicy::~CMPXVideoPlaybackControlPolicy()
       
    74 {
       
    75     MPX_DEBUG(_L("CMPXVideoPlaybackControlPolicy::~CMPXVideoPlaybackControlPolicy()"));
       
    76 }
       
    77 
       
    78 // -------------------------------------------------------------------------------------------------
       
    79 // CMPXVideoPlaybackControlPolicy::SetControlProperties()
       
    80 // -------------------------------------------------------------------------------------------------
       
    81 //
       
    82 void CMPXVideoPlaybackControlPolicy::SetControlProperties(
       
    83                                          TMPXVideoPlaybackControls aControlIndex,
       
    84                                          TUint& aProperties,
       
    85                                          CMPXVideoPlaybackViewFileDetails* aDetails )
       
    86 {
       
    87     MPX_DEBUG(_L("CMPXVideoPlaybackControlPolicy::SetControlProperties()"));
       
    88 
       
    89     aProperties = 0;
       
    90 
       
    91     switch ( aControlIndex )
       
    92     {
       
    93         case EMPXSoftkeyBack:
       
    94         {
       
    95             //
       
    96             //  Transitory Buffering states will be filtered out by the View
       
    97             //
       
    98             aProperties = EMPXBufferingControl | EMPXShownWhenInitializing;
       
    99         }
       
   100         case EMPXSoftkeyDetails:
       
   101         {
       
   102             aProperties += EMPXSoftkeyControl |
       
   103                            EMPXShownWhenPlaying |
       
   104                            EMPXShownWhenPaused |
       
   105                            EMPXShownWhenStopped |
       
   106                            EMPXShownWhenSeeking;
       
   107             break;
       
   108         }
       
   109         case EMPXBufferingLabel:
       
   110         {
       
   111             aProperties = EMPXBufferingControl;
       
   112 
       
   113             //
       
   114             //  Show Loading when Initializing for local playback modes
       
   115             //  This allows for a smoother transition to playing state
       
   116             //
       
   117             if ( aDetails->iPlaybackMode == EMPXVideoLocal ||
       
   118                  aDetails->iPlaybackMode ==  EMPXVideoProgressiveDownload )
       
   119             {
       
   120                 aProperties += EMPXShownWhenInitializing;
       
   121             }
       
   122             break;
       
   123         }
       
   124         case EMPXTitleLabel:
       
   125         case EMPXArtistLabel:
       
   126         {
       
   127             aProperties = EMPXBufferingControl;
       
   128         }
       
   129         case EMPXButtonBar:
       
   130         case EMPXProgressBar:
       
   131         case EMPXVolumeBar:
       
   132         case EMPXAspectRatioIcon:
       
   133         {
       
   134             aProperties += EMPXShownWhenPlaying |
       
   135                            EMPXShownWhenPaused |
       
   136                            EMPXShownWhenStopped |
       
   137                            EMPXShownWhenSeeking;
       
   138             break;
       
   139         }
       
   140         case EMPXNoVideoBitmap:
       
   141         case EMPXRealAudioBitmap:
       
   142         case EMPXSoundBitmap:
       
   143         {
       
   144             aProperties = EMPXBufferingControl |
       
   145                           EMPXShownWhenPlaying |
       
   146                           EMPXShownWhenPaused |
       
   147                           EMPXShownWhenStopped |
       
   148                           EMPXShownWhenSeeking;
       
   149             break;
       
   150         }
       
   151         case EMPXDownloadPausedIcon:
       
   152         {
       
   153             aProperties = EMPXAllProperties;
       
   154             break;
       
   155         }
       
   156         case EMPXVideoPausedIcon:
       
   157         {
       
   158             aProperties = EMPXShownWhenPaused;
       
   159             break;
       
   160         }
       
   161         case EMPXBrandingAnimation:
       
   162         {
       
   163             aProperties = EMPXShownWhenInitializing;
       
   164             break;
       
   165         }
       
   166     }
       
   167 }
       
   168 
       
   169 // End of File