videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp
changeset 24 7d93ee07fb27
parent 20 b9e04db066d4
child 46 adbe7d5ba2f5
equal deleted inserted replaced
20:b9e04db066d4 24:7d93ee07fb27
    13 *
    13 *
    14 * Description:   Implementation of Video base playback view
    14 * Description:   Implementation of Video base playback view
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: da1mmcf#38 %
    18 // Version : %version: da1mmcf#40 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
   114 // -------------------------------------------------------------------------------------------------
   114 // -------------------------------------------------------------------------------------------------
   115 //
   115 //
   116 void HbVideoBasePlaybackView::handleActivateView()
   116 void HbVideoBasePlaybackView::handleActivateView()
   117 {
   117 {
   118     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()"));
   118     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()"));
   119     
   119 
   120     TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); 
   120     TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) ); 
   121     
   121 
       
   122     QCoreApplication::instance()->installEventFilter( this );
       
   123 
   122     //
   124     //
   123     //  Request the needed Media from the Playback Plugin
   125     //  Request the needed Media from the Playback Plugin
   124     //
   126     //
   125     TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() ); 
   127     TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() ); 
   126     
   128     
   127     menu()->close();
   129     menu()->close();
   128 
   130 
   129     //
   131     //
   130     // Landscape orientation
   132     // Landscape orientation
   131     //
   133     // Workaround: Disable orientation transition effect 
   132     hbInstance->allMainWindows()[0]->setOrientation( Qt::Horizontal );  
   134 	// since orbit couldn't emit the orientationChanged signal with transition effect
       
   135 	// 
       
   136     hbInstance->allMainWindows()[0]->setOrientation( Qt::Horizontal, false );  
   133 
   137 
   134     mActivated = true;   
   138     mActivated = true;   
   135        
       
   136 }
   139 }
   137 
   140 
   138 // -------------------------------------------------------------------------------------------------
   141 // -------------------------------------------------------------------------------------------------
   139 //   HbVideoBasePlaybackView::handleDeactivateView()
   142 //   HbVideoBasePlaybackView::handleDeactivateView()
   140 // -------------------------------------------------------------------------------------------------
   143 // -------------------------------------------------------------------------------------------------
   141 //
   144 //
   142 void HbVideoBasePlaybackView::handleDeactivateView()
   145 void HbVideoBasePlaybackView::handleDeactivateView()
   143 {
   146 {
   144     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleDeactivateView()"));
   147     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleDeactivateView()"));
       
   148 
       
   149     QCoreApplication::instance()->removeEventFilter( this );
   145 
   150 
   146     mActivated = false;
   151     mActivated = false;
   147 
   152 
   148     // 
   153     // 
   149     //  Close the playback plugin to release all references to previous clip
   154     //  Close the playback plugin to release all references to previous clip
   304 // -------------------------------------------------------------------------------------------------
   309 // -------------------------------------------------------------------------------------------------
   305 //
   310 //
   306 void HbVideoBasePlaybackView::issuePlayCommand()
   311 void HbVideoBasePlaybackView::issuePlayCommand()
   307 {
   312 {
   308     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::issuePlayCommand()"));
   313     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::issuePlayCommand()"));
   309     TRAPD(err, mVideoMpxWrapper->CreateGeneralPlaybackCommandL( EPbCmdPlay ));
   314 
       
   315     int err = KErrNone;
       
   316 
       
   317     TRAP( err, mVideoMpxWrapper->CreateGeneralPlaybackCommandL( EPbCmdPlay ));
       
   318 
   310     MPX_DEBUG(_L("HbVideoBasePlaybackView::issuePlayCommand() error = %d"), err);
   319     MPX_DEBUG(_L("HbVideoBasePlaybackView::issuePlayCommand() error = %d"), err);
   311 }
   320 }
   312 
   321 
   313 // -------------------------------------------------------------------------------------------------
   322 // -------------------------------------------------------------------------------------------------
   314 //   HbVideoBasePlaybackView::retrievePdlInformation
   323 //   HbVideoBasePlaybackView::retrievePdlInformation
   324 // -------------------------------------------------------------------------------------------------
   333 // -------------------------------------------------------------------------------------------------
   325 //
   334 //
   326 void HbVideoBasePlaybackView::handleBufferingState()
   335 void HbVideoBasePlaybackView::handleBufferingState()
   327 {
   336 {
   328     MPX_DEBUG(_L("HbVideoBasePlaybackView::handleBufferingState()"));
   337     MPX_DEBUG(_L("HbVideoBasePlaybackView::handleBufferingState()"));
   329 
       
   330 }
   338 }
   331 
   339 
   332 // -------------------------------------------------------------------------------------------------
   340 // -------------------------------------------------------------------------------------------------
   333 //   HbVideoBasePlaybackView::closePlaybackView()
   341 //   HbVideoBasePlaybackView::closePlaybackView()
   334 // -------------------------------------------------------------------------------------------------
   342 // -------------------------------------------------------------------------------------------------
   338     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::closePlaybackView()"));
   346     MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::closePlaybackView()"));
   339 
   347 
   340     mTimerForClosingView->start( 0 );    
   348     mTimerForClosingView->start( 0 );    
   341 }
   349 }
   342 
   350 
   343 // -------------------------------------------------------------------------------------------------
   351 // ---------------------------------------------------------------------------
   344 //   HbVideoBasePlaybackView::event()
   352 // HbVideoBasePlaybackView::eventFilter
   345 // -------------------------------------------------------------------------------------------------
   353 // ---------------------------------------------------------------------------
   346 //
   354 //
   347 bool HbVideoBasePlaybackView::event( QEvent *event )
   355 bool HbVideoBasePlaybackView::eventFilter( QObject *object, QEvent *event )
   348 {
   356 {
   349     bool consumed = false;
   357     Q_UNUSED( object );
   350 
   358 
   351     if ( event->type() == QEvent::WindowActivate && mActivated )
   359     switch ( event->type() )
   352     {
   360     {
   353         TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( true ) );
   361         case QEvent::ApplicationActivate:
   354     }
   362         {
   355     else if ( event->type() == QEvent::WindowDeactivate && mActivated )
   363             if ( mActivated )
   356     {
   364             {
   357         TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( false ) );
   365                 MPX_DEBUG(_L("HbVideoBasePlaybackView::eventFilter foreground()") );
   358     }
   366                 TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( true ) );
   359     else
   367             }
   360     {
   368             break;
   361          consumed = QGraphicsWidget::event( event );
   369         }
   362     }
   370         case QEvent::ApplicationDeactivate:
   363 
   371         {
   364     return consumed;
   372             if ( mActivated )
       
   373             {
       
   374                 MPX_DEBUG(_L("HbVideoBasePlaybackView::eventFilter background()") );
       
   375                 TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( false ) );
       
   376             }
       
   377             break;
       
   378         }
       
   379     }
       
   380 
       
   381     return QObject::eventFilter( object, event );
   365 }
   382 }
   366 
   383 
   367 // -------------------------------------------------------------------------------------------------
   384 // -------------------------------------------------------------------------------------------------
   368 //   HbVideoBasePlaybackView::getWindow()
   385 //   HbVideoBasePlaybackView::getWindow()
   369 // -------------------------------------------------------------------------------------------------
   386 // -------------------------------------------------------------------------------------------------
   407     MPX_DEBUG(_L("HbVideoBasePlaybackView::handleClosePopupDialog()") );
   424     MPX_DEBUG(_L("HbVideoBasePlaybackView::handleClosePopupDialog()") );
   408 
   425 
   409     handleClosePlaybackView();
   426     handleClosePlaybackView();
   410 }
   427 }
   411 
   428 
   412 
       
   413 // EOF
   429 // EOF