videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfullscreencontrol.cpp
changeset 35 3738fe97f027
child 17 69946d1824c4
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
       
     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 QMPXVideoPlaybackFullScreenControl
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: da1mmcf#8 %
       
    19 
       
    20 
       
    21 
       
    22 #include <w32std.h>
       
    23 
       
    24 #include "mpxvideo_debug.h"
       
    25 #include "mpxvideoplaybackcontrolbar.h"
       
    26 #include "mpxvideoplaybackfullscreencontrol.h"
       
    27 #include "mpxvideoplaybackfiledetailswidget.h"
       
    28 #include "mpxvideoplaybackcontrolscontroller.h"
       
    29 #include "mpxvideoplaybackdetailsplaybackwindow.h"
       
    30 
       
    31 
       
    32 // -------------------------------------------------------------------------------------------------
       
    33 // QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()
       
    34 // -------------------------------------------------------------------------------------------------
       
    35 //
       
    36 QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl( 
       
    37         QMPXVideoPlaybackControlsController* controller, 
       
    38         TMPXVideoPlaybackControls index, 
       
    39         HbWidget* widget, 
       
    40         TUint controlproperties )
       
    41     : mController( controller )
       
    42     , mControl( widget )
       
    43     , mControlIndex( index )
       
    44     , mProperties( controlproperties )
       
    45 {
       
    46     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()"));
       
    47 
       
    48     setParent( mController );
       
    49 }
       
    50 
       
    51 // -------------------------------------------------------------------------------------------------
       
    52 // QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
       
    53 // -------------------------------------------------------------------------------------------------
       
    54 //
       
    55 QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
       
    56 {
       
    57     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackFullScreenControl"));
       
    58 }
       
    59 
       
    60 // -------------------------------------------------------------------------------------------------
       
    61 // QMPXVideoPlaybackFullScreenControl::setVisible()
       
    62 // -------------------------------------------------------------------------------------------------
       
    63 //
       
    64 void QMPXVideoPlaybackFullScreenControl::setVisible( bool visible )
       
    65 {
       
    66     switch ( mControlIndex )
       
    67     {
       
    68         case EMPXControlBar:
       
    69         {
       
    70             static_cast<QMPXVideoPlaybackControlBar*>(mControl)->setVisibleToControlBar( visible );
       
    71             break;
       
    72         }
       
    73         default:
       
    74         {
       
    75             mControl->setVisible( visible );
       
    76             break;
       
    77         }
       
    78     }
       
    79 }
       
    80 
       
    81 // -------------------------------------------------------------------------------------------------
       
    82 // QMPXVideoPlaybackFullScreenControl::isVisible()
       
    83 // -------------------------------------------------------------------------------------------------
       
    84 //
       
    85 bool QMPXVideoPlaybackFullScreenControl::isVisible()
       
    86 {
       
    87     return mControl->isVisible();
       
    88 }
       
    89 
       
    90 // -------------------------------------------------------------------------------------------------
       
    91 // QMPXVideoPlaybackFullScreenControl::setVisibility()
       
    92 // -------------------------------------------------------------------------------------------------
       
    93 //
       
    94 void QMPXVideoPlaybackFullScreenControl::setVisibility( TMPXPlaybackState state )
       
    95 {
       
    96     MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::setVisibility()"));
       
    97 
       
    98     bool visible = false;
       
    99 
       
   100     switch( state )
       
   101     {
       
   102         case EPbStatePlaying:
       
   103         {
       
   104             if ( mProperties & EMPXShownWhenPlaying )
       
   105             {
       
   106                 visible = true;
       
   107             }
       
   108             break;
       
   109         }
       
   110         case EPbStatePaused:
       
   111         {
       
   112             if ( mProperties & EMPXShownWhenPaused )
       
   113             {
       
   114                 visible = true;
       
   115             }
       
   116             break;
       
   117         }
       
   118         case EPbStatePluginSeeking:
       
   119         {
       
   120             if ( mProperties & EMPXShownWhenSeeking )
       
   121             {
       
   122                 visible = true;
       
   123             }
       
   124             break;
       
   125         }
       
   126         case EPbStateBuffering:
       
   127         {
       
   128             if ( mProperties & EMPXShownWhenBuffering )
       
   129             {
       
   130                 visible = true;
       
   131             }
       
   132             break;
       
   133         }
       
   134         case EPbStateNotInitialised:
       
   135         case EPbStateInitialising:
       
   136         {
       
   137             if ( mProperties & EMPXShownWhenInitializing )
       
   138             {
       
   139                 visible = true;
       
   140             }
       
   141             break;
       
   142         }
       
   143     }
       
   144 
       
   145     setVisible( visible );
       
   146 }
       
   147 
       
   148 // -------------------------------------------------------------------------------------------------
       
   149 // QMPXVideoPlaybackFullScreenControl::controlIndex()
       
   150 // -------------------------------------------------------------------------------------------------
       
   151 //
       
   152 TMPXVideoPlaybackControls QMPXVideoPlaybackFullScreenControl::controlIndex()
       
   153 {
       
   154     return mControlIndex;
       
   155 }
       
   156 
       
   157 // -------------------------------------------------------------------------------------------------
       
   158 // QMPXVideoPlaybackFullScreenControl::volumeChanged()
       
   159 // -------------------------------------------------------------------------------------------------
       
   160 //
       
   161 bool QMPXVideoPlaybackFullScreenControl::volumeChanged( int volume )
       
   162 {
       
   163     bool changed = EFalse;
       
   164 
       
   165     if ( mControlIndex == EMPXControlBar )
       
   166     {
       
   167         MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::volumeChanged() [%d]"), volume);
       
   168 
       
   169         //static_cast<QMPXVideoPlaybackButtonBar*>(mControl)->volumeChanged( volume );
       
   170 
       
   171         changed = ETrue;
       
   172     }
       
   173 
       
   174     return changed;
       
   175 }
       
   176 
       
   177 // -------------------------------------------------------------------------------------------------
       
   178 // QMPXVideoPlaybackFullScreenControl::durationChanged()
       
   179 // -------------------------------------------------------------------------------------------------
       
   180 //
       
   181 bool QMPXVideoPlaybackFullScreenControl::durationChanged( int duration )
       
   182 {
       
   183     bool changed = EFalse;
       
   184 
       
   185     if ( mControlIndex == EMPXControlBar )
       
   186     {
       
   187         MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::DurationChanged() [%d]"), duration);
       
   188 
       
   189         static_cast<QMPXVideoPlaybackControlBar*>(mControl)->durationChanged( duration );
       
   190 
       
   191         changed = ETrue;
       
   192     }
       
   193 
       
   194     return changed;
       
   195 }
       
   196 
       
   197 // -------------------------------------------------------------------------------------------------
       
   198 // QMPXVideoPlaybackFullScreenControl::positionChanged()
       
   199 // -------------------------------------------------------------------------------------------------
       
   200 //
       
   201 bool QMPXVideoPlaybackFullScreenControl::positionChanged( int position )
       
   202 {
       
   203     bool changed = EFalse;
       
   204 
       
   205     if ( mControlIndex == EMPXControlBar )
       
   206     {
       
   207         MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::positionChanged() [%d]"), position);
       
   208 
       
   209         static_cast<QMPXVideoPlaybackControlBar*>(mControl)->positionChanged( position );
       
   210 
       
   211         changed = ETrue;
       
   212     }
       
   213 
       
   214     return changed;
       
   215 }
       
   216 
       
   217 // -------------------------------------------------------------------------------------------------
       
   218 // QMPXVideoPlaybackFullScreenControl::aspectRatioChanged()
       
   219 // -------------------------------------------------------------------------------------------------
       
   220 //
       
   221 bool QMPXVideoPlaybackFullScreenControl::aspectRatioChanged( int aspectRatio )
       
   222 {
       
   223     bool changed = EFalse;
       
   224 
       
   225     if ( mControlIndex == EMPXControlBar )
       
   226     {
       
   227         MPX_DEBUG(
       
   228             _L("QMPXVideoPlaybackFullScreenControl::aspectRatioChanged() [%d]"), aspectRatio);
       
   229 
       
   230         static_cast<QMPXVideoPlaybackControlBar*>(mControl)->aspectRatioChanged( aspectRatio );
       
   231 
       
   232         changed = ETrue;
       
   233     }
       
   234 
       
   235     return changed;
       
   236 }
       
   237 
       
   238 // -------------------------------------------------------------------------------------------------
       
   239 //   QMPXVideoPlaybackFullScreenControl::setDownloadSize()
       
   240 // -------------------------------------------------------------------------------------------------
       
   241 //
       
   242 bool QMPXVideoPlaybackFullScreenControl::setDownloadSize( int /*size*/ )
       
   243 {
       
   244     bool changed = EFalse;
       
   245 
       
   246     /*
       
   247     if ( mControlIndex == EMPXProgressBar )
       
   248     {
       
   249         MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::SetDownloadSize() [%d]"), size);
       
   250 
       
   251         //static_cast<CMPXVideoPlaybackProgressBar*>(mControl)->SetDownloadSize( size );
       
   252 
       
   253         changed = ETrue;
       
   254     }
       
   255 */
       
   256     return changed;
       
   257 }
       
   258 
       
   259 // -------------------------------------------------------------------------------------------------
       
   260 //   QMPXVideoPlaybackFullScreenControl::updateDownloadPosition()
       
   261 // -------------------------------------------------------------------------------------------------
       
   262 //
       
   263 bool QMPXVideoPlaybackFullScreenControl::updateDownloadPosition( int /*size*/ )
       
   264 {
       
   265     bool changed = EFalse;
       
   266 
       
   267     /*
       
   268     if ( mControlIndex == EMPXProgressBar )
       
   269     {
       
   270         MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::UpdateDownloadPosition() [%d]"), size);
       
   271 
       
   272         //static_cast<CMPXVideoPlaybackProgressBar*>(mControl)->updateDownloadPosition( size );
       
   273 
       
   274         changed = ETrue;
       
   275     }*/
       
   276 
       
   277     return changed;
       
   278 }
       
   279 
       
   280 // -------------------------------------------------------------------------------------------------
       
   281 // QMPXVideoPlaybackFullScreenControl::updateState()
       
   282 // -------------------------------------------------------------------------------------------------
       
   283 //
       
   284 void QMPXVideoPlaybackFullScreenControl::updateState( TMPXPlaybackState state )
       
   285 {
       
   286     switch ( mControlIndex )
       
   287     {
       
   288         case EMPXControlBar:
       
   289         {
       
   290             static_cast<QMPXVideoPlaybackControlBar*>(mControl)->updateState( state );
       
   291             break;
       
   292         }
       
   293         case EMPXDetailsViewPlaybackWindow:
       
   294         {
       
   295             static_cast<QMPXVideoPlaybackDetailsPlaybackWindow*>(mControl)->updateState( state );
       
   296             break;
       
   297         }
       
   298     }
       
   299 }
       
   300 
       
   301 // -------------------------------------------------------------------------------------------------
       
   302 // QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails()
       
   303 // -------------------------------------------------------------------------------------------------
       
   304 //
       
   305 void QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails(
       
   306         QMPXVideoPlaybackViewFileDetails* details )
       
   307 {
       
   308     switch ( mControlIndex )
       
   309     {
       
   310         case EMPXControlBar:
       
   311         {
       
   312             static_cast<QMPXVideoPlaybackControlBar*>(mControl)->updateWithFileDetails( details );
       
   313             break;
       
   314         }
       
   315         case EMPXFileDetailsWidget:
       
   316         {
       
   317             static_cast<QMPXVideoPlaybackFileDetailsWidget*>(mControl)->updateWithFileDetails( details );
       
   318             break;
       
   319         }
       
   320     }
       
   321 }
       
   322 
       
   323 // -------------------------------------------------------------------------------------------------
       
   324 // QMPXVideoPlaybackFullScreenControl::updateControlProperties()
       
   325 // -------------------------------------------------------------------------------------------------
       
   326 //
       
   327 void QMPXVideoPlaybackFullScreenControl::updateControlProperties( TUint properties )
       
   328 {
       
   329     mProperties = properties;
       
   330 }
       
   331 
       
   332 // End of file