videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp
changeset 65 a9d57bd8d7b7
parent 59 a76e86df7ccd
equal deleted inserted replaced
62:0e1e938beb1a 65:a9d57bd8d7b7
    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#49 %
    18 // Version : %version: 49.1.2 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
    28 
    28 
    29 #include <hbmenu.h>
    29 #include <hbmenu.h>
    30 #include <hbaction.h>
    30 #include <hbaction.h>
    31 #include <hbinstance.h>
    31 #include <hbinstance.h>
    32 #include <hbnotificationdialog.h>
    32 #include <hbnotificationdialog.h>
       
    33 #include <hbmessagebox.h>
    33 #include <hblabel.h>
    34 #include <hblabel.h>
    34 #include <hbtapgesture.h>
    35 #include <hbtapgesture.h>
    35 #include <hbpangesture.h>
    36 #include <hbpangesture.h>
    36 
    37 
    37 #include <textresolver.h>
    38 #include <textresolver.h>
    98         QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAY_POSITION_ID);
    99         QVariant data = VideoActivityState::instance().getActivityData(KEY_LAST_PLAY_POSITION_ID);
    99         mLastPlayPosition = data.toInt();
   100         mLastPlayPosition = data.toInt();
   100 
   101 
   101         mStayPaused = true;
   102         mStayPaused = true;
   102     }
   103     }
       
   104 
       
   105     MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
   103 }
   106 }
   104 
   107 
   105 // -------------------------------------------------------------------------------------------------
   108 // -------------------------------------------------------------------------------------------------
   106 // VideoBasePlaybackView::~VideoBasePlaybackView()
   109 // VideoBasePlaybackView::~VideoBasePlaybackView()
   107 // -------------------------------------------------------------------------------------------------
   110 // -------------------------------------------------------------------------------------------------
   138 //
   141 //
   139 void VideoBasePlaybackView::handleActivateView()
   142 void VideoBasePlaybackView::handleActivateView()
   140 {
   143 {
   141     MPX_ENTER_EXIT(_L("VideoBasePlaybackView::handleActivateView()"));
   144     MPX_ENTER_EXIT(_L("VideoBasePlaybackView::handleActivateView()"));
   142 
   145 
   143     MPX_TRAPD( err, mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
   146     MPX_TRAPD( err, mVideoMpxWrapper->ActivateL() );
   144 
   147 
   145     connect( hbInstance->allMainWindows()[0], SIGNAL( obscured() ), this, SLOT( handleAppBackground() ) );
   148     connect( hbInstance->allMainWindows()[0], SIGNAL( obscured() ), this, SLOT( handleAppBackground() ) );
   146     connect( hbInstance->allMainWindows()[0], SIGNAL( revealed() ), this, SLOT( handleAppForeground() ) );
   149     connect( hbInstance->allMainWindows()[0], SIGNAL( revealed() ), this, SLOT( handleAppForeground() ) );
   147 
   150 
   148     QCoreApplication::instance()->installEventFilter( this );
   151     QCoreApplication::instance()->installEventFilter( this );
   184     //
   187     //
   185     //  Close the playback plugin to release all references to previous clip
   188     //  Close the playback plugin to release all references to previous clip
   186     //
   189     //
   187     MPX_TRAPD( err, mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdClose ) );
   190     MPX_TRAPD( err, mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdClose ) );
   188 
   191 
   189     if ( mVideoMpxWrapper )
   192     MPX_TRAP( err, mVideoMpxWrapper->Deactivate() );
   190     {
       
   191         delete mVideoMpxWrapper;
       
   192         mVideoMpxWrapper = NULL;
       
   193     }
       
   194 
   193 
   195     //
   194     //
   196     // go back to device orientation
   195     // go back to device orientation
   197     //
   196     //
   198     //hbInstance->allMainWindows()[0]->unsetOrientation();
   197     //hbInstance->allMainWindows()[0]->unsetOrientation();
   305 
   304 
   306 // -------------------------------------------------------------------------------------------------
   305 // -------------------------------------------------------------------------------------------------
   307 //   VideoBasePlaybackView::showDialog
   306 //   VideoBasePlaybackView::showDialog
   308 // -------------------------------------------------------------------------------------------------
   307 // -------------------------------------------------------------------------------------------------
   309 //
   308 //
   310 void VideoBasePlaybackView::showDialog( const QString& string, bool closeView )
   309 void VideoBasePlaybackView::showDialog( const QString& string, bool closeView, bool isError )
   311 {
   310 {
   312     MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d )"), string.data(), closeView );
   311     MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d, %d )"), string.data(), closeView, isError );
   313 
   312 
   314     //
   313     //
   315     // create pop-up dialog for error notes,
   314     // create pop-up dialog for error notes and notifications,
   316     //     set its position to the middle of the screen
   315     // For error notes, HbMessageBox is used: 
   317     //     and make sure pop-up dialog gets deleted on close.
   316     //  - Note will be dismissed by using standard timeout or
   318     //
   317     //  - If user taps anywhere on the screen.
   319     QRectF screenRect = hbInstance->allMainWindows()[0]->rect();
   318     // For notifications, HbNotification dialog will be used.
   320     HbNotificationDialog* dlg = new HbNotificationDialog();
   319     //
       
   320 
       
   321     HbDialog *dlg = 0;
       
   322     if(isError)
       
   323     {
       
   324         dlg = new HbMessageBox( string, HbMessageBox::MessageTypeWarning ); 
       
   325         // dialog will be closed by timeout, no buttons used
       
   326         qobject_cast<HbMessageBox*>( dlg )->setStandardButtons( HbMessageBox::NoButton );
       
   327     } 
       
   328     else
       
   329     {
       
   330         dlg = new HbNotificationDialog();
       
   331         qobject_cast<HbNotificationDialog*>( dlg )->setTitle( string );
       
   332     }       
   321     dlg->setAttribute( Qt::WA_DeleteOnClose );
   333     dlg->setAttribute( Qt::WA_DeleteOnClose );
   322 
   334     dlg->setDismissPolicy( HbPopup::TapAnywhere );
       
   335     dlg->setTimeout( HbPopup::StandardTimeout );
   323 	if ( closeView )
   336 	if ( closeView )
   324 	{
   337 	{
   325         //
   338         //
   326         // connect aboutToClose() signal to handleClosePopupDialog() slot so that
   339         // connect aboutToClose() signal to handleClosePopupDialog() slot so that
   327         // when pop-up dialog is closed, playback view is closed also
   340         // when pop-up dialog is closed, playback view is closed also
   328         //
   341         //
   329         connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( handleClosePopupDialog() ) );
   342         connect( dlg, SIGNAL( aboutToClose() ), this, SLOT( handleClosePopupDialog() ) );
   330     }
   343     }
   331 
   344 
   332 	dlg->setTitle( string );
       
   333     dlg->show();
   345     dlg->show();
   334 }
   346 }
   335 
   347 
   336 // -------------------------------------------------------------------------------------------------
   348 // -------------------------------------------------------------------------------------------------
   337 //   VideoBasePlaybackView::doClosePlayer
   349 //   VideoBasePlaybackView::doClosePlayer