videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolconfiguration.cpp
changeset 44 518105d52e45
child 50 21fe8338c6bf
equal deleted inserted replaced
42:17f382c040b1 44:518105d52e45
       
     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 VideoPlaybackControlConfiguration
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: da1mmcf#23 %
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <QGraphicsWidget>
       
    25 
       
    26 #include "mpxvideo_debug.h"
       
    27 #include "videoplaybackdocumentloader.h"
       
    28 #include "videoplaybackviewfiledetails.h"
       
    29 #include "videoplaybackcontrolconfiguration.h"
       
    30 #include "videoplaybackcontrolscontroller.h"
       
    31 
       
    32 
       
    33 // ================= MEMBER FUNCTIONS ==============================================================
       
    34 
       
    35 // -------------------------------------------------------------------------------------------------
       
    36 // VideoPlaybackControlConfiguration::VideoPlaybackControlConfiguration()
       
    37 // -------------------------------------------------------------------------------------------------
       
    38 //
       
    39 VideoPlaybackControlConfiguration::VideoPlaybackControlConfiguration(
       
    40         VideoPlaybackControlsController* controller)
       
    41     : mControlsController( controller )
       
    42 {
       
    43 }
       
    44 
       
    45 // -------------------------------------------------------------------------------------------------
       
    46 // VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
       
    47 // Destructor.
       
    48 // -------------------------------------------------------------------------------------------------
       
    49 //
       
    50 VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration()
       
    51 {
       
    52     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::~VideoPlaybackControlConfiguration"));
       
    53 
       
    54     mControlsList.clear();
       
    55 }
       
    56 
       
    57 // -------------------------------------------------------------------------------------------------
       
    58 // VideoPlaybackControlConfiguration::createControlList()
       
    59 // -------------------------------------------------------------------------------------------------
       
    60 //
       
    61 void VideoPlaybackControlConfiguration::createControlList()
       
    62 {
       
    63     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::createControlList()"));
       
    64 
       
    65     VideoPlaybackViewFileDetails* fileDetails = mControlsController->fileDetails();
       
    66 
       
    67     addControlToList( EStatusPane );
       
    68 
       
    69     if ( fileDetails->mPlaybackMode == EMPXVideoStreaming ||
       
    70          fileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
       
    71     {
       
    72         //
       
    73         // streaming, add branding animation control to show while initializing
       
    74         //
       
    75         addControlToList( EBufferingAnimation );
       
    76     }
       
    77     else if ( mControlsController->shouldShowRNLogo() )
       
    78     {
       
    79         addControlToList( ERealLogoBitmap );
       
    80     }
       
    81 
       
    82     emit controlListUpdated();
       
    83 }
       
    84 
       
    85 // -------------------------------------------------------------------------------------------------
       
    86 // VideoPlaybackControlConfiguration::controlList
       
    87 // -------------------------------------------------------------------------------------------------
       
    88 //
       
    89 QList<TVideoPlaybackControls>& VideoPlaybackControlConfiguration::controlList()
       
    90 {
       
    91     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::controlList()"));
       
    92 
       
    93     return mControlsList;
       
    94 }
       
    95 
       
    96 // -------------------------------------------------------------------------------------------------
       
    97 // VideoPlaybackControlConfiguration::updateControlList
       
    98 // -------------------------------------------------------------------------------------------------
       
    99 //
       
   100 void VideoPlaybackControlConfiguration::updateControlList(
       
   101     TVideoPlaybackControlCommandIds event )
       
   102 {
       
   103     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList(%d)"), event);
       
   104 
       
   105     QGraphicsWidget *widget = 
       
   106             mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
       
   107 
       
   108     switch ( event )
       
   109     {
       
   110         case EControlCmdFullScreenViewOpened:
       
   111         {
       
   112             MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() full screen view"));
       
   113 
       
   114             widget->setVisible( true );
       
   115 
       
   116             deleteControlFromList( EDetailsViewPlaybackWindow );
       
   117             deleteControlFromList( EFileDetailsWidget );
       
   118             deleteControlFromList( EIndicatorBitmap );
       
   119 
       
   120             break;
       
   121         }
       
   122         case EControlCmdDetailsViewOpened:
       
   123         {
       
   124             MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() details view"));
       
   125 
       
   126             widget->setVisible( false );
       
   127 
       
   128             deleteControlFromList( EIndicatorBitmap );
       
   129 
       
   130             addControlToList( EDetailsViewPlaybackWindow );
       
   131 
       
   132             addControlToList( EFileDetailsWidget );
       
   133 
       
   134             break;
       
   135         }
       
   136         case EControlCmdTvOutConnected:
       
   137         case EControlCmdAudionOnlyViewOpened:
       
   138         {
       
   139             MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() audio only view"));
       
   140 
       
   141             widget->setVisible( false );
       
   142 
       
   143             deleteControlFromList( EDetailsViewPlaybackWindow );
       
   144 
       
   145             addControlToList( EIndicatorBitmap );
       
   146             addControlToList( EFileDetailsWidget );
       
   147 
       
   148             break;
       
   149         }
       
   150         case EControlCmdRemoveRNLogo:
       
   151         {
       
   152             MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlList() RN Logo removed"));
       
   153 
       
   154             deleteControlFromList( ERealLogoBitmap );
       
   155 
       
   156             break;
       
   157         }
       
   158         default:
       
   159         {
       
   160             break;
       
   161         }
       
   162     }
       
   163 
       
   164     emit controlListUpdated();
       
   165 }
       
   166 
       
   167 // -------------------------------------------------------------------------------------------------
       
   168 // VideoPlaybackControlConfiguration::deleteControlFromList
       
   169 // -------------------------------------------------------------------------------------------------
       
   170 //
       
   171 void VideoPlaybackControlConfiguration::deleteControlFromList( TVideoPlaybackControls control )
       
   172 {
       
   173     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::deleteControlFromList(%d)"), control);
       
   174 
       
   175     mControlsList.removeAll( control );
       
   176 }
       
   177 
       
   178 // -------------------------------------------------------------------------------------------------
       
   179 // VideoPlaybackControlConfiguration::addControlToList
       
   180 // -------------------------------------------------------------------------------------------------
       
   181 //
       
   182 void VideoPlaybackControlConfiguration::addControlToList(
       
   183         TVideoPlaybackControls control )
       
   184 {
       
   185     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::addControlToList(%d)"), control);
       
   186 
       
   187     if ( ! mControlsList.contains( control ) )
       
   188     {
       
   189         mControlsList.append( control );
       
   190     }
       
   191 }
       
   192 
       
   193 // -------------------------------------------------------------------------------------------------
       
   194 // VideoPlaybackControlConfiguration::updateControlsWithFileDetails
       
   195 // -------------------------------------------------------------------------------------------------
       
   196 //
       
   197 void VideoPlaybackControlConfiguration::updateControlsWithFileDetails()
       
   198 {
       
   199     MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlsWithFileDetails()"));
       
   200 
       
   201     addControlToList( EControlBar );
       
   202 
       
   203     if ( mControlsController->fileDetails()->mVideoEnabled )
       
   204     {
       
   205         MPX_DEBUG(_L("VideoPlaybackControlConfiguration::updateControlsWithFileDetails() video enabled"));
       
   206 
       
   207         QGraphicsWidget *widget = 
       
   208                 mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
       
   209         widget->setVisible( true );
       
   210     }
       
   211 
       
   212     emit controlListUpdated();
       
   213 }
       
   214 
       
   215 // End of File