videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybacktoolbar.cpp
branchGCC_SURGE
changeset 48 ebbeb6bcda56
parent 47 45e72b57a2fd
equal deleted inserted replaced
27:7bf7319dbddd 48:ebbeb6bcda56
    13 *
    13 *
    14 * Description:  Implementation of QMPXVideoPlaybackToolBar
    14 * Description:  Implementation of QMPXVideoPlaybackToolBar
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version:  3 %
    18 // Version : %version:  7 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 #include <QTimer>
    22 #include <QTimer>
    23 #include <QGraphicsLayout>
    23 #include <QGraphicsLayout>
    24 
    24 
    25 #include <hbeffect.h>
       
    26 #include <hbaction.h>
    25 #include <hbaction.h>
    27 #include <hbtoolbar.h>
    26 #include <hbtoolbar.h>
    28 #include <hbinstance.h>
    27 #include <hbinstance.h>
    29 #include <hbtoolbutton.h>
    28 #include <hbtoolbutton.h>
    30 #include <w32std.h>
    29 #include <w32std.h>
    42 
    41 
    43 // -------------------------------------------------------------------------------------------------
    42 // -------------------------------------------------------------------------------------------------
    44 // QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar()
    43 // QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar()
    45 // -------------------------------------------------------------------------------------------------
    44 // -------------------------------------------------------------------------------------------------
    46 //
    45 //
    47 QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar( 
    46 QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar(
    48         QMPXVideoPlaybackControlsController* controller )
    47         QMPXVideoPlaybackControlsController* controller )
    49     : mController( controller )
    48     : mController( controller )
    50     , mSeekStartTimer( NULL )
    49     , mSeekStartTimer( NULL )
    51     , mRetrieveButtonTimer( NULL )
    50     , mRetrieveButtonTimer( NULL )
    52     , mSeekingState( EMPXNotSeeking )
    51     , mSeekingState( EMPXNotSeeking )
    53     , mInitialized( false )
    52     , mInitialized( false )
    54     , mNeverVisibled( true )
       
    55     , mPosition( 0 )
    53     , mPosition( 0 )
    56     , mDuration( 0 )
    54     , mDuration( 0 )
    57     , mAspectRatio( EMPXPbvCmdNaturalAspectRatio )
    55     , mAspectRatio( EMPXPbvCmdNaturalAspectRatio )
    58 {
    56 {
    59     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar"));
    57     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::QMPXVideoPlaybackToolBar"));
    60 
    58 
    61     mToolBar = mController->view()->toolBar();
    59     mToolBar = mController->view()->toolBar();
    62     mToolBar->setOrientation( Qt::Horizontal );
    60     mToolBar->setOrientation( Qt::Horizontal );
    63     HbEffect::disable( mToolBar );
    61 
    64     
       
    65     mController->view()->hideItems( Hb::ToolBarItem );
    62     mController->view()->hideItems( Hb::ToolBarItem );
    66 
    63 
    67     initialize();
    64     initialize();
    68 }
    65 }
    69 
    66 
    73 //
    70 //
    74 QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()
    71 QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()
    75 {
    72 {
    76     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()"));
    73     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::~QMPXVideoPlaybackToolBar()"));
    77 
    74 
    78     HbEffect::enable( mToolBar );
       
    79     mToolBar->clearActions();
    75     mToolBar->clearActions();
    80 
    76 
    81     for ( int i = 0 ; i < mButtonIcons.count() ; i++ )
    77     for ( int i = 0 ; i < mButtonIcons.count() ; i++ )
    82     {
    78     {
    83         if ( mButtonIcons[i] )
    79         if ( mButtonIcons[i] )
   169         mButtonIcons[EMPXStretchIcon]->setIconName( "qtg_mono_aspect_ratio_stretched" );
   165         mButtonIcons[EMPXStretchIcon]->setIconName( "qtg_mono_aspect_ratio_stretched" );
   170         mButtonIcons[EMPXZoomIcon]->setIconName( "qtg_mono_aspect_ratio_zoom" );
   166         mButtonIcons[EMPXZoomIcon]->setIconName( "qtg_mono_aspect_ratio_zoom" );
   171         mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] );
   167         mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] );
   172 
   168 
   173         //
   169         //
   174         // Attach/Share button 
   170         // Attach/Share button
   175         //
   171         //
   176         mButtonIcons[EMPXAttachIcon]->setIconName( "qtg_mono_attach" );
   172         mButtonIcons[EMPXAttachIcon]->setIconName( "qtg_mono_attach" );
   177         mButtonIcons[EMPXShareIcon]->setIconName( "qtg_mono_share" );
   173         mButtonIcons[EMPXShareIcon]->setIconName( "qtg_mono_share" );
   178 
   174 
   179         for ( int i = 0 ; i < EMPXButtonCount ; i++ )
   175         for ( int i = 0 ; i < EMPXButtonCount ; i++ )
   183         }
   179         }
   184 
   180 
   185         mDuration = (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier;
   181         mDuration = (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier;
   186 
   182 
   187         //
   183         //
   188         // Create a timer for seeking. 
   184         // Create a timer for seeking.
   189         // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user
   185         // We will issue SetPosition every KSeekingTimeOut msec to show the current frame to user
   190         //
   186         //
   191         mSeekStartTimer = new QTimer();
   187         mSeekStartTimer = new QTimer();
   192         mSeekStartTimer->setSingleShot( true );
   188         mSeekStartTimer->setSingleShot( true );
   193         mSeekStartTimer->setInterval( KSeekStartTimeOut );
   189         mSeekStartTimer->setInterval( KSeekStartTimeOut );
   194         
   190 
   195         //
   191         //
   196         // get window size
   192         // get window size
   197         //
   193         //
   198         RWindow *window = mController->view()->getWindow();            
   194         RWindow *window = mController->view()->getWindow();
   199         TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) );
   195         TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) );
   200         
   196 
   201         //
   197         //
   202         // get window aspect ratio
   198         // get window aspect ratio
   203         //   if device is in portrait mode, width > height
   199         //   if device is in portrait mode, width > height
   204         //   if device is in landscape mode, width < height
   200         //   if device is in landscape mode, width < height
   205         //
   201         //
   206         TReal32 width = (TReal32) displayRect.Width();
   202         TReal32 width = (TReal32) displayRect.Width();
   207         TReal32 height = (TReal32) displayRect.Height();            
   203         TReal32 height = (TReal32) displayRect.Height();
   208         mDisplayAspectRatio = (width > height)? (width / height) : (height / width);
   204         mDisplayAspectRatio = (width > height)? (width / height) : (height / width);
   209         
       
   210     }
   205     }
   211 }
   206 }
   212 
   207 
   213 // -------------------------------------------------------------------------------------------------
   208 // -------------------------------------------------------------------------------------------------
   214 // QMPXVideoPlaybackToolBar::playPause()
   209 // QMPXVideoPlaybackToolBar::playPause()
   233 
   228 
   234     if ( mSeekingState == EMPXNotSeeking )
   229     if ( mSeekingState == EMPXNotSeeking )
   235     {
   230     {
   236         mSeekingState = EMPXFastForwarding;
   231         mSeekingState = EMPXFastForwarding;
   237 
   232 
   238         mController->handleCommand( EMPXPbvCmdSeekForward );        
   233         mController->handleCommand( EMPXPbvCmdSeekForward );
   239     }
   234     }
   240 }
   235 }
   241 
   236 
   242 // -------------------------------------------------------------------------------------------------
   237 // -------------------------------------------------------------------------------------------------
   243 // QMPXVideoPlaybackToolBar::rwPressing()
   238 // QMPXVideoPlaybackToolBar::rwPressing()
   272         mSeekStartTimer->stop();
   267         mSeekStartTimer->stop();
   273     }
   268     }
   274 
   269 
   275     if ( mSeekingState == EMPXFastForwarding )
   270     if ( mSeekingState == EMPXFastForwarding )
   276     {
   271     {
   277         mController->handleCommand( EMPXPbvCmdEndSeek );        
   272         mController->handleCommand( EMPXPbvCmdEndSeek );
   278     }
   273     }
   279     else
   274     else
   280     {
   275     {
   281         int temp = mPosition + KMPXFastForward;
   276         int temp = mPosition + KMPXFastForward;
   282         MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::ffReleased() temp position = %d"), temp);
   277         MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::ffReleased() temp position = %d"), temp);
   310         mSeekStartTimer->stop();
   305         mSeekStartTimer->stop();
   311     }
   306     }
   312 
   307 
   313     if ( mSeekingState == EMPXRewinding )
   308     if ( mSeekingState == EMPXRewinding )
   314     {
   309     {
   315         mController->handleCommand( EMPXPbvCmdEndSeek );        
   310         mController->handleCommand( EMPXPbvCmdEndSeek );
   316     }
   311     }
   317     else
   312     else
   318     {
   313     {
   319         int temp = mPosition + KMPXRewind;
   314         int temp = mPosition + KMPXRewind;
   320         MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::rwReleased() temp position = %d"), temp);
   315         MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::rwReleased() temp position = %d"), temp);
   341 void QMPXVideoPlaybackToolBar::changeAspectRatio()
   336 void QMPXVideoPlaybackToolBar::changeAspectRatio()
   342 {
   337 {
   343     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::changeAspectRatio()"));
   338     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::changeAspectRatio()"));
   344 
   339 
   345     mController->resetDisappearingTimers( EMPXTimerReset );
   340     mController->resetDisappearingTimers( EMPXTimerReset );
   346     
   341 
   347     TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdStretchAspectRatio;
   342     TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdStretchAspectRatio;
   348 
   343 
   349     switch( mAspectRatio )
   344     switch( mAspectRatio )
   350     {
   345     {
   351         case EMMFZoom:
   346         case EMMFZoom:
   406 {
   401 {
   407     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
   402     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
   408 
   403 
   409     mAspectRatio = aspectRatio;
   404     mAspectRatio = aspectRatio;
   410 
   405 
   411     if ( ! mController->isAttachOperation() )
   406     //
       
   407     // If we are in attach service or audio only view, then don't update the icon.
       
   408 	// Aspect ratio icon slots are shared with attach and share icon.
       
   409 	// Just update the mAspectRatio
       
   410 	// and once we go back to full screen, we will show the correct aspect ratio icon
       
   411 	//
       
   412     if ( ! mController->isAttachOperation() && mController->viewMode() == EFullScreenView )
   412     {
   413     {
   413         switch( mAspectRatio )
   414         switch( mAspectRatio )
   414         {
   415         {
   415             case EMMFNatural:
   416             case EMMFNatural:
   416             {
   417             {
   425             default:
   426             default:
   426             {
   427             {
   427                 mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] );
   428                 mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXNaturalIcon] );
   428                 break;
   429                 break;
   429             }
   430             }
   430         }    
   431         }
   431     }
   432     }
   432 }
   433 }
   433 
   434 
   434 // -------------------------------------------------------------------------------------------------
   435 // -------------------------------------------------------------------------------------------------
   435 // QMPXVideoPlaybackToolBar::handleButtonPressed()
   436 // QMPXVideoPlaybackToolBar::handleButtonPressed()
   498         //
   499         //
   499         mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXAttachIcon] );
   500         mButtonActions[EMPX1stButton]->setIcon( *mButtonIcons[EMPXAttachIcon] );
   500 
   501 
   501         if ( mButtons.count() )
   502         if ( mButtons.count() )
   502         {
   503         {
   503             disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) );
   504             disconnect( mButtons[EMPX1stButton], SIGNAL( released() ), 0, 0 );
   504             connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   505             connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   505                      mController, SLOT( attachVideo() ) );
   506                      mController, SLOT( attachVideo() ) );
   506         }
   507         }
   507     }
   508     }
   508     else
   509     else
   525                 mButtonActions[EMPX1stButton]->setEnabled( false );
   526                 mButtonActions[EMPX1stButton]->setEnabled( false );
   526             }
   527             }
   527             else
   528             else
   528             {
   529             {
   529                 //
   530                 //
   530                 // check if video clip has same aspect ratio as display window 
   531                 // check if video clip has same aspect ratio as display window
   531                 //
   532                 //
   532                 TReal32 videoAspectRatio = (TReal32) details->mVideoWidth / (TReal32) details->mVideoHeight; 
   533                 TReal32 videoAspectRatio = (TReal32) details->mVideoWidth / (TReal32) details->mVideoHeight;
   533                 bool enabled = ( mDisplayAspectRatio == videoAspectRatio )? false : true;
   534                 bool enabled = ( mDisplayAspectRatio == videoAspectRatio )? false : true;
   534                 
   535 
   535                 //
   536                 //
   536                 // enable or dim 'aspect ratio' buttons accordingly
   537                 // enable or dim 'aspect ratio' buttons accordingly
   537                 //
   538                 //
   538                 mButtonActions[EMPX1stButton]->setEnabled( enabled );
   539                 mButtonActions[EMPX1stButton]->setEnabled( enabled );
   539 
   540 
   540                 if ( mButtons.count() )
   541                 if ( mButtons.count() )
   541                 {
   542                 {
   542                     disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) );
   543                     disconnect( mButtons[EMPX1stButton], SIGNAL( released() ), 0, 0 );
   543                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   544                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   544                              this, SLOT( changeAspectRatio() ) );
   545                              this, SLOT( changeAspectRatio() ) );
   545                 }
   546                 }
   546             }
   547             }
   547         }                
   548         }
   548         else if ( mController->viewMode() == EAudioOnlyView )
   549         else if ( mController->viewMode() == EAudioOnlyView )
   549         {
   550         {
   550             //
   551             //
   551             // Show share button
   552             // Show share button
   552             //
   553             //
   567                 //
   568                 //
   568                 mButtonActions[EMPX1stButton]->setEnabled( true );
   569                 mButtonActions[EMPX1stButton]->setEnabled( true );
   569 
   570 
   570                 if ( mButtons.count() )
   571                 if ( mButtons.count() )
   571                 {
   572                 {
   572                     disconnect( mButtons[EMPX1stButton], SIGNAL( released() ) );
   573                     disconnect( mButtons[EMPX1stButton], SIGNAL( released() ), 0, 0 );
   573                     connect( mButtons[EMPX1stButton], SIGNAL( released() ), 
   574                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   574                              mController, SLOT( sendVideo() ) );
   575                              mController, SLOT( sendVideo() ) );
   575                 }
   576                 }
   576             }
   577             }
   577         }
   578         }
   578     }
   579     }
   588     else
   589     else
   589     {
   590     {
   590         mButtonActions[EMPX5thButton]->setEnabled( true );
   591         mButtonActions[EMPX5thButton]->setEnabled( true );
   591     }
   592     }
   592 
   593 
   593     if ( ! details->mSeekable )
   594     if ( details->mSeekable && details->mPausableStream )
       
   595     {
       
   596         mButtonActions[EMPX2ndButton]->setEnabled( true );
       
   597         mButtonActions[EMPX4thButton]->setEnabled( true );
       
   598     }
       
   599     else
   594     {
   600     {
   595         mButtonActions[EMPX2ndButton]->setEnabled( false );
   601         mButtonActions[EMPX2ndButton]->setEnabled( false );
   596         mButtonActions[EMPX4thButton]->setEnabled( false );
   602         mButtonActions[EMPX4thButton]->setEnabled( false );
   597     }
   603     }
       
   604 
       
   605     if ( details->mPausableStream )
       
   606     {
       
   607         mButtonActions[EMPX3rdButton]->setEnabled( true );
       
   608     }
   598     else
   609     else
   599     {
   610     {
   600         mButtonActions[EMPX2ndButton]->setEnabled( true );
       
   601         mButtonActions[EMPX4thButton]->setEnabled( true );
       
   602     }
       
   603 
       
   604     if ( ! details->mPausableStream )
       
   605     {
       
   606         mButtonActions[EMPX3rdButton]->setEnabled( false );
   611         mButtonActions[EMPX3rdButton]->setEnabled( false );
   607     }
   612     }
       
   613 
       
   614     //
       
   615     // toolbar creates button once it gets visible, so we don't know exact timing when toolbar
       
   616     // creates button, so start timer to get layout information once the toolbar gets visible.
       
   617     // This is needed since we don't use toolbar in proper way.
       
   618     //
       
   619     if ( ! mRetrieveButtonTimer && ! mButtons.count() )
       
   620     {
       
   621         mRetrieveButtonTimer = new QTimer();
       
   622         mRetrieveButtonTimer->setSingleShot( false );
       
   623         mRetrieveButtonTimer->setInterval( KRetrieveButtonTimeOut );
       
   624         connect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) );
       
   625 
       
   626         mRetrieveButtonTimer->start();
       
   627     }
       
   628 
       
   629     durationChanged( (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier );
       
   630 }
       
   631 
       
   632 // -------------------------------------------------------------------------------------------------
       
   633 // QMPXVideoPlaybackToolBar::openDetailsView()
       
   634 // -------------------------------------------------------------------------------------------------
       
   635 //
       
   636 void QMPXVideoPlaybackToolBar::openDetailsView()
       
   637 {
       
   638     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::openDetailsView()"));
       
   639 
       
   640     TPlaybackViewMode viewMode = mController->viewMode();
       
   641 
       
   642     if ( viewMode == EFullScreenView )
       
   643     {
       
   644         mController->changeViewMode( EDetailsView );
       
   645     }
       
   646 }
       
   647 
       
   648 // -------------------------------------------------------------------------------------------------
       
   649 // QMPXVideoPlaybackToolBar::positionChanged
       
   650 // -------------------------------------------------------------------------------------------------
       
   651 //
       
   652 void QMPXVideoPlaybackToolBar::positionChanged( int position )
       
   653 {
       
   654     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::positionChanged position = %d"), position );
       
   655 
       
   656     mPosition = position;
       
   657 }
       
   658 
       
   659 // -------------------------------------------------------------------------------------------------
       
   660 // QMPXVideoPlaybackToolBar::durationChanged
       
   661 // -------------------------------------------------------------------------------------------------
       
   662 //
       
   663 void QMPXVideoPlaybackToolBar::durationChanged( int duration )
       
   664 {
       
   665     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::durationChanged duration = %d"), duration );
       
   666 
       
   667     mDuration = duration;
       
   668 }
       
   669 
       
   670 // -------------------------------------------------------------------------------------------------
       
   671 // QMPXVideoPlaybackToolBar::setVisible
       
   672 // -------------------------------------------------------------------------------------------------
       
   673 //
       
   674 void QMPXVideoPlaybackToolBar::setVisible( bool visible )
       
   675 {
       
   676     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::setVisible visible = %d"), visible );
       
   677 
       
   678     if ( visible )
       
   679     {
       
   680         mController->view()->showItems( Hb::ToolBarItem );
       
   681     }
   608     else
   682     else
   609     {
   683     {
   610         mButtonActions[EMPX3rdButton]->setEnabled( true );
       
   611     }        
       
   612 }
       
   613 
       
   614 // -------------------------------------------------------------------------------------------------
       
   615 // QMPXVideoPlaybackToolBar::openDetailsView()
       
   616 // -------------------------------------------------------------------------------------------------
       
   617 //
       
   618 void QMPXVideoPlaybackToolBar::openDetailsView()
       
   619 {
       
   620     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackToolBar::openDetailsView()"));
       
   621 
       
   622     TPlaybackViewMode viewMode = mController->viewMode();
       
   623 
       
   624     if ( viewMode == EFullScreenView )
       
   625     {
       
   626         mController->changeViewMode( EDetailsView );
       
   627     }
       
   628 }
       
   629 
       
   630 // -------------------------------------------------------------------------------------------------
       
   631 // QMPXVideoPlaybackToolBar::positionChanged
       
   632 // -------------------------------------------------------------------------------------------------
       
   633 //
       
   634 void QMPXVideoPlaybackToolBar::positionChanged( int position )
       
   635 {
       
   636     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::positionChanged position = %d"), position );
       
   637 
       
   638     mPosition = position;
       
   639     retrieveButtons();
       
   640 }
       
   641 
       
   642 // -------------------------------------------------------------------------------------------------
       
   643 // QMPXVideoPlaybackToolBar::durationChanged
       
   644 // -------------------------------------------------------------------------------------------------
       
   645 //
       
   646 void QMPXVideoPlaybackToolBar::durationChanged( int duration )
       
   647 {
       
   648     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::durationChanged duration = %d"), duration );
       
   649 
       
   650     mDuration = duration;
       
   651 }
       
   652 
       
   653 // -------------------------------------------------------------------------------------------------
       
   654 // QMPXVideoPlaybackToolBar::setVisible
       
   655 // -------------------------------------------------------------------------------------------------
       
   656 //
       
   657 void QMPXVideoPlaybackToolBar::setVisible( bool visible )
       
   658 {
       
   659     MPX_DEBUG(_L("QMPXVideoPlaybackToolBar::setVisible visible = %d"), visible );
       
   660 
       
   661     if ( visible )
       
   662     {
       
   663         mController->view()->showItems( Hb::ToolBarItem );
       
   664 
       
   665         if ( mNeverVisibled )
       
   666         {
       
   667             mNeverVisibled = false;
       
   668 
       
   669 
       
   670             //
       
   671             // toolbar creates button once it gets visible, so we don't know exact timing when toolbar 
       
   672             // creates button, so start timer to get layout information once the toolbar gets visible.
       
   673             // This is needed since we don't use toolbar in proper way.
       
   674             //
       
   675             mRetrieveButtonTimer = new QTimer();
       
   676             mRetrieveButtonTimer->setSingleShot( false );
       
   677             mRetrieveButtonTimer->setInterval( KRetrieveButtonTimeOut );
       
   678             connect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) );
       
   679 
       
   680             mRetrieveButtonTimer->start();
       
   681         }
       
   682     }
       
   683     else
       
   684     {
       
   685         mController->view()->hideItems( Hb::ToolBarItem );
   684         mController->view()->hideItems( Hb::ToolBarItem );
   686     }
   685     }
   687 }
   686 }
   688 
   687 
   689 // -------------------------------------------------------------------------------------------------
   688 // -------------------------------------------------------------------------------------------------
   698     {
   697     {
   699         QGraphicsLayout *layout = mToolBar->layout();
   698         QGraphicsLayout *layout = mToolBar->layout();
   700 
   699 
   701         if ( layout )
   700         if ( layout )
   702         {
   701         {
   703 		    disconnect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) );
   702             if ( mRetrieveButtonTimer )
   704             if ( mRetrieveButtonTimer->isActive() )
   703             {
   705             {
   704                 disconnect( mRetrieveButtonTimer, SIGNAL( timeout() ), this, SLOT( retrieveButtons() ) );
   706                 mRetrieveButtonTimer->stop();
   705                 if ( mRetrieveButtonTimer->isActive() )
       
   706                 {
       
   707                     mRetrieveButtonTimer->stop();
       
   708                 }
   707             }
   709             }
   708 
   710 
   709             for ( int i = 0 ; i < layout->count() ; i++ )
   711             for ( int i = 0 ; i < layout->count() ; i++ )
   710             {
   712             {
   711                 mButtons.append( dynamic_cast<HbToolButton*>( layout->itemAt( i ) ) );
   713                 mButtons.append( dynamic_cast<HbToolButton*>( layout->itemAt( i ) ) );
   737             {
   739             {
   738                 if ( mController->viewMode() == EFullScreenView )
   740                 if ( mController->viewMode() == EFullScreenView )
   739                 {
   741                 {
   740                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   742                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   741                              this, SLOT( changeAspectRatio() ) );
   743                              this, SLOT( changeAspectRatio() ) );
   742                 }                
   744                 }
   743                 else if ( mController->viewMode() == EAudioOnlyView )
   745                 else if ( mController->viewMode() == EAudioOnlyView )
   744                 {
   746                 {
   745                     connect( mButtons[EMPX1stButton], SIGNAL( released() ), 
   747                     connect( mButtons[EMPX1stButton], SIGNAL( released() ),
   746                              mController, SLOT( sendVideo() ) );
   748                              mController, SLOT( sendVideo() ) );
   747                 }
   749                 }
   748             }
   750             }
   749         }
   751         }
   750     }
   752     }