videoplayback/videoplaybackview/controlsrc/videoplaybackcontrolbar.cpp
changeset 44 518105d52e45
child 58 d2b028fd1f7d
equal deleted inserted replaced
42:17f382c040b1 44:518105d52e45
       
     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 VideoPlaybackControlBar
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version:  8 %
       
    19 
       
    20 
       
    21 
       
    22 #include "mpxvideo_debug.h"
       
    23 #include "videoplaybacktoolbar.h"
       
    24 #include "videoplaybackcontrolbar.h"
       
    25 #include "videoplaybackprogressbar.h"
       
    26 #include "mpxcommonvideoplaybackview.hrh"
       
    27 #include "videoplaybackcontrolscontroller.h"
       
    28 
       
    29 
       
    30 // -------------------------------------------------------------------------------------------------
       
    31 // VideoPlaybackControlBar::VideoPlaybackControlBar()
       
    32 // -------------------------------------------------------------------------------------------------
       
    33 //
       
    34 VideoPlaybackControlBar::VideoPlaybackControlBar(
       
    35         VideoPlaybackControlsController* controller )
       
    36     : mController( controller )
       
    37 {
       
    38     MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::VideoPlaybackControlBar"));
       
    39 
       
    40     //
       
    41     // create toolbar handler
       
    42     //
       
    43     mToolBar = new VideoPlaybackToolBar( mController );
       
    44 
       
    45     //
       
    46     // create progressbar handler
       
    47     //
       
    48     mProgressBar = new VideoPlaybackProgressBar( mController );
       
    49 }
       
    50 
       
    51 // -------------------------------------------------------------------------------------------------
       
    52 // VideoPlaybackControlBar::~VideoPlaybackControlBar()
       
    53 // -------------------------------------------------------------------------------------------------
       
    54 //
       
    55 VideoPlaybackControlBar::~VideoPlaybackControlBar()
       
    56 {
       
    57     MPX_DEBUG(_L("VideoPlaybackControlBar::~VideoPlaybackControlBar()"));
       
    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 // VideoPlaybackControlBar::initialize()
       
    74 // -------------------------------------------------------------------------------------------------
       
    75 //
       
    76 void VideoPlaybackControlBar::initialize()
       
    77 {
       
    78     MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::initialize()"));
       
    79 
       
    80     if ( mProgressBar )
       
    81     {
       
    82         mProgressBar->initialize();
       
    83     }
       
    84 }
       
    85 
       
    86 // -------------------------------------------------------------------------------------------------
       
    87 // VideoPlaybackControlBar::updateState()
       
    88 // -------------------------------------------------------------------------------------------------
       
    89 //
       
    90 void VideoPlaybackControlBar::updateState( TMPXPlaybackState state )
       
    91 {
       
    92     MPX_DEBUG(_L("VideoPlaybackControlBar::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 // VideoPlaybackControlBar::aspectRatioChanged()
       
   107 // -------------------------------------------------------------------------------------------------
       
   108 //
       
   109 void VideoPlaybackControlBar::aspectRatioChanged( int aspectRatio )
       
   110 {
       
   111     MPX_DEBUG(_L("VideoPlaybackControlBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
       
   112 
       
   113     if ( mToolBar )
       
   114     {
       
   115         mToolBar->aspectRatioChanged( aspectRatio );
       
   116     }
       
   117 }
       
   118 
       
   119 // -------------------------------------------------------------------------------------------------
       
   120 // VideoPlaybackControlBar::updateWithFileDetails()
       
   121 // -------------------------------------------------------------------------------------------------
       
   122 //
       
   123 void VideoPlaybackControlBar::updateWithFileDetails(
       
   124         VideoPlaybackViewFileDetails* details )
       
   125 {
       
   126     MPX_DEBUG(_L("VideoPlaybackControlBar::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 // VideoPlaybackControlBar::setVisibleToControlBar()
       
   141 // -------------------------------------------------------------------------------------------------
       
   142 //
       
   143 void VideoPlaybackControlBar::setVisibleToControlBar( bool visible )
       
   144 {
       
   145     MPX_ENTER_EXIT(_L("VideoPlaybackControlBar::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 // VideoPlaybackControlBar::durationChanged()
       
   158 // -------------------------------------------------------------------------------------------------
       
   159 //
       
   160 void VideoPlaybackControlBar::durationChanged( int duration )
       
   161 {
       
   162     MPX_DEBUG(_L("VideoPlaybackControlBar::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 // VideoPlaybackControlBar::positionChanged()
       
   177 // -------------------------------------------------------------------------------------------------
       
   178 //
       
   179 void VideoPlaybackControlBar::positionChanged( int position )
       
   180 {
       
   181     MPX_DEBUG(_L("VideoPlaybackControlBar::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