videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolbar.cpp
changeset 41 229f037ce963
parent 37 4eb2df7f7cbe
equal deleted inserted replaced
40:13331705e488 41:229f037ce963
    13 *
    13 *
    14 * Description:  Implementation of QMPXVideoPlaybackControlBar
    14 * Description:  Implementation of QMPXVideoPlaybackControlBar
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  6 %
    18 // Version : %version:  7 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 #include "mpxvideo_debug.h"
    22 #include "mpxvideo_debug.h"
    23 #include "mpxvideoplaybacktoolbar.h"
    23 #include "mpxvideoplaybacktoolbar.h"
    24 #include "mpxvideoplaybackcontrolbar.h"
    24 #include "mpxvideoplaybackcontrolbar.h"
    25 #include "mpxvideoplaybackprogressbar.h"
    25 #include "mpxvideoplaybackprogressbar.h"
    26 #include "mpxcommonvideoplaybackview.hrh"
    26 #include "mpxcommonvideoplaybackview.hrh"
    27 #include "mpxvideoplaybackdocumentloader.h"
       
    28 #include "mpxvideoplaybackcontrolscontroller.h"
    27 #include "mpxvideoplaybackcontrolscontroller.h"
    29 
    28 
    30 
    29 
    31 // -------------------------------------------------------------------------------------------------
    30 // -------------------------------------------------------------------------------------------------
    32 // QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar()
    31 // QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar()
    33 // -------------------------------------------------------------------------------------------------
    32 // -------------------------------------------------------------------------------------------------
    34 //
    33 //
    35 QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar( 
    34 QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar(
    36         QMPXVideoPlaybackControlsController* controller )
    35         QMPXVideoPlaybackControlsController* controller )
    37     : mController( controller )
    36     : mController( controller )
    38     , mProgressBar( NULL )
       
    39 {
    37 {
    40     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar"));
    38     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::QMPXVideoPlaybackControlBar"));
    41 
    39 
    42     //
    40     //
    43     // button bar
    41     // create toolbar handler
    44     //
    42     //
    45     mToolBar = new QMPXVideoPlaybackToolBar( mController );
    43     mToolBar = new QMPXVideoPlaybackToolBar( mController );
       
    44 
       
    45     //
       
    46     // create progressbar handler
       
    47     //
       
    48     mProgressBar = new QMPXVideoPlaybackProgressBar( mController );
    46 }
    49 }
    47 
    50 
    48 // -------------------------------------------------------------------------------------------------
    51 // -------------------------------------------------------------------------------------------------
    49 // QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
    52 // QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
    50 // -------------------------------------------------------------------------------------------------
    53 // -------------------------------------------------------------------------------------------------
    51 //
    54 //
    52 QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
    55 QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()
    53 {
    56 {
    54     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()"));
    57     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::~QMPXVideoPlaybackControlBar()"));
       
    58 
       
    59     if ( mProgressBar )
       
    60     {
       
    61         delete mProgressBar;
       
    62         mProgressBar = NULL;
       
    63     }
    55 
    64 
    56     if ( mToolBar )
    65     if ( mToolBar )
    57     {
    66     {
    58         delete mToolBar;
    67         delete mToolBar;
    59         mToolBar = NULL;
    68         mToolBar = NULL;
    66 //
    75 //
    67 void QMPXVideoPlaybackControlBar::initialize()
    76 void QMPXVideoPlaybackControlBar::initialize()
    68 {
    77 {
    69     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::initialize()"));
    78     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlBar::initialize()"));
    70 
    79 
    71     QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
    80     if ( mProgressBar )
    72 
       
    73     //
       
    74     // Don't need to initialize buttons once it gets initialized
       
    75     //
       
    76     if ( mProgressBar == NULL )
       
    77     {
    81     {
    78         //
    82         mProgressBar->initialize();
    79         // progress bar
       
    80         //
       
    81         QGraphicsWidget *widget = loader->findWidget( QString( "progressBarLayout" ) );
       
    82         mProgressBar = qobject_cast<QMPXVideoPlaybackProgressBar*>( widget );
       
    83 
       
    84         if ( mProgressBar )
       
    85         {
       
    86             mProgressBar->initialize();
       
    87         }
       
    88     }
    83     }
    89 }
    84 }
    90 
    85 
    91 // -------------------------------------------------------------------------------------------------
    86 // -------------------------------------------------------------------------------------------------
    92 // QMPXVideoPlaybackControlBar::updateState()
    87 // QMPXVideoPlaybackControlBar::updateState()
   155         setVisible( visible );
   150         setVisible( visible );
   156         mToolBar->setVisible( visible );        
   151         mToolBar->setVisible( visible );        
   157     }
   152     }
   158 }
   153 }
   159 
   154 
   160 // -------------------------------------------------------------------------------------------------
       
   161 // QMPXVideoPlaybackControlBar::appeared()
       
   162 // -------------------------------------------------------------------------------------------------
       
   163 //
       
   164 void QMPXVideoPlaybackControlBar::appeared( const HbEffect::EffectStatus &status )
       
   165 {
       
   166     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared()"));
       
   167 
       
   168     if ( status.reason == Hb::EffectFinished )
       
   169     {
       
   170         MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared() successful"));
       
   171     }
       
   172     else
       
   173     {
       
   174         MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::appeared() NOT successful"));
       
   175     }
       
   176 }
       
   177 
       
   178 // -------------------------------------------------------------------------------------------------
       
   179 // QMPXVideoPlaybackControlBar::disappeared()
       
   180 // -------------------------------------------------------------------------------------------------
       
   181 //
       
   182 void QMPXVideoPlaybackControlBar::disappeared( const HbEffect::EffectStatus &status )
       
   183 {
       
   184     MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared()"));
       
   185 
       
   186     if ( status.reason == Hb::EffectFinished )
       
   187     {
       
   188         setVisible( false );
       
   189 
       
   190         MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared() successful"));
       
   191     }
       
   192     else
       
   193     {
       
   194         MPX_DEBUG(_L("QMPXVideoPlaybackControlBar::disappeared() NOT successful"));
       
   195     }
       
   196 }
       
   197 
   155 
   198 // -------------------------------------------------------------------------------------------------
   156 // -------------------------------------------------------------------------------------------------
   199 // QMPXVideoPlaybackControlBar::durationChanged()
   157 // QMPXVideoPlaybackControlBar::durationChanged()
   200 // -------------------------------------------------------------------------------------------------
   158 // -------------------------------------------------------------------------------------------------
   201 //
   159 //
   224 
   182 
   225     if ( mProgressBar )
   183     if ( mProgressBar )
   226     {
   184     {
   227         mProgressBar->positionChanged( position );
   185         mProgressBar->positionChanged( position );
   228     }
   186     }
   229     
   187 
   230     if ( mToolBar )
   188     if ( mToolBar )
   231     {
   189     {
   232         mToolBar->positionChanged( position );
   190         mToolBar->positionChanged( position );
   233     }
   191     }
   234 }
   192 }