videoplayback/videoplaybackviews/src/mpxvideoplaybackuserinputhandler.cpp
branchRCL_3
changeset 11 8970fbd719ec
parent 9 5294c000a26d
child 12 7f2b2a65da29
equal deleted inserted replaced
10:112a725ff2c2 11:8970fbd719ec
    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: ou1cpsw#16 %
    18 // Version : %version: 17 %
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <w32std.h> // RWindowBase
    22 #include <w32std.h> // RWindowBase
    23 #include <e32base.h>
    23 #include <e32base.h>
    70 // -------------------------------------------------------------------------------------------------
    70 // -------------------------------------------------------------------------------------------------
    71 //
    71 //
    72 CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
    72 CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
    73         CMPXVideoPlaybackContainer* aContainer )
    73         CMPXVideoPlaybackContainer* aContainer )
    74 {
    74 {
    75     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
    75     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
    76 
    76 
    77     CMPXVideoPlaybackUserInputHandler* self =
    77     CMPXVideoPlaybackUserInputHandler* self =
    78         new (ELeave) CMPXVideoPlaybackUserInputHandler( aContainer );
    78         new (ELeave) CMPXVideoPlaybackUserInputHandler( aContainer );
    79     CleanupStack::PushL( self );
    79     CleanupStack::PushL( self );
    80     self->ConstructL();
    80     self->ConstructL();
   107 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   107 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   108 // -------------------------------------------------------------------------------------------------
   108 // -------------------------------------------------------------------------------------------------
   109 //
   109 //
   110 CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   110 CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
   111 {
   111 {
       
   112     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()"));
       
   113 
   112     if ( iVolumeRepeatTimer )
   114     if ( iVolumeRepeatTimer )
   113     {
   115     {
   114         iVolumeRepeatTimer->Cancel();
   116         iVolumeRepeatTimer->Cancel();
   115         delete iVolumeRepeatTimer;
   117         delete iVolumeRepeatTimer;
   116     }
   118     }
   120     {
   122     {
   121         delete iInterfaceSelector;
   123         delete iInterfaceSelector;
   122         iCoreTarget = NULL;
   124         iCoreTarget = NULL;
   123         iInterfaceSelector = NULL;
   125         iInterfaceSelector = NULL;
   124     }
   126     }
   125 
       
   126 }
   127 }
   127 
   128 
   128 // -------------------------------------------------------------------------------------------------
   129 // -------------------------------------------------------------------------------------------------
   129 // CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
   130 // CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
   130 // -------------------------------------------------------------------------------------------------
   131 // -------------------------------------------------------------------------------------------------
   134 {
   135 {
   135     MPX_ENTER_EXIT(
   136     MPX_ENTER_EXIT(
   136         _L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"),
   137         _L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"),
   137         _L("aButtonAct = %d"), aButtonAct );
   138         _L("aButtonAct = %d"), aButtonAct );
   138 
   139 
   139     ProcessMediaKey(ERemConCoreApiPlay, aButtonAct);
   140     ProcessMediaKey( ERemConCoreApiPlay, aButtonAct );
   140 }
   141 }
   141 
   142 
   142 // -------------------------------------------------------------------------------------------------
   143 // -------------------------------------------------------------------------------------------------
   143 // CMPXVideoPlaybackUserInputHandler::MrccatoCommand()
   144 // CMPXVideoPlaybackUserInputHandler::MrccatoCommand()
   144 // -------------------------------------------------------------------------------------------------
   145 // -------------------------------------------------------------------------------------------------
   145 //
   146 //
   146 void CMPXVideoPlaybackUserInputHandler::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
   147 void CMPXVideoPlaybackUserInputHandler::MrccatoCommand( TRemConCoreApiOperationId aOperationId,
   147                                                        TRemConCoreApiButtonAction aButtonAct )
   148                                                         TRemConCoreApiButtonAction aButtonAct )
   148 {
   149 {
   149     MPX_ENTER_EXIT(
   150     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand"));
   150         _L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand"),
   151 
   151         _L("aButtonAct = %d"), aButtonAct );
   152     ProcessMediaKey( aOperationId, aButtonAct );
   152 
       
   153     ProcessMediaKey(aOperationId, aButtonAct);
       
   154 }
   153 }
   155 
   154 
   156 // -------------------------------------------------------------------------------------------------
   155 // -------------------------------------------------------------------------------------------------
   157 // CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()
   156 // CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()
   158 // -------------------------------------------------------------------------------------------------
   157 // -------------------------------------------------------------------------------------------------
   159 //
   158 //
   160 void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId,
   159 void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId,
   161                                                           TRemConCoreApiButtonAction aButtonAct )
   160                                                           TRemConCoreApiButtonAction aButtonAct )
   162 {
   161 {
   163     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()"));
   162     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()"),
       
   163                    _L("aOperationId = %d"), aOperationId );
   164 
   164 
   165     switch ( aOperationId )
   165     switch ( aOperationId )
   166     {
   166     {
   167         case ERemConCoreApiStop:
   167         case ERemConCoreApiStop:
   168         {
   168         {
   176             }
   176             }
   177             break;
   177             break;
   178         }
   178         }
   179         case ERemConCoreApiRewind:
   179         case ERemConCoreApiRewind:
   180         {
   180         {
   181             HandleRewind(aButtonAct);
   181             HandleRewind( aButtonAct );
   182             break;
   182             break;
   183         }
   183         }
   184         case ERemConCoreApiFastForward:
   184         case ERemConCoreApiFastForward:
   185         {
   185         {
   186             HandleFastForward(aButtonAct);
   186             HandleFastForward( aButtonAct );
   187             break;
   187             break;
   188         }
   188         }
   189         case ERemConCoreApiVolumeUp:
   189         case ERemConCoreApiVolumeUp:
   190         {
   190         {
   191             HandleVolumeUp(aButtonAct);
   191             HandleVolumeUp( aButtonAct );
   192             break;
   192             break;
   193         }
   193         }
   194         case ERemConCoreApiVolumeDown:
   194         case ERemConCoreApiVolumeDown:
   195         {
   195         {
   196             HandleVolumeDown(aButtonAct);
   196             HandleVolumeDown( aButtonAct );
   197             break;
   197             break;
   198         }
   198         }
   199         case ERemConCoreApiPausePlayFunction:
   199         case ERemConCoreApiPausePlayFunction:
   200         {
   200         {
   201             if ( aButtonAct == ERemConCoreApiButtonClick )
   201             if ( aButtonAct == ERemConCoreApiButtonClick )
   202             {
   202             {
   203                 TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdPlayPause));
   203                 TRAP_IGNORE(iContainer->HandleCommandL( EMPXPbvCmdPlayPause ));
   204             }
   204             }
   205             break;
   205             break;
   206         }
   206         }
   207         case ERemConCoreApiPause:
   207         case ERemConCoreApiPause:
   208         {
   208         {
   209             TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdPause));
   209             TRAP_IGNORE( iContainer->HandleCommandL(EMPXPbvCmdPause) );
   210             break;
   210             break;
   211         }
   211         }
   212         case ERemConCoreApiPlay:
   212         case ERemConCoreApiPlay:
   213         {
   213         {
   214             if ( aButtonAct == ERemConCoreApiButtonClick )
   214             if ( aButtonAct == ERemConCoreApiButtonClick )
   215             {
   215             {
   216                 TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdPlay));
   216                 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdPlay ) );
   217             }
   217             }
   218             break;
   218             break;
   219         }
   219         }
   220         default:
       
   221             break;
       
   222     }
   220     }
   223 }
   221 }
   224 
   222 
   225 // -------------------------------------------------------------------------------------------------
   223 // -------------------------------------------------------------------------------------------------
   226 // CMPXVideoPlaybackUserInputHandler::HandleFastForward()
   224 // CMPXVideoPlaybackUserInputHandler::HandleFastForward()
   227 // -------------------------------------------------------------------------------------------------
   225 // -------------------------------------------------------------------------------------------------
   228 //
   226 //
   229 void CMPXVideoPlaybackUserInputHandler::HandleFastForward(TRemConCoreApiButtonAction aButtonAct)
   227 void CMPXVideoPlaybackUserInputHandler::HandleFastForward( TRemConCoreApiButtonAction aButtonAct )
   230 {
   228 {
   231     if (aButtonAct == ERemConCoreApiButtonPress)
   229     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleFastForward()"));
   232     {
   230 
   233         TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdSeekForward));
   231     if ( aButtonAct == ERemConCoreApiButtonPress )
   234     }
   232     {
   235     else if (aButtonAct == ERemConCoreApiButtonRelease)
   233         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdSeekForward ) );
   236     {
   234     }
   237         TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdEndSeek));
   235     else if ( aButtonAct == ERemConCoreApiButtonRelease )
       
   236     {
       
   237         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) );
   238     }
   238     }
   239 }
   239 }
   240 
   240 
   241 
   241 
   242 // -------------------------------------------------------------------------------------------------
   242 // -------------------------------------------------------------------------------------------------
   243 // CMPXVideoPlaybackUserInputHandler::HandleRewind()
   243 // CMPXVideoPlaybackUserInputHandler::HandleRewind()
   244 // -------------------------------------------------------------------------------------------------
   244 // -------------------------------------------------------------------------------------------------
   245 //
   245 //
   246 void CMPXVideoPlaybackUserInputHandler::HandleRewind(TRemConCoreApiButtonAction aButtonAct)
   246 void CMPXVideoPlaybackUserInputHandler::HandleRewind( TRemConCoreApiButtonAction aButtonAct )
   247 {
   247 {
   248     if (aButtonAct == ERemConCoreApiButtonPress)
   248     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleFastForward()"));
   249     {
   249 
   250         TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdSeekBackward));
   250     if ( aButtonAct == ERemConCoreApiButtonPress )
   251     }
   251     {
   252     else if (aButtonAct == ERemConCoreApiButtonRelease)
   252         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdSeekBackward ) );
   253     {
   253     }
   254         TRAP_IGNORE(iContainer->HandleCommandL(EMPXPbvCmdEndSeek));
   254     else if ( aButtonAct == ERemConCoreApiButtonRelease )
       
   255     {
       
   256         TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) );
   255     }
   257     }
   256 }
   258 }
   257 
   259 
   258 // -------------------------------------------------------------------------------------------------
   260 // -------------------------------------------------------------------------------------------------
   259 // CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()
   261 // CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()
   260 // -------------------------------------------------------------------------------------------------
   262 // -------------------------------------------------------------------------------------------------
   261 //
   263 //
   262 void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp(TRemConCoreApiButtonAction aButtonAct)
   264 void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp( TRemConCoreApiButtonAction aButtonAct )
   263 {
   265 {
       
   266     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()"),
       
   267                    _L("aButtonAct = %d"), aButtonAct );
       
   268 
   264     switch ( aButtonAct )
   269     switch ( aButtonAct )
   265     {
   270     {
   266         case ERemConCoreApiButtonPress:
   271         case ERemConCoreApiButtonPress:
   267         {
   272         {
   268             // Volume Up - Pressed
   273             // Volume Up - Pressed
   270             {
   275             {
   271                 iVolumeRepeatTimer->Cancel();
   276                 iVolumeRepeatTimer->Cancel();
   272             }
   277             }
   273 
   278 
   274             iVolumeRepeatUp = ETrue;
   279             iVolumeRepeatUp = ETrue;
       
   280 
   275             iVolumeRepeatTimer->Start(
   281             iVolumeRepeatTimer->Start(
   276                 KAknStandardKeyboardRepeatRate,
   282                 KAknStandardKeyboardRepeatRate,
   277                 KAknStandardKeyboardRepeatRate,
   283                 KAknStandardKeyboardRepeatRate,
   278                 TCallBack(
   284                 TCallBack(
   279                     CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
   285                     CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
   299 
   305 
   300 // -------------------------------------------------------------------------------------------------
   306 // -------------------------------------------------------------------------------------------------
   301 // CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
   307 // CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
   302 // -------------------------------------------------------------------------------------------------
   308 // -------------------------------------------------------------------------------------------------
   303 //
   309 //
   304 void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown(TRemConCoreApiButtonAction aButtonAct)
   310 void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct )
   305 {
   311 {
       
   312     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()"));
       
   313 
   306     switch ( aButtonAct )
   314     switch ( aButtonAct )
   307     {
   315     {
   308         case ERemConCoreApiButtonPress:
   316         case ERemConCoreApiButtonPress:
   309         {
   317         {
   310             // Volume Up - Pressed
   318             // Volume Up - Pressed
   312             {
   320             {
   313                 iVolumeRepeatTimer->Cancel();
   321                 iVolumeRepeatTimer->Cancel();
   314             }
   322             }
   315 
   323 
   316             iVolumeRepeatUp = EFalse;
   324             iVolumeRepeatUp = EFalse;
       
   325 
   317             iVolumeRepeatTimer->Start(
   326             iVolumeRepeatTimer->Start(
   318                 KAknStandardKeyboardRepeatRate,
   327                 KAknStandardKeyboardRepeatRate,
   319                 KAknStandardKeyboardRepeatRate,
   328                 KAknStandardKeyboardRepeatRate,
   320                 TCallBack(
   329                 TCallBack(
   321                     CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
   330                     CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
   346 EXPORT_C void
   355 EXPORT_C void
   347 CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl,
   356 CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl,
   348                                                          const TPointerEvent& aPointerEvent,
   357                                                          const TPointerEvent& aPointerEvent,
   349                                                          TMPXVideoControlType aMPXControl )
   358                                                          TMPXVideoControlType aMPXControl )
   350 {
   359 {
   351     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent"));
   360     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()"));
   352 
   361 
   353     switch (iProcessingInputType)
   362     switch ( iProcessingInputType )
   354     {
   363     {
   355         case EMpxVideoNone:
   364         case EMpxVideoNone:
   356         {
   365         {
   357             if (aPointerEvent.iType == TPointerEvent::EButton1Down && iForeground)
   366             if ( aPointerEvent.iType == TPointerEvent::EButton1Down && iForeground )
   358             {
   367             {
   359                 iProcessingInputType = EMpxVideoTouch;
   368                 iProcessingInputType = EMpxVideoTouch;
   360 
   369 
   361                 ReRoutePointerEventL(aControl, aPointerEvent, aMPXControl);
   370                 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
   362             }
   371             }
   363             break;
   372             break;
   364         }
   373         }
   365         case EMpxVideoTouch:
   374         case EMpxVideoTouch:
   366         {
   375         {
   367             if (aPointerEvent.iType != TPointerEvent::EButton1Down)
   376             if ( aPointerEvent.iType != TPointerEvent::EButton1Down )
   368             {
   377             {
   369                 ReRoutePointerEventL(aControl, aPointerEvent, aMPXControl);
   378                 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl );
   370 
   379 
   371                 // reset the value only on pointer up event - but not on drag
   380                 // reset the value only on pointer up event - but not on drag
   372                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   381                 if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
   373                 {
   382                 {
   374                     iProcessingInputType = EMpxVideoNone;
   383                     iProcessingInputType = EMpxVideoNone;
   375                 }
   384                 }
   376             }
   385             }
   377             break;
   386             break;
   378         }
   387         }
   379         default:
       
   380         {
       
   381             // user input is disallowed
       
   382             break;
       
   383         }
       
   384     } // switch
   388     } // switch
   385 }
   389 }
   386 
   390 
   387 
   391 
   388 // -------------------------------------------------------------------------------------------------
   392 // -------------------------------------------------------------------------------------------------
   390 // -------------------------------------------------------------------------------------------------
   394 // -------------------------------------------------------------------------------------------------
   391 //
   395 //
   392 void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
   396 void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
   393                                                           TEventCode aType )
   397                                                           TEventCode aType )
   394 {
   398 {
   395     MPX_DEBUG(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent"));
   399     MPX_ENTER_EXIT(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent()"));
   396 
   400 
   397     switch (iProcessingInputType)
   401     switch ( iProcessingInputType )
   398     {
   402     {
   399         case EMpxVideoNone:
   403         case EMpxVideoNone:
   400         {
   404         {
   401             if (aType == EEventKeyDown && iForeground)
   405             if ( aType == EEventKeyDown && iForeground )
   402             {
   406             {
   403                 iProcessingInputType = EMpxVideoKeyboard;
   407                 iProcessingInputType = EMpxVideoKeyboard;
   404                 iLastPressedKeyCode = aKeyEvent.iCode;
   408                 iLastPressedKeyCode = aKeyEvent.iCode;
   405                 iLastPressedKeyScanCode = aKeyEvent.iScanCode;
   409                 iLastPressedKeyScanCode = aKeyEvent.iScanCode;
   406 
   410 
   408             }
   412             }
   409             break;
   413             break;
   410         }
   414         }
   411         case EMpxVideoKeyboard:
   415         case EMpxVideoKeyboard:
   412         {
   416         {
   413             if (aType == EEventKeyUp)
   417             if ( aType == EEventKeyUp )
   414             {
   418             {
   415                 // only handle up event for the key being handled
   419                 // only handle up event for the key being handled
   416                 // ignore spurious key presses
   420                 // ignore spurious key presses
   417                 if (aKeyEvent.iCode == iLastPressedKeyCode  &&
   421                 if ( aKeyEvent.iCode == iLastPressedKeyCode  &&
   418                     aKeyEvent.iScanCode == iLastPressedKeyScanCode)
   422                      aKeyEvent.iScanCode == iLastPressedKeyScanCode )
   419                 {
   423                 {
   420                     iContainer->DoHandleKeyEventL(aKeyEvent, aType);
   424                     iContainer->DoHandleKeyEventL(aKeyEvent, aType);
   421 
   425 
   422                     // reset the value only on key up event
   426                     // reset the value only on key up event
   423                     iProcessingInputType = EMpxVideoNone;
   427                     iProcessingInputType = EMpxVideoNone;
   424                 }
   428                 }
   425             }
   429             }
   426             break;
   430             break;
   427         }
   431         }
   428         default:
       
   429         {
       
   430             // user input is disallowed
       
   431             break;
       
   432         }
       
   433     } // switch
   432     } // switch
   434 }
   433 }
   435 
   434 
   436 // -------------------------------------------------------------------------------------------------
   435 // -------------------------------------------------------------------------------------------------
   437 // CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()
   436 // CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()
   438 // -------------------------------------------------------------------------------------------------
   437 // -------------------------------------------------------------------------------------------------
   439 //
   438 //
   440 void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey( TRemConCoreApiOperationId aOperationId,
   439 void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey( TRemConCoreApiOperationId aOperationId,
   441                                                          TRemConCoreApiButtonAction aButtonAct )
   440                                                          TRemConCoreApiButtonAction aButtonAct )
   442 {
   441 {
   443     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey"));
   442     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()"),
       
   443                    _L("iProcessingInputType = %d, aButtonAct = %d"),
       
   444                        iProcessingInputType, aButtonAct );
   444 
   445 
   445     switch ( iProcessingInputType )
   446     switch ( iProcessingInputType )
   446     {
   447     {
   447         case EMpxVideoNone:
   448         case EMpxVideoNone:
   448         {
   449         {
   449             if ( aButtonAct == ERemConCoreApiButtonPress && iForeground )
   450             if ( iForeground )
   450             {
   451             {
   451                 iProcessingInputType = EMpxVideoMediaKeys;
   452                 if ( aButtonAct == ERemConCoreApiButtonPress )
   452                 iLastMediaKeyPressed = aOperationId;
       
   453                 DoHandleMediaKey(aOperationId, aButtonAct);
       
   454             }
       
   455             else if (aButtonAct == ERemConCoreApiButtonClick && iForeground)
       
   456             {
       
   457                 DoHandleMediaKey(aOperationId, aButtonAct);
       
   458                 // reset on click AND/OR release
       
   459                 iProcessingInputType = EMpxVideoNone;
       
   460             }
       
   461             break;
       
   462         }
       
   463         case EMpxVideoMediaKeys:
       
   464         {
       
   465             if (aButtonAct == ERemConCoreApiButtonRelease)
       
   466             {
       
   467                 // handle only if this release is for media-key being currently handled
       
   468                 // ignore spurious media key presses
       
   469                 if (iLastMediaKeyPressed == aOperationId)
       
   470                 {
   453                 {
   471                     DoHandleMediaKey(aOperationId, aButtonAct);
   454                     iProcessingInputType = EMpxVideoMediaKeys;
       
   455                     iLastMediaKeyPressed = aOperationId;
       
   456                     DoHandleMediaKey( aOperationId, aButtonAct );
       
   457                 }
       
   458                 else if ( aButtonAct == ERemConCoreApiButtonClick )
       
   459                 {
       
   460                     DoHandleMediaKey( aOperationId, aButtonAct );
   472                     // reset on click AND/OR release
   461                     // reset on click AND/OR release
   473                     iProcessingInputType = EMpxVideoNone;
   462                     iProcessingInputType = EMpxVideoNone;
   474                 }
   463                 }
   475             }
   464             }
   476             break;
   465             break;
   477         }
   466         }
   478         default:
   467         case EMpxVideoMediaKeys:
   479         {
   468         {
   480             // user input is disallowed
   469             if ( aButtonAct == ERemConCoreApiButtonRelease )
       
   470             {
       
   471                 //
       
   472                 //  Handle only if this release is for media-key being currently handled
       
   473                 //  Ignore spurious media key presses
       
   474                 //
       
   475                 if ( iLastMediaKeyPressed == aOperationId )
       
   476                 {
       
   477                     DoHandleMediaKey( aOperationId, aButtonAct );
       
   478 
       
   479                     iProcessingInputType = EMpxVideoNone;
       
   480                 }
       
   481             }
   481             break;
   482             break;
   482         }
   483         }
   483     } // switch
   484     } // switch
   484 }
   485 }
   485 
   486 
   486 
       
   487 // -------------------------------------------------------------------------------------------------
   487 // -------------------------------------------------------------------------------------------------
   488 //   CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()
   488 //   CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()
   489 // -------------------------------------------------------------------------------------------------
   489 // -------------------------------------------------------------------------------------------------
   490 //
   490 //
   491 TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr )
   491 TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr )
   501 //   CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
   501 //   CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
   502 // -------------------------------------------------------------------------------------------------
   502 // -------------------------------------------------------------------------------------------------
   503 //
   503 //
   504 void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
   504 void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
   505 {
   505 {
   506     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()"));
   506     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()"));
   507 
   507 
   508     TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume;
   508     TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume;
   509 
   509 
   510     if ( iVolumeRepeatUp )
   510     if ( iVolumeRepeatUp )
   511     {
   511     {
   518 
   518 
   519 // -------------------------------------------------------------------------------------------------
   519 // -------------------------------------------------------------------------------------------------
   520 //   CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()
   520 //   CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()
   521 // -------------------------------------------------------------------------------------------------
   521 // -------------------------------------------------------------------------------------------------
   522 //
   522 //
   523 void CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL(CCoeControl* aControl,
   523 void CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL( CCoeControl* aControl,
   524                                                              const TPointerEvent& aPointerEvent,
   524                                                               const TPointerEvent& aPointerEvent,
   525                                                              TMPXVideoControlType aMPXControl)
   525                                                               TMPXVideoControlType aMPXControl )
   526 {
   526 {
   527     MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()"));
   527     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()"));
   528 
   528 
   529     if ( aMPXControl == EMpxVideoPlaybackContainer )
   529     if ( aMPXControl == EMpxVideoPlaybackContainer )
   530     {
   530     {
   531         iContainer->DoHandlePointerEventL(aPointerEvent);
   531         iContainer->DoHandlePointerEventL(aPointerEvent);
   532     }
   532     }
   538 
   538 
   539 // -------------------------------------------------------------------------------------------------
   539 // -------------------------------------------------------------------------------------------------
   540 //   CMPXVideoPlaybackUserInputHandler::SetForeground()
   540 //   CMPXVideoPlaybackUserInputHandler::SetForeground()
   541 // -------------------------------------------------------------------------------------------------
   541 // -------------------------------------------------------------------------------------------------
   542 //
   542 //
   543 void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground)
   543 void CMPXVideoPlaybackUserInputHandler::SetForeground( TBool aForeground )
   544 {
   544 {
       
   545     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::SetForeground()"),
       
   546                    _L("aForeground = %d"), aForeground );
       
   547 
   545     iForeground = aForeground;
   548     iForeground = aForeground;
   546 
   549 
   547     if ( !iForeground )
   550     if ( ! iForeground )
   548     {
   551     {
   549         // we are in background so reset iProcessingInputType value
   552         //
       
   553         //  Keyboard focus has been lost
       
   554         //  Reset input type and clear volume timer if necessary
       
   555         //
   550         iProcessingInputType = EMpxVideoNone;
   556         iProcessingInputType = EMpxVideoNone;
       
   557 
       
   558         if ( iVolumeRepeatTimer->IsActive() )
       
   559         {
       
   560             iVolumeRepeatTimer->Cancel();
       
   561         }
   551     }
   562     }
   552 }
   563 }
   553 
   564 
   554 
   565 
   555 // EOF
   566 // EOF