videoplayback/videoplaybackview/viewsrc/videobaseplaybackview.cpp
changeset 66 adb51f74b890
parent 63 4707a0db12f6
equal deleted inserted replaced
63:4707a0db12f6 66:adb51f74b890
    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: 49.1.2 %
    18 // Version : %version: da1mmcf#49.1.3 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
    49 #include "videobaseplaybackview.h"
    49 #include "videobaseplaybackview.h"
    50 #include "videoactivitystate.h"
    50 #include "videoactivitystate.h"
    51 #include "videoplaybackviewfiledetails.h"
    51 #include "videoplaybackviewfiledetails.h"
    52 #include "mpxcommonvideoplaybackview.hrh"
    52 #include "mpxcommonvideoplaybackview.hrh"
    53 
    53 
       
    54 const int KPanGestureThreshold = 200;
    54 
    55 
    55 //  Member Functions
    56 //  Member Functions
    56 
    57 
    57 // -------------------------------------------------------------------------------------------------
    58 // -------------------------------------------------------------------------------------------------
    58 // VideoBasePlaybackView::VideoBasePlaybackView()
    59 // VideoBasePlaybackView::VideoBasePlaybackView()
   310 {
   311 {
   311     MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d, %d )"), string.data(), closeView, isError );
   312     MPX_DEBUG(_L("VideoBasePlaybackView::showDialog( %s, %d, %d )"), string.data(), closeView, isError );
   312 
   313 
   313     //
   314     //
   314     // create pop-up dialog for error notes and notifications,
   315     // create pop-up dialog for error notes and notifications,
   315     // For error notes, HbMessageBox is used: 
   316     // For error notes, HbMessageBox is used:
   316     //  - Note will be dismissed by using standard timeout or
   317     //  - Note will be dismissed by using standard timeout or
   317     //  - If user taps anywhere on the screen.
   318     //  - If user taps anywhere on the screen.
   318     // For notifications, HbNotification dialog will be used.
   319     // For notifications, HbNotification dialog will be used.
   319     //
   320     //
   320 
   321 
   321     HbDialog *dlg = 0;
   322     HbDialog *dlg = 0;
   322     if(isError)
   323     if(isError)
   323     {
   324     {
   324         dlg = new HbMessageBox( string, HbMessageBox::MessageTypeWarning ); 
   325         dlg = new HbMessageBox( string, HbMessageBox::MessageTypeWarning );
   325         // dialog will be closed by timeout, no buttons used
   326         // dialog will be closed by timeout, no buttons used
   326         qobject_cast<HbMessageBox*>( dlg )->setStandardButtons( HbMessageBox::NoButton );
   327         qobject_cast<HbMessageBox*>( dlg )->setStandardButtons( HbMessageBox::NoButton );
   327     } 
   328     }
   328     else
   329     else
   329     {
   330     {
   330         dlg = new HbNotificationDialog();
   331         dlg = new HbNotificationDialog();
   331         qobject_cast<HbNotificationDialog*>( dlg )->setTitle( string );
   332         qobject_cast<HbNotificationDialog*>( dlg )->setTitle( string );
   332     }       
   333     }
   333     dlg->setAttribute( Qt::WA_DeleteOnClose );
   334     dlg->setAttribute( Qt::WA_DeleteOnClose );
   334     dlg->setDismissPolicy( HbPopup::TapAnywhere );
   335     dlg->setDismissPolicy( HbPopup::TapAnywhere );
   335     dlg->setTimeout( HbPopup::StandardTimeout );
   336     dlg->setTimeout( HbPopup::StandardTimeout );
   336 	if ( closeView )
   337 	if ( closeView )
   337 	{
   338 	{
   470             MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() tapGesture finished") );
   471             MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() tapGesture finished") );
   471 
   472 
   472             emit tappedOnScreen();
   473             emit tappedOnScreen();
   473         }
   474         }
   474     }
   475     }
   475     else if ( HbPanGesture* gesture = static_cast<HbPanGesture*>( event->gesture( Qt::PanGesture ) ) )
   476 
   476     {
   477     if ( HbPanGesture* gesture = static_cast<HbPanGesture*>( event->gesture( Qt::PanGesture ) ) )
   477         if ( gesture->state() == Qt::GestureFinished && mActivated )
   478     {
   478         {
   479         if ( mActivated && gesture->state() == Qt::GestureFinished )
   479             QPointF delta( gesture->sceneDelta() );
   480         {
   480 
   481             MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() pan gesture finished"));
   481             if ( delta.x() > 0 )
   482 
       
   483             int nonZeroVelocity = (int)( gesture->sceneVelocity().x() );
       
   484             int offset = (int)( gesture->sceneOffset().x() );
       
   485 
       
   486             if ( offset > KPanGestureThreshold && nonZeroVelocity > 0 )
   482             {
   487             {
   483                 MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() right") );
   488                 MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() pan gesture right") );
   484 
   489 
   485                 emit pannedToRight();
   490                 emit pannedToRight();
   486             }
   491             }
   487             else
   492             else if ( offset < KPanGestureThreshold * -1.0f && nonZeroVelocity < 0 )
   488             {
   493             {
   489                 MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() left") );
   494                 MPX_DEBUG(_L("VideoBasePlaybackView::gestureEvent() pan gesture left") );
   490 
   495 
   491                 emit pannedToLeft();
   496                 emit pannedToLeft();
   492             }
   497             }
   493         }
   498         }
   494     }
   499     }