videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp
changeset 39 f6d44a0cd476
parent 38 ff53afa8ad05
child 40 13331705e488
equal deleted inserted replaced
38:ff53afa8ad05 39:f6d44a0cd476
    13 *
    13 *
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    14 * Description:  Implementation of MPXVideoPlaybackControlsController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#39 %
    18 // Version : %version: da1mmcf#40 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 // INCLUDE FILES
    22 // INCLUDE FILES
    23 #include <coecntrl.h>
    23 #include <coecntrl.h>
    65     , mViewWrapper( viewWrapper )
    65     , mViewWrapper( viewWrapper )
    66     , mFileDetails( details )
    66     , mFileDetails( details )
    67     , mControlsPolicy( NULL )
    67     , mControlsPolicy( NULL )
    68     , mControlsConfig( NULL )
    68     , mControlsConfig( NULL )
    69     , mControlsTimer( NULL )
    69     , mControlsTimer( NULL )
       
    70     , mRNLogoTimer( NULL )
    70     , mLoader( NULL )
    71     , mLoader( NULL )
    71     , mVolumeControl( NULL )
    72     , mVolumeControl( NULL )
    72     , mThumbnailManager( NULL )
    73     , mThumbnailManager( NULL )
    73     , mVideoServices( 0 )
    74     , mVideoServices( 0 )
    74     , mViewTransitionIsGoingOn( false )
    75     , mViewTransitionIsGoingOn( false )
   124         //
   125         //
   125         delete mLoader;
   126         delete mLoader;
   126         mLoader = NULL;
   127         mLoader = NULL;
   127     }
   128     }
   128 
   129 
       
   130     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
       
   131 
   129     mControlsTimer = new QTimer( this );
   132     mControlsTimer = new QTimer( this );
   130     mControlsTimer->setInterval( KMPXControlsTimeOut );
   133     mControlsTimer->setInterval( KMPXControlsTimeOut );
   131     mControlsTimer->setSingleShot( false );
   134     mControlsTimer->setSingleShot( false );
   132     connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   135     connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
   133 
   136 
   137     
   140     
   138     mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
   141     mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
   139     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   142     connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
   140     mControlsConfig->createControlList();
   143     mControlsConfig->createControlList();
   141 
   144 
       
   145     //
       
   146     // Create volume popup control
       
   147     //
   142     mVolumeControl = new HbVolumeSliderPopup();
   148     mVolumeControl = new HbVolumeSliderPopup();
   143     mVolumeControl->setVisible( false );
   149     mVolumeControl->setVisible( false );
   144     mVolumeControl->setTimeout( KMPXControlsTimeOut );
   150     mVolumeControl->setTimeout( KMPXControlsTimeOut );
   145     mVolumeControl->setTickPosition( Hb::NoSliderTicks );
   151     mVolumeControl->setTickPosition( Hb::NoSliderTicks );
   146     mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
   152     mVolumeControl->setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
   173                 connect( this, SIGNAL( attachVideoPath( const QString& ) ), 
   179                 connect( this, SIGNAL( attachVideoPath( const QString& ) ), 
   174                          mVideoServices, SLOT( itemSelected( const QString& ) ) );                        
   180                          mVideoServices, SLOT( itemSelected( const QString& ) ) );                        
   175             }
   181             }
   176         }
   182         }
   177     }
   183     }
   178 
       
   179 }
   184 }
   180 
   185 
   181 // -------------------------------------------------------------------------------------------------
   186 // -------------------------------------------------------------------------------------------------
   182 // QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
   187 // QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
   183 // -------------------------------------------------------------------------------------------------
   188 // -------------------------------------------------------------------------------------------------
   198 
   203 
   199     if ( mControlsTimer )
   204     if ( mControlsTimer )
   200     {
   205     {
   201         delete mControlsTimer;
   206         delete mControlsTimer;
   202         mControlsTimer = NULL;
   207         mControlsTimer = NULL;
       
   208     }
       
   209 
       
   210     if ( mRNLogoTimer )
       
   211     {
       
   212         disconnect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );        
       
   213 
       
   214         delete mRNLogoTimer;
       
   215         mRNLogoTimer = NULL;
   203     }
   216     }
   204 
   217 
   205     if ( mControlsPolicy )
   218     if ( mControlsPolicy )
   206     {
   219     {
   207         delete mControlsPolicy;
   220         delete mControlsPolicy;
   247         // decrease videoservices instance count
   260         // decrease videoservices instance count
   248         //
   261         //
   249     	mVideoServices->decreaseReferenceCount();
   262     	mVideoServices->decreaseReferenceCount();
   250     	mVideoServices = 0;
   263     	mVideoServices = 0;
   251     }
   264     }
   252     
       
   253 }
   265 }
   254 
   266 
   255 // -------------------------------------------------------------------------------------------------
   267 // -------------------------------------------------------------------------------------------------
   256 // QMPXVideoPlaybackControlsController::addFileDetails()
   268 // QMPXVideoPlaybackControlsController::addFileDetails()
   257 // -------------------------------------------------------------------------------------------------
   269 // -------------------------------------------------------------------------------------------------
   260     QMPXVideoPlaybackViewFileDetails* details )
   272     QMPXVideoPlaybackViewFileDetails* details )
   261 {
   273 {
   262     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::addFileDetails"));
   274     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::addFileDetails"));
   263 
   275 
   264     mFileDetails = details;
   276     mFileDetails = details;
   265 
       
   266     mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
       
   267 
   277 
   268     mControlsConfig->updateControlsWithFileDetails();
   278     mControlsConfig->updateControlsWithFileDetails();
   269 
   279 
   270     //
   280     //
   271     // for audio-only clips and tv-out, default view is flip view
   281     // for audio-only clips and tv-out, default view is flip view
   478 
   488 
   479             //
   489             //
   480             //  Control exists in new list.
   490             //  Control exists in new list.
   481             //
   491             //
   482             myList.removeAt( index );
   492             myList.removeAt( index );
   483             i++;            
   493             i++;
   484         }
   494         }
   485     }
   495     }
   486 
   496 
   487     //
   497     //
   488     //  The updated list will contain added controls only
   498     //  The updated list will contain added controls only
   516 
   526 
   517     switch ( controlIndex )
   527     switch ( controlIndex )
   518     {
   528     {
   519         case EMPXBufferingAnimation:
   529         case EMPXBufferingAnimation:
   520         {
   530         {
       
   531             //
       
   532             // Load animation icons
       
   533             //
       
   534             QString animationName = ":/hbvideoplaybackview/animations/";
       
   535 
       
   536             if ( mFileDetails->mRNFormat )
       
   537             {
       
   538                 animationName.append( "rn_preroll_anim.axml" );
       
   539             }
       
   540             else
       
   541             {
       
   542                 animationName.append( "generic_preroll_anim.axml" );
       
   543             }
       
   544 
       
   545             HbIconAnimationManager* manager = HbIconAnimationManager::global();
       
   546             bool ok = manager->addDefinitionFile( animationName );
       
   547 
       
   548             MPX_DEBUG(_L("    EMPXBufferingAnimation add animation definition ok = %d"), ok);
       
   549 
   521             //
   550             //
   522             // Buffering animation icon
   551             // Buffering animation icon
   523             //
   552             //
   524             HbIconAnimationManager* manager = HbIconAnimationManager::global();
       
   525             manager->addDefinitionFile(":/hbvideoplaybackview/animation.axml");
       
   526 			
       
   527             QGraphicsWidget *widget = mLoader->findWidget( QString( "bufferingIcon" ) );
   553             QGraphicsWidget *widget = mLoader->findWidget( QString( "bufferingIcon" ) );
   528             HbLabel *bufferingAnim = qobject_cast<HbLabel*>( widget );
   554             HbLabel *bufferingAnim = qobject_cast<HbLabel*>( widget );
   529 
   555 
   530             control = new QMPXVideoPlaybackFullScreenControl( this,
   556             control = new QMPXVideoPlaybackFullScreenControl( this,
   531                                                               controlIndex,
   557                                                               controlIndex,
   589             control = new QMPXVideoPlaybackFullScreenControl( this,
   615             control = new QMPXVideoPlaybackFullScreenControl( this,
   590                                                               controlIndex,
   616                                                               controlIndex,
   591                                                               bitmapWidget,
   617                                                               bitmapWidget,
   592                                                               properties );
   618                                                               properties );
   593             mControls.append( control );
   619             mControls.append( control );
       
   620 
       
   621             break;
       
   622         }
       
   623         case EMPXRealLogoBitmap:
       
   624         {
       
   625             QGraphicsWidget *widget = mLoader->findWidget( QString( "rnLogoBitmap" ) );
       
   626             HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
       
   627 
       
   628             control = new QMPXVideoPlaybackFullScreenControl( this,
       
   629                                                               controlIndex,
       
   630                                                               bitmapWidget,
       
   631                                                               properties );
       
   632             mControls.append( control );
       
   633 
       
   634             connect( bitmapWidget, SIGNAL( visibleChanged() ),
       
   635                      this, SLOT( handleRNLogoVisibleChanged() ) );
   594 
   636 
   595             break;
   637             break;
   596         }
   638         }
   597         case EMPXDetailsViewPlaybackWindow:
   639         case EMPXDetailsViewPlaybackWindow:
   598         {
   640         {
  1036 
  1078 
  1037 // -------------------------------------------------------------------------------------------------
  1079 // -------------------------------------------------------------------------------------------------
  1038 //   QMPXVideoPlaybackControlsController::isSoftKeyVisible()
  1080 //   QMPXVideoPlaybackControlsController::isSoftKeyVisible()
  1039 // -------------------------------------------------------------------------------------------------
  1081 // -------------------------------------------------------------------------------------------------
  1040 //
  1082 //
  1041 bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
  1083 bool QMPXVideoPlaybackControlsController::isSoftKeyVisible()
  1042 {
  1084 {
  1043     bool visible = false;
  1085     bool visible = false;
  1044 
  1086 
  1045     for ( int i = 0 ; i < mControls.count() ; i++ )
  1087     for ( int i = 0 ; i < mControls.count() ; i++ )
  1046     {
  1088     {
  1379     fileList.append( mFileDetails->mClipName );
  1421     fileList.append( mFileDetails->mClipName );
  1380     dlg.send( fileList, true );   
  1422     dlg.send( fileList, true );   
  1381 }
  1423 }
  1382 
  1424 
  1383 // -------------------------------------------------------------------------------------------------
  1425 // -------------------------------------------------------------------------------------------------
       
  1426 // QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
       
  1427 // -------------------------------------------------------------------------------------------------
       
  1428 //
       
  1429 void QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()
       
  1430 {
       
  1431     MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleRNLogoVisibleChanged()"));
       
  1432 
       
  1433     QGraphicsWidget *widget = mLoader->findWidget( QString( "rnLogoBitmap" ) );
       
  1434 
       
  1435     if ( widget->isVisible() )
       
  1436     {
       
  1437         if ( mRNLogoTimer )
       
  1438         {
       
  1439             delete mRNLogoTimer;
       
  1440             mRNLogoTimer = NULL;
       
  1441         }
       
  1442 
       
  1443         mRNLogoTimer = new QTimer( this );
       
  1444         mRNLogoTimer->setInterval( KMPXRNLogoTimeOut );
       
  1445         mRNLogoTimer->setSingleShot( true );
       
  1446         connect( mRNLogoTimer, SIGNAL( timeout() ), this, SLOT( handleRNLogoTimeout() ) );        
       
  1447 
       
  1448         mRNLogoTimer->start();
       
  1449     }
       
  1450 }
       
  1451 
       
  1452 // -------------------------------------------------------------------------------------------------
       
  1453 // QMPXVideoPlaybackControlsController::handleRNLogoTimeout()
       
  1454 // -------------------------------------------------------------------------------------------------
       
  1455 //
       
  1456 void QMPXVideoPlaybackControlsController::handleRNLogoTimeout()
       
  1457 {
       
  1458     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleRNLogoTimeout()"));
       
  1459 
       
  1460     if ( mRNLogoTimer->isActive() )
       
  1461     {
       
  1462         mRNLogoTimer->stop();
       
  1463     }
       
  1464 
       
  1465     //
       
  1466     // Remove RN logo from the controls list and issue play command if needed
       
  1467     //
       
  1468     mControlsConfig->updateControlList( EMPXControlCmdRemoveRNLogo );
       
  1469     handleCommand( EMPXPbvCmdRealOneBitmapTimeout );
       
  1470 }
       
  1471 
       
  1472 // -------------------------------------------------------------------------------------------------
       
  1473 // QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList()
       
  1474 // -------------------------------------------------------------------------------------------------
       
  1475 //
       
  1476 bool QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList()
       
  1477 {
       
  1478     bool exist = false;
       
  1479 
       
  1480     //
       
  1481     // If we have a rn logo in the list, we are supposed to show the logo all the time
       
  1482     // unless we are in the middle of orientation transition
       
  1483     //
       
  1484     for ( int i = 0 ; i < mControls.count() ; i++ )
       
  1485     {
       
  1486         if ( mControls[i]->controlIndex() == EMPXRealLogoBitmap )
       
  1487         {
       
  1488             exist = true;
       
  1489             break;
       
  1490         }
       
  1491     }
       
  1492 
       
  1493     MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isRNLogoBitmapInControlList() [%d]"), exist);
       
  1494 
       
  1495     return exist;
       
  1496 }
       
  1497 
       
  1498 // -------------------------------------------------------------------------------------------------
  1384 // QMPXVideoPlaybackControlsController::handleOrientationChanged()
  1499 // QMPXVideoPlaybackControlsController::handleOrientationChanged()
  1385 // -------------------------------------------------------------------------------------------------
  1500 // -------------------------------------------------------------------------------------------------
  1386 //
  1501 //
  1387 void QMPXVideoPlaybackControlsController::handleOrientationChanged( Qt::Orientation orientation )
  1502 void QMPXVideoPlaybackControlsController::handleOrientationChanged( Qt::Orientation orientation )
  1388 {
  1503 {