videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolbar.cpp
changeset 52 e3cecb93e76a
parent 47 45e72b57a2fd
child 59 a76e86df7ccd
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
     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 QMPXVideoPlaybackControlBar
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  7 %
       
    19 
       
    20 
       
    21 
       
    22 #include "mpxvideo_debug.h"
       
    23 #include "mpxvideoplaybacktoolbar.h"
       
    24 #include "mpxvideoplaybackcontrolbar.h"
       
    25 #include "mpxvideoplaybackprogressbar.h"
       
    26 #include "mpxcommonvideoplaybackview.hrh"
       
    27 #include "mpxvideoplaybackcontrolscontroller.h"
       
    28 
       
    29 
       
    30 // -------------------------------------------------------------------------------------------------
       
    31 // QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar()
       
    32 // -------------------------------------------------------------------------------------------------
       
    33 //
       
    34 QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar(
       
    35         QMPXVideoPlaybackControlsController* controller )
       
    36     : mController( controller )
       
    37 {
       
    38     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar"));
       
    39 
       
    40     //
       
    41     // create toolbar handler
       
    42     //
       
    43     mToolBar = new QMPXVideoPlaybackToolBar( mController );
       
    44 
       
    45     //
       
    46     // create progressbar handler
       
    47     //
       
    48     mProgressBar = new QMPXVideoPlaybackProgressBar( mController );
       
    49 }
       
    50 
       
    51 // -------------------------------------------------------------------------------------------------
       
    52 // QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
       
    53 // -------------------------------------------------------------------------------------------------
       
    54 //
       
    55 QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
       
    56 {
       
    57     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()"));
       
    58 
       
    59     if ( mProgressBar )
       
    60     {
       
    61         delete mProgressBar;
       
    62         mProgressBar = NULL;
       
    63     }
       
    64 
       
    65     if ( mToolBar )
       
    66     {
       
    67         delete mToolBar;
       
    68         mToolBar = NULL;
       
    69     }
       
    70 }
       
    71 
       
    72 // -------------------------------------------------------------------------------------------------
       
    73 // QMPXVideoPlaybackControlBar::initialize()
       
    74 // -------------------------------------------------------------------------------------------------
       
    75 //
       
    76 void QMPXVideoPlaybackControlBar::initialize()
       
    77 {
       
    78     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::initialize()"));
       
    79 
       
    80     if ( mProgressBar )
       
    81     {
       
    82         mProgressBar->initialize();
       
    83     }
       
    84 }
       
    85 
       
    86 // -------------------------------------------------------------------------------------------------
       
    87 // QMPXVideoPlaybackControlBar::updateState()
       
    88 // -------------------------------------------------------------------------------------------------
       
    89 //
       
    90 void QMPXVideoPlaybackControlBar::updateState( TMPXPlaybackState state )
       
    91 {
       
    92     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateState() state = %d"), state );
       
    93 
       
    94     if ( mToolBar )
       
    95     {
       
    96         mToolBar->updateState( state );
       
    97     }
       
    98 
       
    99     if ( mProgressBar )
       
   100     {
       
   101         mProgressBar->updateState( state );
       
   102     }
       
   103 }
       
   104 
       
   105 // -------------------------------------------------------------------------------------------------
       
   106 // QMPXVideoPlaybackControlBar::aspectRatioChanged()
       
   107 // -------------------------------------------------------------------------------------------------
       
   108 //
       
   109 void QMPXVideoPlaybackControlBar::aspectRatioChanged( int aspectRatio )
       
   110 {
       
   111     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
       
   112 
       
   113     if ( mToolBar )
       
   114     {
       
   115         mToolBar->aspectRatioChanged( aspectRatio );
       
   116     }
       
   117 }
       
   118 
       
   119 // -------------------------------------------------------------------------------------------------
       
   120 // QMPXVideoPlaybackControlBar::updateWithFileDetails()
       
   121 // -------------------------------------------------------------------------------------------------
       
   122 //
       
   123 void QMPXVideoPlaybackControlBar::updateWithFileDetails(
       
   124         QMPXVideoPlaybackViewFileDetails* details )
       
   125 {
       
   126     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::updateWithFileDetails()"));
       
   127 
       
   128     if ( mToolBar )
       
   129     {
       
   130         mToolBar->updateWithFileDetails( details );
       
   131     }
       
   132 
       
   133     if ( mProgressBar )
       
   134     {
       
   135         mProgressBar->updateWithFileDetails( details );
       
   136     }
       
   137 }
       
   138 
       
   139 // -------------------------------------------------------------------------------------------------
       
   140 // QMPXVideoPlaybackControlBar::setVisibleToControlBar()
       
   141 // -------------------------------------------------------------------------------------------------
       
   142 //
       
   143 void QMPXVideoPlaybackControlBar::setVisibleToControlBar( bool visible )
       
   144 {
       
   145     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::setVisibleToControlBar()"),
       
   146                    _L("visible = %d, current visibility = %d"), visible, isVisible() );
       
   147 
       
   148     if ( visible != isVisible() )
       
   149     {
       
   150         setVisible( visible );
       
   151         mToolBar->setVisible( visible );        
       
   152     }
       
   153 }
       
   154 
       
   155 
       
   156 // -------------------------------------------------------------------------------------------------
       
   157 // QMPXVideoPlaybackControlBar::durationChanged()
       
   158 // -------------------------------------------------------------------------------------------------
       
   159 //
       
   160 void QMPXVideoPlaybackControlBar::durationChanged( int duration )
       
   161 {
       
   162     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::durationChanged()"));
       
   163 
       
   164     if ( mProgressBar )
       
   165     {
       
   166         mProgressBar->durationChanged( duration );
       
   167     }
       
   168 
       
   169     if ( mToolBar )
       
   170     {
       
   171         mToolBar->durationChanged( duration );
       
   172     }
       
   173 }
       
   174 
       
   175 // -------------------------------------------------------------------------------------------------
       
   176 // QMPXVideoPlaybackControlBar::positionChanged()
       
   177 // -------------------------------------------------------------------------------------------------
       
   178 //
       
   179 void QMPXVideoPlaybackControlBar::positionChanged( int position )
       
   180 {
       
   181     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::positionChanged()"));
       
   182 
       
   183     if ( mProgressBar )
       
   184     {
       
   185         mProgressBar->positionChanged( position );
       
   186     }
       
   187 
       
   188     if ( mToolBar )
       
   189     {
       
   190         mToolBar->positionChanged( position );
       
   191     }
       
   192 }
       
   193 
       
   194 //End of file