videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp
changeset 50 21fe8338c6bf
parent 49 824471cb468a
child 55 4bfa887905cf
--- a/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp	Fri Jul 23 11:10:06 2010 +0300
+++ b/videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp	Fri Aug 06 09:43:48 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: da1mmcf#47 %
+// Version : %version: da1mmcf#48 %
 
 
 
@@ -142,6 +142,9 @@
 
     MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
 
+    connect( hbInstance->allMainWindows()[0], SIGNAL( obscured() ), this, SLOT( handleAppBackground() ) );
+    connect( hbInstance->allMainWindows()[0], SIGNAL( revealed() ), this, SLOT( handleAppForeground() ) );
+
     QCoreApplication::instance()->installEventFilter( this );
 
     //
@@ -175,6 +178,9 @@
 
     QCoreApplication::instance()->removeEventFilter( this );
 
+    disconnect( hbInstance->allMainWindows()[0], SIGNAL( obscured() ), this, SLOT( handleAppBackground() ) );
+    disconnect( hbInstance->allMainWindows()[0], SIGNAL( revealed() ), this, SLOT( handleAppForeground() ) );
+
     //
     //  Close the playback plugin to release all references to previous clip
     //
@@ -382,9 +388,9 @@
     mTimerForClosingView->start( 0 );
 }
 
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 // VideoBasePlaybackView::eventFilter
-// ---------------------------------------------------------------------------
+// -------------------------------------------------------------------------------------------------
 //
 bool VideoBasePlaybackView::eventFilter( QObject *object, QEvent *event )
 {
@@ -397,7 +403,8 @@
             if ( mActivated )
             {
                 MPX_DEBUG(_L("VideoBasePlaybackView::eventFilter foreground()") );
-                TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( true ) );
+                TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL(
+                        true, ! hbInstance->allMainWindows()[0]->isObscured() ) );
             }
             break;
         }
@@ -406,7 +413,8 @@
             if ( mActivated )
             {
                 MPX_DEBUG(_L("VideoBasePlaybackView::eventFilter background()") );
-                TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( false ) );
+                TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL(
+                        false, ! hbInstance->allMainWindows()[0]->isObscured() ) );
             }
             break;
         }
@@ -472,4 +480,32 @@
     }
 }
 
+// -------------------------------------------------------------------------------------------------
+//   VideoBasePlaybackView::handleAppBackground()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoBasePlaybackView::handleAppBackground()
+{
+    MPX_ENTER_EXIT(_L("VideoBasePlaybackView::handleAppBackground()") );
+
+    if ( mActivated )
+    {
+        TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( false, false ) );
+    }
+}
+
+// -------------------------------------------------------------------------------------------------
+//   VideoBasePlaybackView::handleAppForeground()
+// -------------------------------------------------------------------------------------------------
+//
+void VideoBasePlaybackView::handleAppForeground()
+{
+    MPX_ENTER_EXIT(_L("VideoBasePlaybackView::handleAppForeground()") );
+
+    if ( mActivated )
+    {
+        TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( true, true ) );
+    }
+}
+
 // EOF