|
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: Button bar control |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 14 % |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <eikenv.h> |
|
24 #include <barsread.h> |
|
25 #include <AknUtils.h> |
|
26 #include <AknIconUtils.h> |
|
27 #include <StringLoader.h> |
|
28 #include <AknsDrawUtils.h> |
|
29 |
|
30 #include <mpxvideoplaybackcontrols.mbg> |
|
31 |
|
32 #include "mpxvideoplaybackbutton.h" |
|
33 #include "mpxcommonvideoplaybackview.hrh" |
|
34 #include "mpxvideoplaybackbuttonbar.h" |
|
35 #include "mpxvideoplaybackcontrolscontroller.h" |
|
36 |
|
37 #ifdef RD_TACTILE_FEEDBACK |
|
38 #include <touchfeedback.h> |
|
39 #endif //RD_TACTILE_FEEDBACK |
|
40 |
|
41 // CONSTANTS |
|
42 const TInt KMPXLongPressInterval = 800000; |
|
43 const TInt KMPXTactileInterval = 200000; |
|
44 |
|
45 // ============================ MEMBER FUNCTIONS =================================================== |
|
46 |
|
47 CMPXVideoPlaybackButtonBar::CMPXVideoPlaybackButtonBar( |
|
48 CMPXVideoPlaybackControlsController* aController ) |
|
49 : iButtons( EMPXButtonCount ) |
|
50 , iController( aController ) |
|
51 , iSeeking( EFalse ) |
|
52 , iButtonPressed( EMPXNotPressed ) |
|
53 { |
|
54 } |
|
55 |
|
56 // ------------------------------------------------------------------------------------------------- |
|
57 // CMPXVideoPlaybackButtonBar::ConstructL() |
|
58 // Symbian 2nd phase constructor can leave. |
|
59 // ------------------------------------------------------------------------------------------------- |
|
60 // |
|
61 void CMPXVideoPlaybackButtonBar::ConstructL( TRect aRect ) |
|
62 { |
|
63 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::ConstructL()")); |
|
64 |
|
65 SetRect( TRect(0, 0, aRect.Width(), aRect.Height()) ); |
|
66 |
|
67 CreateButtonsL(); |
|
68 |
|
69 iSeekingTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
70 |
|
71 #ifdef RD_TACTILE_FEEDBACK |
|
72 iFeedback = MTouchFeedback::Instance(); |
|
73 #endif //RD_TACTILE_FEEDBACK |
|
74 } |
|
75 |
|
76 // ------------------------------------------------------------------------------------------------- |
|
77 // CMPXVideoPlaybackButtonBar::NewL() |
|
78 // Two-phased constructor. |
|
79 // ------------------------------------------------------------------------------------------------- |
|
80 // |
|
81 CMPXVideoPlaybackButtonBar* CMPXVideoPlaybackButtonBar::NewL( |
|
82 CMPXVideoPlaybackControlsController* aController, TRect aRect ) |
|
83 { |
|
84 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::NewL()")); |
|
85 |
|
86 CMPXVideoPlaybackButtonBar* self = new ( ELeave ) CMPXVideoPlaybackButtonBar( aController ); |
|
87 |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL( aRect ); |
|
90 CleanupStack::Pop(); |
|
91 return self; |
|
92 } |
|
93 |
|
94 // ------------------------------------------------------------------------------------------------- |
|
95 // CMPXVideoPlaybackButtonBar::~CMPXVideoPlaybackButtonBar() |
|
96 // Destructor. |
|
97 // ------------------------------------------------------------------------------------------------- |
|
98 // |
|
99 CMPXVideoPlaybackButtonBar::~CMPXVideoPlaybackButtonBar() |
|
100 { |
|
101 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::~CMPXVideoPlaybackButtonBar()")); |
|
102 |
|
103 if ( iSeekingTimer ) |
|
104 { |
|
105 if ( iSeekingTimer->IsActive() ) |
|
106 { |
|
107 iSeekingTimer->Cancel(); |
|
108 } |
|
109 |
|
110 delete iSeekingTimer; |
|
111 iSeekingTimer = NULL; |
|
112 } |
|
113 |
|
114 iButtons.ResetAndDestroy(); |
|
115 |
|
116 #ifdef RD_TACTILE_FEEDBACK |
|
117 if ( iFeedback ) |
|
118 { |
|
119 iFeedback->RemoveFeedbackForControl(this); |
|
120 } |
|
121 #endif //RD_TACTILE_FEEDBACK |
|
122 } |
|
123 |
|
124 // ------------------------------------------------------------------------------------------------- |
|
125 // CMPXVideoPlaybackButtonBar::CreateButtonsL() |
|
126 // ------------------------------------------------------------------------------------------------- |
|
127 // |
|
128 void CMPXVideoPlaybackButtonBar::CreateButtonsL() |
|
129 { |
|
130 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::CreateButtonsL()")); |
|
131 |
|
132 TFileName iconsPath; |
|
133 iController->LocateBitmapFileL( iconsPath ); |
|
134 |
|
135 // |
|
136 // Since button bar has 3 visible buttons - divide the height of aRect by 3 |
|
137 // |
|
138 TInt iconSize = Rect().Height() / 3; |
|
139 TInt leftOffset = ( Rect().Width() - iconSize ) / 2 ; |
|
140 |
|
141 // |
|
142 // Create 3 buttons |
|
143 // |
|
144 for ( TInt i = 0 ; i < EMPXButtonCount -1 ; i++ ) |
|
145 { |
|
146 CMPXVideoPlaybackButton* button = |
|
147 CMPXVideoPlaybackButton::NewL( |
|
148 TRect( leftOffset, iconSize * i, leftOffset + iconSize, iconSize * ( i + 1 ) ), |
|
149 iconsPath ); |
|
150 |
|
151 CleanupStack::PushL( button ); |
|
152 iButtons.AppendL( button ); |
|
153 CleanupStack::Pop( button ); |
|
154 } |
|
155 |
|
156 // |
|
157 // create pause button in same rect as paly button's |
|
158 // |
|
159 CMPXVideoPlaybackButton* button = |
|
160 CMPXVideoPlaybackButton::NewL( iButtons[EMPXButtonPlay]->Rect(), iconsPath ); |
|
161 |
|
162 CleanupStack::PushL( button ); |
|
163 iButtons.AppendL( button ); |
|
164 CleanupStack::Pop( button ); |
|
165 |
|
166 // |
|
167 // Set touchable rect for top, middle, bottom button |
|
168 // |
|
169 iTopButtonRect = iButtons[EMPXButtonFastForward]->Rect(); |
|
170 iMiddleButtonRect = iButtons[EMPXButtonPlay]->Rect(); |
|
171 iBottomButtonRect = iButtons[EMPXButtonRewind]->Rect(); |
|
172 |
|
173 SkinChangeL(); |
|
174 |
|
175 UpdateStateOnButtonBar( iController->State() ); |
|
176 } |
|
177 |
|
178 // ------------------------------------------------------------------------------------------------- |
|
179 // CMPXVideoPlaybackButtonBar::SkinChangeL() |
|
180 // ------------------------------------------------------------------------------------------------- |
|
181 // |
|
182 void CMPXVideoPlaybackButtonBar::SkinChangeL() |
|
183 { |
|
184 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::SkinChangeL()")); |
|
185 |
|
186 // |
|
187 // FF button |
|
188 // |
|
189 iButtons[EMPXButtonFastForward]->CreateDefaultButtonL( |
|
190 KAknsIIDQgnPropImageTbNext, |
|
191 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next, |
|
192 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next_mask ); |
|
193 |
|
194 iButtons[EMPXButtonFastForward]->CreateDimmedButtonL( |
|
195 KAknsIIDQgnPropImageTbNextDimmed, |
|
196 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next_dimmed, |
|
197 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next_dimmed_mask ); |
|
198 |
|
199 iButtons[EMPXButtonFastForward]->CreatePressedButtonL( |
|
200 KAknsIIDQgnPropImageTbNextFocused, |
|
201 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next_focused, |
|
202 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_next_focused_mask ); |
|
203 |
|
204 // |
|
205 // Play button |
|
206 // |
|
207 iButtons[EMPXButtonPlay]->CreateDefaultButtonL( |
|
208 KAknsIIDQgnPropImageTbPlay2, |
|
209 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_play2, |
|
210 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_play2_mask ); |
|
211 |
|
212 // |
|
213 // Pause button |
|
214 // |
|
215 iButtons[EMPXButtonPause]->CreateDefaultButtonL( |
|
216 KAknsIIDQgnPropImageTbPause, |
|
217 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause, |
|
218 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause_mask ); |
|
219 |
|
220 iButtons[EMPXButtonPause]->CreateDimmedButtonL( |
|
221 KAknsIIDQgnPropImageTbPauseDimmed, |
|
222 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause_dimmed, |
|
223 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause_dimmed_mask ); |
|
224 |
|
225 // |
|
226 // RW button |
|
227 // |
|
228 iButtons[EMPXButtonRewind]->CreateDefaultButtonL( |
|
229 KAknsIIDQgnPropImageTbPrev, |
|
230 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev, |
|
231 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev_mask ); |
|
232 |
|
233 iButtons[EMPXButtonRewind]->CreateDimmedButtonL( |
|
234 KAknsIIDQgnPropImageTbPrevDimmed, |
|
235 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev_dimmed, |
|
236 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev_dimmed_mask ); |
|
237 |
|
238 iButtons[EMPXButtonRewind]->CreatePressedButtonL( |
|
239 KAknsIIDQgnPropImageTbPrevFocused, |
|
240 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev_focused, |
|
241 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_prev_focused_mask ); |
|
242 } |
|
243 |
|
244 // ------------------------------------------------------------------------------------------------- |
|
245 // CMPXVideoPlaybackButtonBar::HandleResourceChange() |
|
246 // ------------------------------------------------------------------------------------------------- |
|
247 // |
|
248 void CMPXVideoPlaybackButtonBar::HandleResourceChange( TInt aType ) |
|
249 { |
|
250 MPX_DEBUG(_L("CMPXVideoPlaybackProgressBar::HandleResourceChange(0x%X)"), aType); |
|
251 |
|
252 if ( aType == KAknsMessageSkinChange ) |
|
253 { |
|
254 TRAP_IGNORE( SkinChangeL() ); |
|
255 } |
|
256 |
|
257 CCoeControl::HandleResourceChange( aType ); |
|
258 } |
|
259 |
|
260 // ------------------------------------------------------------------------------------------------- |
|
261 // CMPXVideoPlaybackButtonBar::SetContainerWindowL() |
|
262 // ------------------------------------------------------------------------------------------------- |
|
263 // |
|
264 void CMPXVideoPlaybackButtonBar::SetContainerWindowL( const CCoeControl& aContainer ) |
|
265 { |
|
266 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::SetContainerWindowL()")); |
|
267 |
|
268 for ( TInt i = 0 ; i < EMPXButtonCount ; i++ ) |
|
269 { |
|
270 iButtons[i]->SetContainerWindowL( aContainer ); |
|
271 } |
|
272 |
|
273 CCoeControl::SetContainerWindowL( aContainer ); |
|
274 } |
|
275 |
|
276 // ------------------------------------------------------------------------------------------------- |
|
277 // CMPXVideoPlaybackButtonBar::HandlePointerEventL() |
|
278 // ------------------------------------------------------------------------------------------------- |
|
279 // |
|
280 void CMPXVideoPlaybackButtonBar::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
281 { |
|
282 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::HandlePointerEventL()")); |
|
283 |
|
284 switch ( aPointerEvent.iType ) |
|
285 { |
|
286 case TPointerEvent::EButton1Down: |
|
287 { |
|
288 HandleButtonDownEventL( aPointerEvent ); |
|
289 |
|
290 break; |
|
291 } |
|
292 case TPointerEvent::EButton1Up: |
|
293 { |
|
294 if ( iButtonPressed == EMPXTopButtonPressed || |
|
295 ( iTopButtonRect.Contains( aPointerEvent.iPosition ) && |
|
296 iButtonPressed == EMPXNotPressed ) ) |
|
297 { |
|
298 HandleTopButtonUpEventL( aPointerEvent ); |
|
299 } |
|
300 else if ( iButtonPressed == EMPXBottomButtonPressed || |
|
301 ( iBottomButtonRect.Contains( aPointerEvent.iPosition ) && |
|
302 iButtonPressed == EMPXNotPressed ) ) |
|
303 { |
|
304 HandleBottomButtonUpEventL( aPointerEvent ); |
|
305 } |
|
306 else if ( iButtonPressed == EMPXMiddleButtonPressed || |
|
307 ( iMiddleButtonRect.Contains( aPointerEvent.iPosition ) && |
|
308 iButtonPressed == EMPXNotPressed ) ) |
|
309 { |
|
310 HandleMiddleButtonUpEventL(); |
|
311 } |
|
312 else |
|
313 { |
|
314 //Pass an event to controller to call toggle visibility |
|
315 } |
|
316 |
|
317 iButtonPressed = EMPXNotPressed; |
|
318 break; |
|
319 } |
|
320 } |
|
321 } |
|
322 |
|
323 // ------------------------------------------------------------------------------------------------- |
|
324 // CMPXVideoPlaybackButtonBar::HandleButtonDownEventL() |
|
325 // ------------------------------------------------------------------------------------------------- |
|
326 // |
|
327 void CMPXVideoPlaybackButtonBar::HandleButtonDownEventL( const TPointerEvent& aPointerEvent ) |
|
328 { |
|
329 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::HandleButtonDownEventL()")); |
|
330 |
|
331 if ( iController->IsTvOutPlaybackAllowed() ) |
|
332 { |
|
333 if ( iSeekingTimer->IsActive() ) |
|
334 { |
|
335 iSeekingTimer->Cancel(); |
|
336 } |
|
337 |
|
338 if ( iMiddleButtonRect.Contains( aPointerEvent.iPosition ) ) |
|
339 { |
|
340 iButtonPressed = EMPXMiddleButtonPressed; |
|
341 } |
|
342 else if ( iTopButtonRect.Contains( aPointerEvent.iPosition ) && |
|
343 iButtons[EMPXButtonFastForward]->IsVisible() && |
|
344 ! iButtons[EMPXButtonFastForward]->IsDimmed() ) |
|
345 { |
|
346 iButtons[EMPXButtonFastForward]->SetPressed( ETrue ); |
|
347 |
|
348 iSeekingTimer->Start( |
|
349 KMPXLongPressInterval, |
|
350 KMPXTactileInterval, |
|
351 TCallBack( CMPXVideoPlaybackButtonBar::StartSeekingL, this ) ); |
|
352 |
|
353 iButtonPressed = EMPXTopButtonPressed; |
|
354 } |
|
355 else if( iBottomButtonRect.Contains( aPointerEvent.iPosition ) && |
|
356 iButtons[EMPXButtonRewind]->IsVisible() && |
|
357 ! iButtons[EMPXButtonRewind]->IsDimmed() ) |
|
358 { |
|
359 iButtons[EMPXButtonRewind]->SetPressed( ETrue ); |
|
360 |
|
361 iSeekingTimer->Start( |
|
362 KMPXLongPressInterval, |
|
363 KMPXTactileInterval, |
|
364 TCallBack( CMPXVideoPlaybackButtonBar::StartSeekingL, this ) ); |
|
365 |
|
366 iButtonPressed = EMPXBottomButtonPressed; |
|
367 } |
|
368 } |
|
369 } |
|
370 |
|
371 // ------------------------------------------------------------------------------------------------- |
|
372 // CMPXVideoPlaybackButtonBar::HandleTopButtonUpEventL() |
|
373 // ------------------------------------------------------------------------------------------------- |
|
374 // |
|
375 void CMPXVideoPlaybackButtonBar::HandleTopButtonUpEventL( const TPointerEvent& aPointerEvent ) |
|
376 { |
|
377 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::HandleTopButtonUpEventL()")); |
|
378 |
|
379 if ( iSeekingTimer->IsActive() ) |
|
380 { |
|
381 iSeekingTimer->Cancel(); |
|
382 } |
|
383 |
|
384 if ( iButtons[EMPXButtonFastForward]->IsVisible() && |
|
385 ! iButtons[EMPXButtonFastForward]->IsDimmed() ) |
|
386 { |
|
387 iButtons[EMPXButtonFastForward]->SetPressed( EFalse ); |
|
388 |
|
389 if ( iSeeking ) |
|
390 { |
|
391 #ifdef RD_TACTILE_FEEDBACK |
|
392 if ( iFeedback ) |
|
393 { |
|
394 #ifdef SYMBIAN_BUILD_GCE |
|
395 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
396 #else |
|
397 iFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
398 #endif //SYMBIAN_BUILD_GCE |
|
399 } |
|
400 #endif //RD_TACTILE_FEEDBACK |
|
401 |
|
402 iController->HandleCommandL( EMPXPbvCmdEndSeek ); |
|
403 iSeeking = EFalse; |
|
404 } |
|
405 // short press |
|
406 else |
|
407 { |
|
408 iController->HandleCommandL( EMPXPbvCmdShortPressForward ); |
|
409 } |
|
410 |
|
411 } |
|
412 |
|
413 iButtons[EMPXButtonFastForward]->HandlePointerEventL( aPointerEvent ); |
|
414 } |
|
415 |
|
416 // ------------------------------------------------------------------------------------------------- |
|
417 // CMPXVideoPlaybackButtonBar::HandleMiddleButtonUpEventL() |
|
418 // ------------------------------------------------------------------------------------------------- |
|
419 // |
|
420 void CMPXVideoPlaybackButtonBar::HandleMiddleButtonUpEventL() |
|
421 { |
|
422 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::HandleMiddleButtonUpEventL()")); |
|
423 |
|
424 switch ( iController->State() ) |
|
425 { |
|
426 case EPbStatePlaying: |
|
427 { |
|
428 if ( iButtons[EMPXButtonPause]->IsVisible() && ! iButtons[EMPXButtonPause]->IsDimmed() ) |
|
429 { |
|
430 #ifdef RD_TACTILE_FEEDBACK |
|
431 if (iFeedback) |
|
432 { |
|
433 #ifdef SYMBIAN_BUILD_GCE |
|
434 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
435 #else |
|
436 iFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
437 #endif //SYMBIAN_BUILD_GCE |
|
438 } |
|
439 #endif //RD_TACTILE_FEEDBACK |
|
440 iController->HandleCommandL( EMPXPbvCmdPause ); |
|
441 } |
|
442 break; |
|
443 } |
|
444 case EPbStatePaused: |
|
445 case EPbStateStopped: |
|
446 { |
|
447 if ( iButtons[EMPXButtonPlay]->IsVisible() && ! iButtons[EMPXButtonPlay]->IsDimmed() ) |
|
448 { |
|
449 #ifdef RD_TACTILE_FEEDBACK |
|
450 if (iFeedback) |
|
451 { |
|
452 #ifdef SYMBIAN_BUILD_GCE |
|
453 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
454 #else |
|
455 iFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
456 #endif //SYMBIAN_BUILD_GCE |
|
457 } |
|
458 #endif //RD_TACTILE_FEEDBACK |
|
459 iController->HandleCommandL( EMPXPbvCmdPlay ); |
|
460 } |
|
461 break; |
|
462 } |
|
463 } |
|
464 } |
|
465 |
|
466 // ------------------------------------------------------------------------------------------------- |
|
467 // CMPXVideoPlaybackButtonBar::HandleBottomButtonUpEventL() |
|
468 // ------------------------------------------------------------------------------------------------- |
|
469 // |
|
470 void CMPXVideoPlaybackButtonBar::HandleBottomButtonUpEventL( const TPointerEvent& aPointerEvent ) |
|
471 { |
|
472 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::HandleBottomButtonUpEventL()")); |
|
473 |
|
474 if ( iSeekingTimer->IsActive() ) |
|
475 { |
|
476 iSeekingTimer->Cancel(); |
|
477 } |
|
478 |
|
479 if ( iButtons[EMPXButtonRewind]->IsVisible() && ! iButtons[EMPXButtonRewind]->IsDimmed() ) |
|
480 { |
|
481 #ifdef RD_TACTILE_FEEDBACK |
|
482 if ( iFeedback ) |
|
483 { |
|
484 #ifdef SYMBIAN_BUILD_GCE |
|
485 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
486 #else |
|
487 iFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
488 #endif //SYMBIAN_BUILD_GCE |
|
489 } |
|
490 #endif //RD_TACTILE_FEEDBACK |
|
491 |
|
492 iButtons[EMPXButtonRewind]->SetPressed( EFalse ); |
|
493 |
|
494 if ( iSeeking ) |
|
495 { |
|
496 iController->HandleCommandL( EMPXPbvCmdEndSeek ); |
|
497 iSeeking = EFalse; |
|
498 } |
|
499 else |
|
500 { |
|
501 // Short press backward: |
|
502 iController->HandleCommandL( EMPXPbvCmdShortPressBackward ); |
|
503 } |
|
504 } |
|
505 |
|
506 iButtons[EMPXButtonRewind]->HandlePointerEventL( aPointerEvent ); |
|
507 } |
|
508 |
|
509 // ------------------------------------------------------------------------------------------------- |
|
510 // CMPXVideoPlaybackButtonBar::StartSeekingL() |
|
511 // ------------------------------------------------------------------------------------------------- |
|
512 // |
|
513 TInt CMPXVideoPlaybackButtonBar::StartSeekingL( TAny* aPtr ) |
|
514 { |
|
515 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::StartSeekingL()")); |
|
516 |
|
517 static_cast<CMPXVideoPlaybackButtonBar*>(aPtr)->DoStartSeekingL(); |
|
518 |
|
519 return KErrNone; |
|
520 } |
|
521 |
|
522 // ------------------------------------------------------------------------------------------------- |
|
523 // CMPXVideoPlaybackButtonBar::DoStartSeekingL() |
|
524 // ------------------------------------------------------------------------------------------------- |
|
525 // |
|
526 void CMPXVideoPlaybackButtonBar::DoStartSeekingL() |
|
527 { |
|
528 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::DoStartSeekingL()")); |
|
529 |
|
530 #ifdef RD_TACTILE_FEEDBACK |
|
531 if (iFeedback) |
|
532 { |
|
533 #ifdef SYMBIAN_BUILD_GCE |
|
534 iFeedback->InstantFeedback( ETouchFeedbackBasicButton ); |
|
535 #else |
|
536 iFeedback->InstantFeedback( ETouchFeedbackSensitive ); |
|
537 #endif //SYMBIAN_BUILD_GCE |
|
538 } |
|
539 #endif //RD_TACTILE_FEEDBACK |
|
540 |
|
541 if ( ! iSeeking ) |
|
542 { |
|
543 if ( iButtonPressed == EMPXTopButtonPressed ) |
|
544 { |
|
545 iController->HandleCommandL( EMPXPbvCmdSeekForward ); |
|
546 } |
|
547 else if ( iButtonPressed == EMPXBottomButtonPressed ) |
|
548 { |
|
549 iController->HandleCommandL( EMPXPbvCmdSeekBackward ); |
|
550 } |
|
551 iSeeking = ETrue; |
|
552 } |
|
553 } |
|
554 |
|
555 // ------------------------------------------------------------------------------------------------- |
|
556 // CMPXVideoPlaybackButtonBar::Draw() |
|
557 // ------------------------------------------------------------------------------------------------- |
|
558 // |
|
559 void CMPXVideoPlaybackButtonBar::Draw( const TRect& aRect ) const |
|
560 { |
|
561 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::Draw()")); |
|
562 |
|
563 CWindowGc& gc = SystemGc(); |
|
564 gc.SetClippingRect( aRect ); |
|
565 |
|
566 if ( Window().DisplayMode() == EColor16MAP ) |
|
567 { |
|
568 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
569 gc.SetBrushColor( TRgb::Color16MAP( 255 ) ); |
|
570 gc.Clear( aRect ); |
|
571 } |
|
572 else if ( Window().DisplayMode() == EColor16MA ) |
|
573 { |
|
574 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
575 gc.SetBrushColor( TRgb::Color16MA( 0 ) ); |
|
576 gc.Clear( aRect ); |
|
577 } |
|
578 else |
|
579 { |
|
580 // draw a solid background so that the entire progress |
|
581 // bar is shown not just the area representing the |
|
582 // portion that has been played. |
|
583 gc.SetBrushColor( KRgbBlack ); |
|
584 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
585 gc.DrawRect( aRect ); |
|
586 gc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
587 } |
|
588 } |
|
589 |
|
590 // ------------------------------------------------------------------------------------------------- |
|
591 // CMPXVideoPlaybackButtonBar::CountComponentControls() |
|
592 // ------------------------------------------------------------------------------------------------- |
|
593 // |
|
594 TInt CMPXVideoPlaybackButtonBar::CountComponentControls() const |
|
595 { |
|
596 return EMPXButtonCount; |
|
597 } |
|
598 |
|
599 // ------------------------------------------------------------------------------------------------- |
|
600 // CMPXVideoPlaybackButtonBar::ComponentControl |
|
601 // ------------------------------------------------------------------------------------------------- |
|
602 // |
|
603 CCoeControl* CMPXVideoPlaybackButtonBar::ComponentControl(TInt aIndex) const |
|
604 { |
|
605 CCoeControl* control = NULL; |
|
606 |
|
607 control = iButtons[ aIndex ]; |
|
608 |
|
609 return control; |
|
610 } |
|
611 |
|
612 // ------------------------------------------------------------------------------------------------- |
|
613 // CMPXVideoPlaybackButtonBar::StateChanged() |
|
614 // ------------------------------------------------------------------------------------------------- |
|
615 // |
|
616 void CMPXVideoPlaybackButtonBar::UpdateStateOnButtonBar( TMPXPlaybackState aState ) |
|
617 { |
|
618 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::StateChanged(%d)"), aState); |
|
619 |
|
620 switch ( aState ) |
|
621 { |
|
622 case EPbStatePlaying: |
|
623 { |
|
624 iButtons[EMPXButtonPlay]->MakeVisible( EFalse ); |
|
625 iButtons[EMPXButtonPause]->MakeVisible( ETrue ); |
|
626 |
|
627 break; |
|
628 } |
|
629 case EPbStatePaused: |
|
630 { |
|
631 iButtons[EMPXButtonPause]->MakeVisible( EFalse ); |
|
632 iButtons[EMPXButtonPlay]->MakeVisible( ETrue ); |
|
633 |
|
634 break; |
|
635 } |
|
636 case EPbStateNotInitialised: |
|
637 case EPbStateInitialising: |
|
638 { |
|
639 iButtons[EMPXButtonFastForward]->MakeVisible( ETrue ); |
|
640 iButtons[EMPXButtonFastForward]->SetDimmed( ETrue ); |
|
641 |
|
642 iButtons[EMPXButtonRewind]->MakeVisible( ETrue ); |
|
643 iButtons[EMPXButtonRewind]->SetDimmed( ETrue ); |
|
644 |
|
645 iButtons[EMPXButtonPause]->MakeVisible( EFalse ); |
|
646 iButtons[EMPXButtonPlay]->MakeVisible( ETrue ); |
|
647 |
|
648 break; |
|
649 } |
|
650 case EPbStateStopped: |
|
651 { |
|
652 iButtons[EMPXButtonRewind]->SetDimmed( ETrue ); |
|
653 iButtons[EMPXButtonFastForward]->SetDimmed( ETrue ); |
|
654 break; |
|
655 } |
|
656 } |
|
657 } |
|
658 |
|
659 |
|
660 // ------------------------------------------------------------------------------------------------- |
|
661 // CMPXVideoPlaybackButtonBar::UpdateButtonBarState |
|
662 // ------------------------------------------------------------------------------------------------- |
|
663 // |
|
664 void CMPXVideoPlaybackButtonBar::UpdateButtonBarState( CMPXVideoPlaybackViewFileDetails* aDetails ) |
|
665 { |
|
666 MPX_DEBUG(_L("CMPXVideoPlaybackButtonBar::UpdateButtonBarState")); |
|
667 |
|
668 if ( aDetails->iSeekable ) |
|
669 { |
|
670 iButtons[EMPXButtonRewind]->SetDimmed( EFalse ); |
|
671 iButtons[EMPXButtonFastForward]->SetDimmed( EFalse ); |
|
672 } |
|
673 |
|
674 if ( !aDetails->iPausableStream ) |
|
675 { |
|
676 iButtons[EMPXButtonPause]->SetDimmed( ETrue ); |
|
677 } |
|
678 } |
|
679 |
|
680 // ------------------------------------------------------------------------------------------------- |
|
681 // CMPXVideoPlaybackButtonBar::Reset |
|
682 // ------------------------------------------------------------------------------------------------- |
|
683 // |
|
684 void CMPXVideoPlaybackButtonBar::Reset() |
|
685 { |
|
686 if ( iSeeking ) |
|
687 { |
|
688 // Abandon the ongoing seek operation |
|
689 TPointerEvent event; |
|
690 event.iType = TPointerEvent::EButton1Up; |
|
691 HandlePointerEventL(event); |
|
692 } |
|
693 } |
|
694 |
|
695 |
|
696 // End of File |