|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of playback view's input handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Version : %version: 20 % |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <w32std.h> // RWindowBase |
|
24 #include <e32base.h> |
|
25 #include <StringLoader.h> |
|
26 #include <AknUtils.h> |
|
27 #include <eikclbd.h> |
|
28 #include <aknconsts.h> |
|
29 #include <AknUtils.h> |
|
30 #include <AknIconUtils.h> // SetSize for the icons |
|
31 #include <remconcoreapi.h> |
|
32 #include <remconcoreapitarget.h> |
|
33 #include <remconinterfaceselector.h> // Side volume key |
|
34 #include <mpxplaybackframeworkdefs.h> |
|
35 |
|
36 #include <e32std.h> |
|
37 |
|
38 #ifdef __USERINPUTHANDLERSTIF__ |
|
39 #include "videoplaybackcontainer_stub.h" |
|
40 #include "videoplaybackcontrol_stub.h" |
|
41 #include "hal_stub.h" |
|
42 #else |
|
43 #include "mpxvideoplaybackcontainer.h" |
|
44 #include "mpxvideoplaybackcontrol.h" |
|
45 #endif |
|
46 |
|
47 #include "mpxvideoplaybackcontrol.hrh" |
|
48 #include "mpxvideoplaybackuserinputhandler.h" |
|
49 |
|
50 #include <mpxvideoplaybackdefs.h> |
|
51 #include "mpxcommonvideoplaybackview.hrh" |
|
52 #include "mpxvideo_debug.h" |
|
53 |
|
54 |
|
55 // ======== MEMBER FUNCTIONS ======================================================================= |
|
56 |
|
57 // ------------------------------------------------------------------------------------------------- |
|
58 // MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler() |
|
59 // ------------------------------------------------------------------------------------------------- |
|
60 // |
|
61 CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( |
|
62 CMPXVideoPlaybackContainer* aContainer) |
|
63 : iProcessingInputType(EMpxVideoNone), |
|
64 iForeground(ETrue), |
|
65 iBlockPdlInputs(EFalse), |
|
66 iContainer(aContainer) |
|
67 { |
|
68 } |
|
69 |
|
70 // ------------------------------------------------------------------------------------------------- |
|
71 // CMPXVideoPlaybackUserInputHandler::NewL() |
|
72 // ------------------------------------------------------------------------------------------------- |
|
73 // |
|
74 CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL( |
|
75 CMPXVideoPlaybackContainer* aContainer ) |
|
76 { |
|
77 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::NewL()")); |
|
78 |
|
79 CMPXVideoPlaybackUserInputHandler* self = |
|
80 new (ELeave) CMPXVideoPlaybackUserInputHandler( aContainer ); |
|
81 CleanupStack::PushL( self ); |
|
82 self->ConstructL(); |
|
83 CleanupStack::Pop(); |
|
84 return self; |
|
85 } |
|
86 |
|
87 // ------------------------------------------------------------------------------------------------- |
|
88 // CMPXVideoPlaybackUserInputHandler::ConstructL |
|
89 // Symbian 2nd phase constructor can leave. |
|
90 // ------------------------------------------------------------------------------------------------- |
|
91 // |
|
92 void CMPXVideoPlaybackUserInputHandler::ConstructL() |
|
93 { |
|
94 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ConstructL()")); |
|
95 |
|
96 iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
97 |
|
98 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
|
99 iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); |
|
100 |
|
101 // not detrimental if Media Keys dont work - so ignore any errors here |
|
102 TRAP_IGNORE( iInterfaceSelector->OpenTargetL() ); |
|
103 } |
|
104 |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() |
|
107 // ------------------------------------------------------------------------------------------------- |
|
108 // |
|
109 CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler() |
|
110 { |
|
111 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()")); |
|
112 |
|
113 if ( iVolumeRepeatTimer ) |
|
114 { |
|
115 iVolumeRepeatTimer->Cancel(); |
|
116 delete iVolumeRepeatTimer; |
|
117 } |
|
118 |
|
119 if ( iInterfaceSelector ) |
|
120 { |
|
121 delete iInterfaceSelector; |
|
122 iCoreTarget = NULL; |
|
123 iInterfaceSelector = NULL; |
|
124 } |
|
125 } |
|
126 |
|
127 // ------------------------------------------------------------------------------------------------- |
|
128 // CMPXVideoPlaybackUserInputHandler::MrccatoPlay() |
|
129 // ------------------------------------------------------------------------------------------------- |
|
130 // |
|
131 void CMPXVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, |
|
132 TRemConCoreApiButtonAction aButtonAct ) |
|
133 { |
|
134 MPX_ENTER_EXIT( |
|
135 _L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"), |
|
136 _L("aButtonAct = %d"), aButtonAct ); |
|
137 |
|
138 ProcessMediaKey( ERemConCoreApiPlay, aButtonAct ); |
|
139 } |
|
140 |
|
141 // ------------------------------------------------------------------------------------------------- |
|
142 // CMPXVideoPlaybackUserInputHandler::MrccatoCommand() |
|
143 // ------------------------------------------------------------------------------------------------- |
|
144 // |
|
145 void CMPXVideoPlaybackUserInputHandler::MrccatoCommand( TRemConCoreApiOperationId aOperationId, |
|
146 TRemConCoreApiButtonAction aButtonAct ) |
|
147 { |
|
148 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand")); |
|
149 |
|
150 ProcessMediaKey( aOperationId, aButtonAct ); |
|
151 } |
|
152 |
|
153 // ------------------------------------------------------------------------------------------------- |
|
154 // CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey() |
|
155 // ------------------------------------------------------------------------------------------------- |
|
156 // |
|
157 void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId, |
|
158 TRemConCoreApiButtonAction aButtonAct ) |
|
159 { |
|
160 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()"), |
|
161 _L("aOperationId = %d"), aOperationId ); |
|
162 |
|
163 switch ( aOperationId ) |
|
164 { |
|
165 case ERemConCoreApiStop: |
|
166 { |
|
167 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
168 { |
|
169 // |
|
170 // When the stop key is pressed from the remote control interface, |
|
171 // issue a softkey back so all views will exit the playback view. |
|
172 // |
|
173 TRAP_IGNORE( iContainer->HandleCommandL( EAknSoftkeyBack ) ); |
|
174 } |
|
175 break; |
|
176 } |
|
177 case ERemConCoreApiRewind: |
|
178 { |
|
179 HandleRewind( aButtonAct ); |
|
180 break; |
|
181 } |
|
182 case ERemConCoreApiFastForward: |
|
183 { |
|
184 HandleFastForward( aButtonAct ); |
|
185 break; |
|
186 } |
|
187 case ERemConCoreApiVolumeUp: |
|
188 { |
|
189 HandleVolumeUp( aButtonAct ); |
|
190 break; |
|
191 } |
|
192 case ERemConCoreApiVolumeDown: |
|
193 { |
|
194 HandleVolumeDown( aButtonAct ); |
|
195 break; |
|
196 } |
|
197 case ERemConCoreApiPausePlayFunction: |
|
198 { |
|
199 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
200 { |
|
201 TRAP_IGNORE(iContainer->HandleCommandL( EMPXPbvCmdPlayPause )); |
|
202 } |
|
203 break; |
|
204 } |
|
205 case ERemConCoreApiPause: |
|
206 { |
|
207 TRAP_IGNORE( iContainer->HandleCommandL(EMPXPbvCmdPause) ); |
|
208 break; |
|
209 } |
|
210 case ERemConCoreApiPlay: |
|
211 { |
|
212 if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
213 { |
|
214 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdPlay ) ); |
|
215 } |
|
216 break; |
|
217 } |
|
218 } |
|
219 } |
|
220 |
|
221 // ------------------------------------------------------------------------------------------------- |
|
222 // CMPXVideoPlaybackUserInputHandler::HandleFastForward() |
|
223 // ------------------------------------------------------------------------------------------------- |
|
224 // |
|
225 void CMPXVideoPlaybackUserInputHandler::HandleFastForward( TRemConCoreApiButtonAction aButtonAct ) |
|
226 { |
|
227 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleFastForward()")); |
|
228 |
|
229 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
230 { |
|
231 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdSeekForward ) ); |
|
232 } |
|
233 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
234 { |
|
235 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) ); |
|
236 } |
|
237 } |
|
238 |
|
239 // ------------------------------------------------------------------------------------------------- |
|
240 // CMPXVideoPlaybackUserInputHandler::HandleRewind() |
|
241 // ------------------------------------------------------------------------------------------------- |
|
242 // |
|
243 void CMPXVideoPlaybackUserInputHandler::HandleRewind( TRemConCoreApiButtonAction aButtonAct ) |
|
244 { |
|
245 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleFastForward()")); |
|
246 |
|
247 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
248 { |
|
249 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdSeekBackward ) ); |
|
250 } |
|
251 else if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
252 { |
|
253 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdEndSeek ) ); |
|
254 } |
|
255 } |
|
256 |
|
257 // ------------------------------------------------------------------------------------------------- |
|
258 // CMPXVideoPlaybackUserInputHandler::HandleVolumeUp() |
|
259 // ------------------------------------------------------------------------------------------------- |
|
260 // |
|
261 void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp( TRemConCoreApiButtonAction aButtonAct ) |
|
262 { |
|
263 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()"), |
|
264 _L("aButtonAct = %d"), aButtonAct ); |
|
265 |
|
266 switch ( aButtonAct ) |
|
267 { |
|
268 case ERemConCoreApiButtonPress: |
|
269 { |
|
270 // Volume Up - Pressed |
|
271 if ( iVolumeRepeatTimer->IsActive() ) |
|
272 { |
|
273 iVolumeRepeatTimer->Cancel(); |
|
274 } |
|
275 |
|
276 iVolumeRepeatUp = ETrue; |
|
277 |
|
278 iVolumeRepeatTimer->Start( |
|
279 KAknStandardKeyboardRepeatRate, |
|
280 KAknStandardKeyboardRepeatRate, |
|
281 TCallBack( |
|
282 CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, |
|
283 this ) ); |
|
284 |
|
285 break; |
|
286 } |
|
287 case ERemConCoreApiButtonRelease: |
|
288 { |
|
289 // Volume Up - Released |
|
290 iVolumeRepeatTimer->Cancel(); |
|
291 break; |
|
292 } |
|
293 case ERemConCoreApiButtonClick: |
|
294 { |
|
295 // Volume Up - Clicked |
|
296 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdIncreaseVolume ) ); |
|
297 break; |
|
298 } |
|
299 } |
|
300 } |
|
301 |
|
302 // ------------------------------------------------------------------------------------------------- |
|
303 // CMPXVideoPlaybackUserInputHandler::HandleVolumeDown() |
|
304 // ------------------------------------------------------------------------------------------------- |
|
305 // |
|
306 void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown( TRemConCoreApiButtonAction aButtonAct ) |
|
307 { |
|
308 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()")); |
|
309 |
|
310 switch ( aButtonAct ) |
|
311 { |
|
312 case ERemConCoreApiButtonPress: |
|
313 { |
|
314 // Volume Up - Pressed |
|
315 if ( iVolumeRepeatTimer->IsActive() ) |
|
316 { |
|
317 iVolumeRepeatTimer->Cancel(); |
|
318 } |
|
319 |
|
320 iVolumeRepeatUp = EFalse; |
|
321 |
|
322 iVolumeRepeatTimer->Start( |
|
323 KAknStandardKeyboardRepeatRate, |
|
324 KAknStandardKeyboardRepeatRate, |
|
325 TCallBack( |
|
326 CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL, |
|
327 this ) ); |
|
328 |
|
329 break; |
|
330 } |
|
331 case ERemConCoreApiButtonRelease: |
|
332 { |
|
333 // Volume Up - Released |
|
334 iVolumeRepeatTimer->Cancel(); |
|
335 break; |
|
336 } |
|
337 case ERemConCoreApiButtonClick: |
|
338 { |
|
339 // Volume Down - Clicked |
|
340 TRAP_IGNORE( iContainer->HandleCommandL( EMPXPbvCmdDecreaseVolume ) ); |
|
341 break; |
|
342 } |
|
343 } |
|
344 } |
|
345 |
|
346 // ------------------------------------------------------------------------------------------------- |
|
347 // CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent() |
|
348 // ------------------------------------------------------------------------------------------------- |
|
349 // |
|
350 EXPORT_C void |
|
351 CMPXVideoPlaybackUserInputHandler::ProcessPointerEventL( CCoeControl* aControl, |
|
352 const TPointerEvent& aPointerEvent, |
|
353 TMPXVideoControlType aMPXControl ) |
|
354 { |
|
355 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessPointerEvent()"), |
|
356 _L("iProcessingInputType = %d, aPointerEvent.iType = %d"), |
|
357 iProcessingInputType, aPointerEvent.iType ); |
|
358 |
|
359 switch ( iProcessingInputType ) |
|
360 { |
|
361 case EMpxVideoNone: |
|
362 { |
|
363 if ( aPointerEvent.iType == TPointerEvent::EButton1Down && IsUserInputAllowed() ) |
|
364 { |
|
365 iProcessingInputType = EMpxVideoTouch; |
|
366 |
|
367 // |
|
368 // Save the active controls pointer to reroute invalid pointer events |
|
369 // |
|
370 iActiveControlPtr = aControl; |
|
371 iActiveControlType = aMPXControl; |
|
372 |
|
373 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl ); |
|
374 } |
|
375 |
|
376 break; |
|
377 } |
|
378 case EMpxVideoTouch: |
|
379 { |
|
380 if ( aControl == iActiveControlPtr ) |
|
381 { |
|
382 // |
|
383 // Event is from the active control, process pointer event normally |
|
384 // |
|
385 if ( aPointerEvent.iType != TPointerEvent::EButton1Down ) |
|
386 { |
|
387 ReRoutePointerEventL( aControl, aPointerEvent, aMPXControl ); |
|
388 |
|
389 // |
|
390 // reset the value only on pointer up event - but not on drag |
|
391 // |
|
392 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
393 { |
|
394 iProcessingInputType = EMpxVideoNone; |
|
395 iActiveControlPtr = NULL; |
|
396 } |
|
397 } |
|
398 } |
|
399 else |
|
400 { |
|
401 // |
|
402 // Event is from non active control |
|
403 // This should not happen, but if event is a button up event, |
|
404 // end the current active control pointer processing |
|
405 // |
|
406 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
407 { |
|
408 // |
|
409 // Reroute button up event to active control and end current |
|
410 // control processing |
|
411 // |
|
412 ReRoutePointerEventL( iActiveControlPtr, aPointerEvent, iActiveControlType ); |
|
413 iProcessingInputType = EMpxVideoNone; |
|
414 iActiveControlPtr = NULL; |
|
415 } |
|
416 } |
|
417 |
|
418 break; |
|
419 } |
|
420 } // switch |
|
421 } |
|
422 |
|
423 // ------------------------------------------------------------------------------------------------- |
|
424 // CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL() |
|
425 // ------------------------------------------------------------------------------------------------- |
|
426 // |
|
427 void CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL( CCoeControl* aControl, |
|
428 const TPointerEvent& aPointerEvent, |
|
429 TMPXVideoControlType aMPXControl ) |
|
430 { |
|
431 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ReRoutePointerEventL()"), |
|
432 _L("aMPXControl = %d"), aMPXControl ); |
|
433 |
|
434 if ( aMPXControl == EMpxVideoPlaybackContainer ) |
|
435 { |
|
436 iContainer->DoHandlePointerEventL( aPointerEvent ); |
|
437 } |
|
438 else if ( aMPXControl == EMpxVideoPlaybackControl ) |
|
439 { |
|
440 static_cast<CMPXVideoPlaybackControl*>(aControl)->DoHandlePointerEventL( aPointerEvent ); |
|
441 } |
|
442 } |
|
443 |
|
444 // ------------------------------------------------------------------------------------------------- |
|
445 // CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent() |
|
446 // ------------------------------------------------------------------------------------------------- |
|
447 // |
|
448 void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent, |
|
449 TEventCode aType ) |
|
450 { |
|
451 MPX_ENTER_EXIT(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent()"), |
|
452 _L("iProcessingInputType = %d, aType = %d"), iProcessingInputType, aType ); |
|
453 |
|
454 switch ( iProcessingInputType ) |
|
455 { |
|
456 case EMpxVideoNone: |
|
457 { |
|
458 if ( aType == EEventKeyDown && IsUserInputAllowed() ) |
|
459 { |
|
460 iProcessingInputType = EMpxVideoKeyboard; |
|
461 iLastPressedKeyScanCode = aKeyEvent.iScanCode; |
|
462 |
|
463 iContainer->DoHandleKeyEventL( aKeyEvent, aType ); |
|
464 } |
|
465 break; |
|
466 } |
|
467 case EMpxVideoKeyboard: |
|
468 { |
|
469 MPX_DEBUG(_L("aKeyEvent.iScanCode = %d, iLastPressedKeyScanCode = %d"), |
|
470 aKeyEvent.iScanCode, iLastPressedKeyScanCode ); |
|
471 |
|
472 // |
|
473 // Only handle events for the key being handled |
|
474 // |
|
475 if ( aKeyEvent.iScanCode == iLastPressedKeyScanCode ) |
|
476 { |
|
477 iContainer->DoHandleKeyEventL( aKeyEvent, aType ); |
|
478 |
|
479 if ( aType == EEventKeyUp ) |
|
480 { |
|
481 iProcessingInputType = EMpxVideoNone; |
|
482 } |
|
483 } |
|
484 |
|
485 break; |
|
486 } |
|
487 } // switch |
|
488 } |
|
489 |
|
490 // ------------------------------------------------------------------------------------------------- |
|
491 // CMPXVideoPlaybackUserInputHandler::ProcessMediaKey() |
|
492 // ------------------------------------------------------------------------------------------------- |
|
493 // |
|
494 void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey( TRemConCoreApiOperationId aOperationId, |
|
495 TRemConCoreApiButtonAction aButtonAct ) |
|
496 { |
|
497 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()"), |
|
498 _L("iProcessingInputType = %d, aButtonAct = %d"), |
|
499 iProcessingInputType, aButtonAct ); |
|
500 |
|
501 switch ( iProcessingInputType ) |
|
502 { |
|
503 case EMpxVideoNone: |
|
504 { |
|
505 if ( IsUserInputAllowed() ) |
|
506 { |
|
507 if ( aButtonAct == ERemConCoreApiButtonPress ) |
|
508 { |
|
509 iProcessingInputType = EMpxVideoMediaKeys; |
|
510 iLastMediaKeyPressed = aOperationId; |
|
511 DoHandleMediaKey( aOperationId, aButtonAct ); |
|
512 } |
|
513 else if ( aButtonAct == ERemConCoreApiButtonClick ) |
|
514 { |
|
515 DoHandleMediaKey( aOperationId, aButtonAct ); |
|
516 // reset on click AND/OR release |
|
517 iProcessingInputType = EMpxVideoNone; |
|
518 } |
|
519 } |
|
520 break; |
|
521 } |
|
522 case EMpxVideoMediaKeys: |
|
523 { |
|
524 if ( aButtonAct == ERemConCoreApiButtonRelease ) |
|
525 { |
|
526 // |
|
527 // Handle only if this release is for media-key being currently handled |
|
528 // Ignore spurious media key presses |
|
529 // |
|
530 if ( iLastMediaKeyPressed == aOperationId ) |
|
531 { |
|
532 DoHandleMediaKey( aOperationId, aButtonAct ); |
|
533 |
|
534 iProcessingInputType = EMpxVideoNone; |
|
535 } |
|
536 } |
|
537 break; |
|
538 } |
|
539 } // switch |
|
540 } |
|
541 |
|
542 // ------------------------------------------------------------------------------------------------- |
|
543 // CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL() |
|
544 // ------------------------------------------------------------------------------------------------- |
|
545 // |
|
546 TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr ) |
|
547 { |
|
548 MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()")); |
|
549 |
|
550 static_cast<CMPXVideoPlaybackUserInputHandler*>(aPtr)->HandleVolumeRepeatL(); |
|
551 |
|
552 return KErrNone; |
|
553 } |
|
554 |
|
555 // ------------------------------------------------------------------------------------------------- |
|
556 // CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL() |
|
557 // ------------------------------------------------------------------------------------------------- |
|
558 // |
|
559 void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL() |
|
560 { |
|
561 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()")); |
|
562 |
|
563 TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume; |
|
564 |
|
565 if ( iVolumeRepeatUp ) |
|
566 { |
|
567 command = EMPXPbvCmdIncreaseVolume; |
|
568 } |
|
569 |
|
570 iContainer->HandleCommandL( command ); |
|
571 } |
|
572 |
|
573 // ------------------------------------------------------------------------------------------------- |
|
574 // CMPXVideoPlaybackUserInputHandler::SetForeground() |
|
575 // ------------------------------------------------------------------------------------------------- |
|
576 // |
|
577 void CMPXVideoPlaybackUserInputHandler::SetForeground( TBool aForeground ) |
|
578 { |
|
579 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::SetForeground()"), |
|
580 _L("aForeground = %d"), aForeground ); |
|
581 |
|
582 iForeground = aForeground; |
|
583 |
|
584 if ( ! iForeground ) |
|
585 { |
|
586 // |
|
587 // Keyboard focus has been lost |
|
588 // Reset input type and clear volume timer if necessary |
|
589 // |
|
590 iProcessingInputType = EMpxVideoNone; |
|
591 |
|
592 if ( iVolumeRepeatTimer->IsActive() ) |
|
593 { |
|
594 iVolumeRepeatTimer->Cancel(); |
|
595 } |
|
596 } |
|
597 } |
|
598 |
|
599 // ------------------------------------------------------------------------------------------------- |
|
600 // CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs() |
|
601 // ------------------------------------------------------------------------------------------------- |
|
602 // |
|
603 void CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs( TBool aBlockInputs ) |
|
604 { |
|
605 MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::BlockPdlUserInputs(%d)"), aBlockInputs); |
|
606 |
|
607 iBlockPdlInputs = aBlockInputs; |
|
608 } |
|
609 |
|
610 // ------------------------------------------------------------------------------------------------- |
|
611 // CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed() |
|
612 // ------------------------------------------------------------------------------------------------- |
|
613 // |
|
614 TBool CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed() |
|
615 { |
|
616 TBool allowInput = ( iForeground && ! iBlockPdlInputs ); |
|
617 |
|
618 MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::IsUserInputAllowed(%d)"), allowInput); |
|
619 |
|
620 return allowInput; |
|
621 } |
|
622 |
|
623 // EOF |