videoplayback/videoplaybackviews/src/mpxvideoplaybackuserinputhandler.cpp
branchRCL_3
changeset 16 67eb01668b0e
parent 12 7f2b2a65da29
child 21 315810614048
equal deleted inserted replaced
15:8f0df5c82986 16:67eb01668b0e
    13 *
    13 *
    14 * Description:  Implementation of playback view's input handler
    14 * Description:  Implementation of playback view's input handler
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: 18 %
    18 
       
    19 // Version : %version: 19 %
    19 
    20 
    20 
    21 
    21 // INCLUDE FILES
    22 // INCLUDE FILES
    22 #include <w32std.h> // RWindowBase
    23 #include <w32std.h> // RWindowBase
    23 #include <e32base.h>
    24 #include <e32base.h>
    49 #include <mpxvideoplaybackdefs.h>
    50 #include <mpxvideoplaybackdefs.h>
    50 #include "mpxcommonvideoplaybackview.hrh"
    51 #include "mpxcommonvideoplaybackview.hrh"
    51 #include "mpxvideo_debug.h"
    52 #include "mpxvideo_debug.h"
    52 
    53 
    53 
    54 
    54 
       
    55 
       
    56 // ======== MEMBER FUNCTIONS =======================================================================
    55 // ======== MEMBER FUNCTIONS =======================================================================
    57 
    56 
    58 // -------------------------------------------------------------------------------------------------
    57 // -------------------------------------------------------------------------------------------------
    59 // MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
    58 // MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
    60 // -------------------------------------------------------------------------------------------------
    59 // -------------------------------------------------------------------------------------------------
    61 //
    60 //
    62 CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler(
    61 CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler(
    63         CMPXVideoPlaybackContainer* aContainer)
    62         CMPXVideoPlaybackContainer* aContainer)
    64    : iContainer(aContainer)
    63    : iProcessingInputType(EMpxVideoNone),
       
    64      iForeground(ETrue),
       
    65      iBlockPdlInputs(EFalse),
       
    66      iContainer(aContainer)
    65 {
    67 {
    66 }
    68 }
    67 
    69 
    68 // -------------------------------------------------------------------------------------------------
    70 // -------------------------------------------------------------------------------------------------
    69 // CMPXVideoPlaybackUserInputHandler::NewL()
    71 // CMPXVideoPlaybackUserInputHandler::NewL()
    96     iInterfaceSelector = CRemConInterfaceSelector::NewL();
    98     iInterfaceSelector = CRemConInterfaceSelector::NewL();
    97     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
    99     iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
    98 
   100 
    99     // not detrimental if Media Keys dont work - so ignore any errors here
   101     // not detrimental if Media Keys dont work - so ignore any errors here
   100     TRAP_IGNORE( iInterfaceSelector->OpenTargetL() );
   102     TRAP_IGNORE( iInterfaceSelector->OpenTargetL() );
   101 
       
   102     iProcessingInputType = EMpxVideoNone;
       
   103     iForeground = ETrue;
       
   104 }
   103 }
   105 
   104 
   106 // -------------------------------------------------------------------------------------------------
   105 // -------------------------------------------------------------------------------------------------
   107 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   106 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   108 // -------------------------------------------------------------------------------------------------
   107 // -------------------------------------------------------------------------------------------------
   114     if ( iVolumeRepeatTimer )
   113     if ( iVolumeRepeatTimer )
   115     {
   114     {
   116         iVolumeRepeatTimer->Cancel();
   115         iVolumeRepeatTimer->Cancel();
   117         delete iVolumeRepeatTimer;
   116         delete iVolumeRepeatTimer;
   118     }
   117     }
   119 
       
   120 
   118 
   121     if ( iInterfaceSelector )
   119     if ( iInterfaceSelector )
   122     {
   120     {
   123         delete iInterfaceSelector;
   121         delete iInterfaceSelector;
   124         iCoreTarget = NULL;
   122         iCoreTarget = NULL;
   235     else if ( aButtonAct == ERemConCoreApiButtonRelease )
   233     else if ( aButtonAct == ERemConCoreApiButtonRelease )
   236     {
   234     {
   237         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) );
   235         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) );
   238     }
   236     }
   239 }
   237 }
   240 
       
   241 
   238 
   242 // -------------------------------------------------------------------------------------------------
   239 // -------------------------------------------------------------------------------------------------
   243 // CMPXVideoPlaybackUserInputHandler::HandleRewind()
   240 // CMPXVideoPlaybackUserInputHandler::HandleRewind()
   244 // -------------------------------------------------------------------------------------------------
   241 // -------------------------------------------------------------------------------------------------
   245 //
   242 //
   300             break;
   297             break;
   301         }
   298         }
   302     }
   299     }
   303 }
   300 }
   304 
   301 
   305 
       
   306 // -------------------------------------------------------------------------------------------------
   302 // -------------------------------------------------------------------------------------------------
   307 // CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
   303 // CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
   308 // -------------------------------------------------------------------------------------------------
   304 // -------------------------------------------------------------------------------------------------
   309 //
   305 //
   310 void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct )
   306 void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct )
   345             break;
   341             break;
   346         }
   342         }
   347     }
   343     }
   348 }
   344 }
   349 
   345 
   350 
       
   351 // -------------------------------------------------------------------------------------------------
   346 // -------------------------------------------------------------------------------------------------
   352 // CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()
   347 // CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()
   353 // -------------------------------------------------------------------------------------------------
   348 // -------------------------------------------------------------------------------------------------
   354 //
   349 //
   355 EXPORT_C void
   350 EXPORT_C void
   363 
   358 
   364     switch ( iProcessingInputType )
   359     switch ( iProcessingInputType )
   365     {
   360     {
   366         case EMpxVideoNone:
   361         case EMpxVideoNone:
   367         {
   362         {
   368             if ( aPointerEvent.iType == TPointerEvent::EButton1Down && iForeground )
   363             if ( aPointerEvent.iType == TPointerEvent::EButton1Down && IsUserInputAllowed() )
   369             {
   364             {
   370                 iProcessingInputType = EMpxVideoTouch;
   365                 iProcessingInputType = EMpxVideoTouch;
   371 
   366 
   372                 //
   367                 //
   373                 //  Save the active controls pointer to reroute invalid pointer events
   368                 //  Save the active controls pointer to reroute invalid pointer events
   409                 //  end the current active control pointer processing
   404                 //  end the current active control pointer processing
   410                 //
   405                 //
   411                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   406                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   412                 {
   407                 {
   413                     //
   408                     //
   414                     //  Reroute button up event to active control and end current 
   409                     //  Reroute button up event to active control and end current
   415                     //  control processing
   410                     //  control processing
   416                     //
   411                     //
   417                     ReRoutePointerEventL( iActiveControlPtr, aPointerEvent, iActiveControlType );
   412                     ReRoutePointerEventL( iActiveControlPtr, aPointerEvent, iActiveControlType );
   418                     iProcessingInputType = EMpxVideoNone;
   413                     iProcessingInputType = EMpxVideoNone;
   419                     iActiveControlPtr = NULL;
   414                     iActiveControlPtr = NULL;
   457 
   452 
   458     switch ( iProcessingInputType )
   453     switch ( iProcessingInputType )
   459     {
   454     {
   460         case EMpxVideoNone:
   455         case EMpxVideoNone:
   461         {
   456         {
   462             if ( aType == EEventKeyDown && iForeground )
   457             if ( aType == EEventKeyDown && IsUserInputAllowed() )
   463             {
   458             {
   464                 iProcessingInputType = EMpxVideoKeyboard;
   459                 iProcessingInputType = EMpxVideoKeyboard;
   465                 iLastPressedKeyCode = aKeyEvent.iCode;
   460                 iLastPressedKeyCode = aKeyEvent.iCode;
   466                 iLastPressedKeyScanCode = aKeyEvent.iScanCode;
   461                 iLastPressedKeyScanCode = aKeyEvent.iScanCode;
   467 
   462 
   502 
   497 
   503     switch ( iProcessingInputType )
   498     switch ( iProcessingInputType )
   504     {
   499     {
   505         case EMpxVideoNone:
   500         case EMpxVideoNone:
   506         {
   501         {
   507             if ( iForeground )
   502             if ( IsUserInputAllowed() )
   508             {
   503             {
   509                 if ( aButtonAct == ERemConCoreApiButtonPress )
   504                 if ( aButtonAct == ERemConCoreApiButtonPress )
   510                 {
   505                 {
   511                     iProcessingInputType = EMpxVideoMediaKeys;
   506                     iProcessingInputType = EMpxVideoMediaKeys;
   512                     iLastMediaKeyPressed = aOperationId;
   507                     iLastMediaKeyPressed = aOperationId;
   596             iVolumeRepeatTimer->Cancel();
   591             iVolumeRepeatTimer->Cancel();
   597         }
   592         }
   598     }
   593     }
   599 }
   594 }
   600 
   595 
       
   596 // -------------------------------------------------------------------------------------------------
       
   597 //   CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs()
       
   598 // -------------------------------------------------------------------------------------------------
       
   599 //
       
   600 void CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs( TBool aBlockInputs )
       
   601 {
       
   602     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs(%d)"), aBlockInputs);
       
   603 
       
   604     iBlockPdlInputs = aBlockInputs;
       
   605 }
       
   606 
       
   607 // -------------------------------------------------------------------------------------------------
       
   608 //   CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed()
       
   609 // -------------------------------------------------------------------------------------------------
       
   610 //
       
   611 TBool CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed()
       
   612 {
       
   613     TBool allowInput = ( iForeground && ! iBlockPdlInputs );
       
   614 
       
   615     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed(%d)"), allowInput);
       
   616 
       
   617     return allowInput;
       
   618 }
   601 
   619 
   602 // EOF
   620 // EOF