|
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 MPXVideoPlaybackControlsController |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Version : %version: 45 % |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include <fbs.h> |
|
24 #include <coecntrl.h> |
|
25 #include <gulicon.h> |
|
26 #include <bautils.h> |
|
27 #include <eiklabel.h> |
|
28 #include <eikimage.h> |
|
29 #include <AknUtils.h> |
|
30 #include <barsread.h> |
|
31 #include <AknIconUtils.h> |
|
32 #include <StringLoader.h> |
|
33 #include <AknsDrawUtils.h> |
|
34 #include <AknsSkinInstance.h> |
|
35 #include <AknBitmapAnimation.h> |
|
36 #include <AknsBasicBackgroundControlContext.h> |
|
37 #include <f32file.h> |
|
38 |
|
39 #include <aknlayoutscalable_apps.cdl.h> |
|
40 #include <data_caging_path_literals.hrh> |
|
41 |
|
42 #include <mpxvideoplaybackcontrols.rsg> |
|
43 #include <mpxvideoplaybackcontrols.mbg> |
|
44 |
|
45 #include <avkondomainpskeys.h> |
|
46 |
|
47 #ifdef RD_TACTILE_FEEDBACK |
|
48 #include <touchfeedback.h> |
|
49 #endif //RD_TACTILE_FEEDBACK |
|
50 |
|
51 #include "mpxvideoplaybackcontrol.h" |
|
52 #include "mpxvideoplaybackcontrolpdl.h" |
|
53 #include "mpxvideoplaybackbuttonbar.h" |
|
54 #include "mpxvideoplaybackvolumebar.h" |
|
55 #include "mpxvideoplaybackprogressbar.h" |
|
56 #include "mpxvideoplaybackcontainer.h" |
|
57 #include "mpxvideoplaybackcontrolpolicy.h" |
|
58 #include "mpxvideoplaybackviewfiledetails.h" |
|
59 #include "mpxvideoplaybackcontrolscontroller.h" |
|
60 #include "mpxvideoplaybackcontrolconfiguration.h" |
|
61 #include "mpxvideoplaybackaspectratioicon.h" |
|
62 #include "mpxvideoplaybackbrandinganimation.h" |
|
63 #include "mpxvideoplaybackmediadetailsviewer.h" |
|
64 #include "mpxcommonvideoplaybackview.hrh" |
|
65 |
|
66 using namespace AknLayoutScalable_Apps; |
|
67 using namespace AknLayoutScalable_Avkon; |
|
68 |
|
69 const TInt KMPXControlsTimeOut = 4000000; |
|
70 |
|
71 const TInt KMP4LayoutSet = 6; |
|
72 |
|
73 // ================= MEMBER FUNCTIONS ============================================================== |
|
74 |
|
75 // ------------------------------------------------------------------------------------------------- |
|
76 // CMPXVideoPlaybackControlsController::CMPXVideoPlaybackControlsController |
|
77 // C++ default constructor can NOT contain any code, that might leave. |
|
78 // ------------------------------------------------------------------------------------------------- |
|
79 // |
|
80 CMPXVideoPlaybackControlsController::CMPXVideoPlaybackControlsController( |
|
81 CMPXVideoPlaybackContainer* aContainer, TRect aRect ) |
|
82 : iControls( EMPXControlsCount ), |
|
83 iRect( aRect ), |
|
84 iContainer( aContainer ) |
|
85 { |
|
86 } |
|
87 |
|
88 // ------------------------------------------------------------------------------------------------- |
|
89 // CMPXVideoPlaybackControlsController::ConstructL() |
|
90 // Symbian 2nd phase constructor can leave. |
|
91 // ------------------------------------------------------------------------------------------------- |
|
92 // |
|
93 void CMPXVideoPlaybackControlsController::ConstructL( CMPXVideoPlaybackViewFileDetails* aDetails ) |
|
94 { |
|
95 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::ConstructL()")); |
|
96 |
|
97 User::LeaveIfError( iFs.Connect() ); |
|
98 |
|
99 _LIT( KMPXVideoPlaybackRscPath, "mpxvideoplaybackcontrols.rsc" ); |
|
100 |
|
101 TParse parse; |
|
102 parse.Set( KMPXVideoPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
103 TFileName resourceFile = parse.FullName(); |
|
104 |
|
105 // |
|
106 // Find the resource file. It must be on the same drive as the DLL is installed |
|
107 // |
|
108 User::LeaveIfError( AddDllPath( resourceFile ) ); |
|
109 |
|
110 BaflUtils::NearestLanguageFile( iFs, resourceFile ); |
|
111 |
|
112 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
113 |
|
114 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::ConstructL() rsc file %S"), &resourceFile); |
|
115 |
|
116 iVideoResourceOffset = coeEnv->AddResourceFileL( resourceFile ); |
|
117 |
|
118 iFileDetails = aDetails; |
|
119 iTvOutConnected = iFileDetails->iTvOutConnected; |
|
120 |
|
121 iRNFormat = IsRealFormatL( iFileDetails->iClipName->Des() ); |
|
122 |
|
123 if ( IsRealOneBitmapVisible() ) |
|
124 { |
|
125 iShowControls = EFalse; |
|
126 } |
|
127 else |
|
128 { |
|
129 iShowControls = ETrue; |
|
130 } |
|
131 |
|
132 iControlsPolicy = CMPXVideoPlaybackControlPolicy::NewL(); |
|
133 iControlsConfig = CMPXVideoPlaybackControlConfiguration::NewL( this ); |
|
134 |
|
135 iControlsTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
136 |
|
137 CreateControlsL(); |
|
138 |
|
139 #ifdef RD_TACTILE_FEEDBACK |
|
140 iFeedback = MTouchFeedback::Instance(); |
|
141 #endif //RD_TACTILE_FEEDBACK |
|
142 } |
|
143 |
|
144 // ------------------------------------------------------------------------------------------------- |
|
145 // CMPXVideoPlaybackControlsController::NewL() |
|
146 // Two-phased constructor. |
|
147 // ------------------------------------------------------------------------------------------------- |
|
148 // |
|
149 EXPORT_C CMPXVideoPlaybackControlsController* CMPXVideoPlaybackControlsController::NewL( |
|
150 CMPXVideoPlaybackContainer* aContainer, |
|
151 TRect aRect, |
|
152 CMPXVideoPlaybackViewFileDetails* aDetails ) |
|
153 { |
|
154 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::NewL()")); |
|
155 |
|
156 CMPXVideoPlaybackControlsController* self = |
|
157 new (ELeave) CMPXVideoPlaybackControlsController( aContainer, aRect ); |
|
158 |
|
159 CleanupStack::PushL(self); |
|
160 self->ConstructL( aDetails ); |
|
161 CleanupStack::Pop(); |
|
162 |
|
163 return self; |
|
164 } |
|
165 |
|
166 // ------------------------------------------------------------------------------------------------- |
|
167 // CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController |
|
168 // Destructor. |
|
169 // ------------------------------------------------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController() |
|
172 { |
|
173 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::~CMPXVideoPlaybackControlsController")); |
|
174 |
|
175 iFs.Close(); |
|
176 |
|
177 #ifdef RD_TACTILE_FEEDBACK |
|
178 if ( iFeedback ) |
|
179 { |
|
180 iFeedback->RemoveFeedbackForControl( iContainer ); |
|
181 } |
|
182 #endif //RD_TACTILE_FEEDBACK |
|
183 |
|
184 if ( iControlsPolicy ) |
|
185 { |
|
186 delete iControlsPolicy; |
|
187 iControlsPolicy = NULL; |
|
188 } |
|
189 |
|
190 if ( iControlsConfig ) |
|
191 { |
|
192 delete iControlsConfig; |
|
193 iControlsConfig = NULL; |
|
194 } |
|
195 |
|
196 if ( iControlsTimer ) |
|
197 { |
|
198 iControlsTimer->Cancel(); |
|
199 delete iControlsTimer; |
|
200 iControlsTimer = NULL; |
|
201 } |
|
202 |
|
203 iControls.ResetAndDestroy(); |
|
204 |
|
205 if ( iRealOneBitmap ) |
|
206 { |
|
207 SetRealOneBitmapVisibility( EFalse ); |
|
208 delete iRealOneBitmap; |
|
209 iRealOneBitmap = NULL ; |
|
210 } |
|
211 |
|
212 if ( iVideoResourceOffset ) |
|
213 { |
|
214 (CCoeEnv::Static())->DeleteResourceFile( iVideoResourceOffset ); |
|
215 } |
|
216 |
|
217 if ( iMediaDetailsViewerControl ) |
|
218 { |
|
219 delete iMediaDetailsViewerControl; |
|
220 iMediaDetailsViewerControl = NULL; |
|
221 } |
|
222 } |
|
223 |
|
224 // ------------------------------------------------------------------------------------------------- |
|
225 // CMPXVideoPlaybackControlsController::AddFileDetailsL() |
|
226 // ------------------------------------------------------------------------------------------------- |
|
227 // |
|
228 EXPORT_C void CMPXVideoPlaybackControlsController::AddFileDetailsL( |
|
229 CMPXVideoPlaybackViewFileDetails* aDetails ) |
|
230 { |
|
231 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::AddFileDetailsL()")); |
|
232 |
|
233 iFileDetails = aDetails; |
|
234 |
|
235 iControlsConfig->UpdateControlsWithFileDetailsL(); |
|
236 |
|
237 ControlsListUpdatedL(); |
|
238 |
|
239 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
240 { |
|
241 iControls[i]->UpdateControlsWithFileDetailsL( iFileDetails ); |
|
242 } |
|
243 } |
|
244 |
|
245 // ------------------------------------------------------------------------------------------------- |
|
246 // CMPXVideoPlaybackControlsController::HandleEventL |
|
247 // ------------------------------------------------------------------------------------------------- |
|
248 // |
|
249 EXPORT_C void CMPXVideoPlaybackControlsController::HandleEventL( |
|
250 TMPXVideoPlaybackControlCommandIds aEvent, TInt aValue ) |
|
251 { |
|
252 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::HandleEventL(%d)"), aEvent); |
|
253 |
|
254 switch ( aEvent ) |
|
255 { |
|
256 case EMPXControlCmdSetPosition: |
|
257 { |
|
258 MPX_DEBUG(_L(" [EMPXControlCmdSetPosition [%d]]"), aValue ); |
|
259 |
|
260 PositionChangedL( (TReal)aValue / (TReal)KPbMilliMultiplier); |
|
261 break; |
|
262 } |
|
263 case EMPXControlCmdSetDuration: |
|
264 { |
|
265 MPX_DEBUG(_L(" [EMPXControlCmdSetDuration [%d]]"), aValue ); |
|
266 |
|
267 DurationChangedL( (TReal)aValue / (TReal)KPbMilliMultiplier ); |
|
268 break; |
|
269 } |
|
270 case EMPXControlCmdStateChanged: |
|
271 { |
|
272 MPX_DEBUG(_L(" [EMPXControlCmdStateChanged]")); |
|
273 |
|
274 HandleStateChange( (TMPXPlaybackState)aValue ); |
|
275 break; |
|
276 } |
|
277 case EMPXControlCmdToggleVisibility: |
|
278 { |
|
279 MPX_DEBUG(_L(" [EMPXControlCmdToggleVisibility]")); |
|
280 |
|
281 ToggleVisibility(); |
|
282 break; |
|
283 } |
|
284 case EMPXControlCmdSetVolume: |
|
285 { |
|
286 MPX_DEBUG(_L(" [EMPXControlCmdSetVolume [%d]]"), aValue ); |
|
287 VolumeChanged( aValue ); |
|
288 break; |
|
289 } |
|
290 case EMPXControlCmdSetAspectRatio: |
|
291 { |
|
292 MPX_DEBUG(_L(" [EMPXControlCmdSetAspectRatio %d]"), aValue); |
|
293 AspectRatioChanged( aValue ); |
|
294 break; |
|
295 } |
|
296 case EMPXControlCmdSetDownloadSize: |
|
297 { |
|
298 MPX_DEBUG(_L(" [EMPXControlCmdSetDownloadSize [%d]]"), aValue ); |
|
299 SetDownloadSize( aValue ); |
|
300 break; |
|
301 } |
|
302 case EMPXControlCmdDownloadUpdated: |
|
303 { |
|
304 MPX_DEBUG(_L(" [EMPXControlCmdDownloadUpdated [%d]]"), aValue ); |
|
305 UpdateDownloadPosition( aValue ); |
|
306 break; |
|
307 } |
|
308 case EMPXControlCmdDownloadComplete: |
|
309 { |
|
310 MPX_DEBUG(_L(" [EMPXControlCmdDownloadComplete [%d]]"), aValue); |
|
311 UpdateDownloadPosition( aValue ); |
|
312 break; |
|
313 } |
|
314 case EMPXControlCmdSetDownloadPaused: |
|
315 case EMPXControlCmdClearDownloadPaused: |
|
316 { |
|
317 iControlsConfig->UpdateControlListL( aEvent ); |
|
318 ControlsListUpdatedL(); |
|
319 break; |
|
320 } |
|
321 case EMPXControlCmdTvOutConnected: |
|
322 { |
|
323 iTvOutConnected = ETrue; |
|
324 |
|
325 // |
|
326 // Do not show the aspect ratio icon when TV Out is connected |
|
327 // |
|
328 HandleTvOutEventL( ETrue, aEvent, EFalse ); |
|
329 break; |
|
330 } |
|
331 case EMPXControlCmdTvOutDisconnected: |
|
332 { |
|
333 iTvOutConnected = EFalse; |
|
334 |
|
335 // |
|
336 // Pass in the show aspect ratio flag from the event |
|
337 // |
|
338 HandleTvOutEventL( EFalse, aEvent, aValue ); |
|
339 break; |
|
340 } |
|
341 case EMPXControlCmdHandleBackgroundEvent: |
|
342 { |
|
343 MPX_DEBUG(_L(" [EMPXControlCmdHandleBackgroundEvent]")); |
|
344 |
|
345 TBool keylock( EFalse ); |
|
346 RProperty::Get( KPSUidAvkonDomain, KAknKeyguardStatus, keylock ); |
|
347 |
|
348 // |
|
349 // Don't show controls when key is locked |
|
350 // |
|
351 if ( keylock ) |
|
352 { |
|
353 iShowControls = EFalse; |
|
354 } |
|
355 |
|
356 ResetDisappearingTimers( EMPXTimerReset ); |
|
357 |
|
358 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
359 { |
|
360 iControls[i]->ResetControl(); |
|
361 } |
|
362 |
|
363 break; |
|
364 } |
|
365 case EMPXControlCmdHandleForegroundEvent: |
|
366 { |
|
367 MPX_DEBUG(_L(" [EMPXControlCmdHandleForegroundEvent]")); |
|
368 |
|
369 if ( ! IsRealOneBitmapVisible() ) |
|
370 { |
|
371 iShowControls = ETrue; |
|
372 UpdateControlsVisibility(); |
|
373 } |
|
374 |
|
375 break; |
|
376 } |
|
377 case EMPXControlCmdHandleErrors: |
|
378 { |
|
379 MPX_DEBUG(_L(" [EMPXControlCmdHandleErrors]")); |
|
380 HandleErrors(); |
|
381 break; |
|
382 } |
|
383 case EMPXControlCmdShowControls: |
|
384 { |
|
385 MPX_DEBUG(_L(" [EMPXControlCmdShowControls]")); |
|
386 ShowControls(); |
|
387 break; |
|
388 } |
|
389 case EMPXControlCmdHideControls: |
|
390 { |
|
391 MPX_DEBUG(_L(" [EMPXControlCmdHideControls]")); |
|
392 HideAllControls(); |
|
393 break; |
|
394 } |
|
395 case EMPXControlCmdSoftKeyPressed: |
|
396 { |
|
397 HandleSoftKeyPressedL( aValue ); |
|
398 break; |
|
399 } |
|
400 case EMPXControlCmdShowFileDetailsViewer: |
|
401 { |
|
402 ShowMediaDetailsViewerL(); |
|
403 break; |
|
404 } |
|
405 case EMPXControlCmdCloseFileDetailsViewer: |
|
406 { |
|
407 ShowControls(); |
|
408 break; |
|
409 } |
|
410 case EMPXControlCmdSurfaceCreated: |
|
411 { |
|
412 SetRealOneBitmapVisibility( EFalse ); |
|
413 break; |
|
414 } |
|
415 case EMPXControlCmdLoadingStarted: |
|
416 { |
|
417 HandleLoadingStarted(); |
|
418 break; |
|
419 } |
|
420 case EMPXControlCmdCreateAspectRatioIcon: |
|
421 case EMPXControlCmdDeleteAspectRatioIcon: |
|
422 { |
|
423 // |
|
424 // Ignore the Aspect Ration commands for non touch devices and |
|
425 // when the TV-Out is connected. |
|
426 // |
|
427 if ( AknLayoutUtils::PenEnabled() && ! iTvOutConnected ) |
|
428 { |
|
429 iControlsConfig->UpdateControlListL( aEvent ); |
|
430 |
|
431 // |
|
432 // Set the update visibility flag based on the visibility of the controls |
|
433 // |
|
434 ControlsListUpdatedL( IsVisible() ); |
|
435 } |
|
436 } |
|
437 } |
|
438 } |
|
439 |
|
440 // ------------------------------------------------------------------------------------------------- |
|
441 // CMPXVideoPlaybackControlsController::HandleStateChange |
|
442 // ------------------------------------------------------------------------------------------------- |
|
443 // |
|
444 void CMPXVideoPlaybackControlsController::HandleStateChange( TMPXPlaybackState aNewState ) |
|
445 { |
|
446 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HandleStateChange()"), |
|
447 _L("new state = %d"), aNewState ); |
|
448 |
|
449 // |
|
450 // Somehow EPbStatePlaying, EPbStatePaused gets called twice continously |
|
451 // |
|
452 if ( aNewState != iState ) |
|
453 { |
|
454 TBool hideControls( EFalse ); |
|
455 |
|
456 iState = aNewState; |
|
457 |
|
458 switch ( aNewState ) |
|
459 { |
|
460 case EPbStateInitialised: |
|
461 { |
|
462 // |
|
463 // remove branding control when the state is transitioned to Initialized |
|
464 // |
|
465 if ( iFileDetails->iPlaybackMode == EMPXVideoStreaming || |
|
466 iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming ) |
|
467 { |
|
468 TRAP_IGNORE( |
|
469 iControlsConfig->UpdateControlListL( EMPXControlCmdPluginInitialized ); |
|
470 ControlsListUpdatedL(); |
|
471 ); |
|
472 } |
|
473 |
|
474 break; |
|
475 } |
|
476 case EPbStatePlaying: |
|
477 { |
|
478 if ( iFileDetails->iVideoEnabled && ! IsTvOutConnected() ) |
|
479 { |
|
480 // |
|
481 // Hide controls when transitioning to Playing State |
|
482 // |
|
483 hideControls = ETrue; |
|
484 } |
|
485 |
|
486 // |
|
487 // Intentionally fall through |
|
488 // |
|
489 } |
|
490 case EPbStateBuffering: |
|
491 case EPbStateNotInitialised: |
|
492 case EPbStateInitialising: |
|
493 case EPbStatePaused: |
|
494 case EPbStatePluginSeeking: |
|
495 { |
|
496 UpdateStateOnButtonBar(); |
|
497 |
|
498 // |
|
499 // Show all the controls |
|
500 // |
|
501 if ( hideControls ) |
|
502 { |
|
503 HideAllControls(); |
|
504 } |
|
505 else |
|
506 { |
|
507 UpdateControlsVisibility(); |
|
508 } |
|
509 |
|
510 break; |
|
511 } |
|
512 } |
|
513 } |
|
514 } |
|
515 |
|
516 // ------------------------------------------------------------------------------------------------- |
|
517 // CMPXVideoPlaybackControlsController::CreateControlsL() |
|
518 // ------------------------------------------------------------------------------------------------- |
|
519 // |
|
520 void CMPXVideoPlaybackControlsController::CreateControlsL() |
|
521 { |
|
522 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::CreateControlsL()")); |
|
523 |
|
524 // |
|
525 // Clean up old controls list and controls |
|
526 // |
|
527 iControls.ResetAndDestroy(); |
|
528 |
|
529 RArray<TMPXVideoPlaybackControls>& controlList = iControlsConfig->ControlList(); |
|
530 |
|
531 // |
|
532 // Iterate thru the controls list from view-config |
|
533 // and create controls that match items in the list |
|
534 // |
|
535 for ( TInt i = 0 ; i < controlList.Count() ; i++ ) |
|
536 { |
|
537 AppendControlL( controlList[i] ); |
|
538 } |
|
539 |
|
540 UpdateControlsVisibility(); |
|
541 } |
|
542 |
|
543 // ------------------------------------------------------------------------------------------------- |
|
544 // CMPXVideoPlaybackControlsController::CreateRealOneBitmapL() |
|
545 // ------------------------------------------------------------------------------------------------- |
|
546 // |
|
547 void CMPXVideoPlaybackControlsController::CreateRealOneBitmapL() |
|
548 { |
|
549 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::CreateRealOneBitmapL()")); |
|
550 |
|
551 TFileName iconsPath; |
|
552 LocateBitmapFileL( iconsPath ); |
|
553 |
|
554 iRealOneBitmap = CreateBitmapL( iconsPath, |
|
555 EMbmMpxvideoplaybackcontrolsQgn_graf_realplayer_splash_01, |
|
556 main_mp4_pane_g1(0).LayoutLine() ); |
|
557 } |
|
558 |
|
559 // ------------------------------------------------------------------------------------------------- |
|
560 // CMPXVideoPlaybackControlsController::GetBitmap() |
|
561 // ------------------------------------------------------------------------------------------------- |
|
562 // |
|
563 EXPORT_C CEikImage* |
|
564 CMPXVideoPlaybackControlsController::GetBitmap( TMPXVideoPlaybackControls aBitmap ) |
|
565 { |
|
566 CEikImage* bitmap = NULL; |
|
567 |
|
568 switch( aBitmap ) |
|
569 { |
|
570 case EMPXRealLogoBitmap: |
|
571 { |
|
572 bitmap = iRealOneBitmap; |
|
573 break; |
|
574 } |
|
575 } |
|
576 |
|
577 return bitmap; |
|
578 } |
|
579 |
|
580 // ------------------------------------------------------------------------------------------------- |
|
581 // CMPXVideoPlaybackControlsController::ControlsListUpdatedL() |
|
582 // ------------------------------------------------------------------------------------------------- |
|
583 // |
|
584 void CMPXVideoPlaybackControlsController::ControlsListUpdatedL( TBool aUpdateVisibility ) |
|
585 { |
|
586 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::ControlsListUpdatedL()"), |
|
587 _L("aUpdateVisibility = %d"), aUpdateVisibility ); |
|
588 |
|
589 RArray<TMPXVideoPlaybackControls>& updatedList = iControlsConfig->ControlList(); |
|
590 |
|
591 // |
|
592 // Create a copy of the control list |
|
593 // |
|
594 TMPXVideoPlaybackControls* data = (TMPXVideoPlaybackControls*) |
|
595 User::AllocL( updatedList.Count() * sizeof( TMPXVideoPlaybackControls ) ); |
|
596 |
|
597 Mem::Copy( data, &(updatedList[0]), updatedList.Count()* sizeof(TMPXVideoPlaybackControls)); |
|
598 |
|
599 RArray<TMPXVideoPlaybackControls> myList( sizeof(TMPXVideoPlaybackControls), |
|
600 data, |
|
601 updatedList.Count() ); |
|
602 |
|
603 CleanupClosePushL( myList ); |
|
604 |
|
605 TInt controlCount = iControls.Count(); |
|
606 |
|
607 TInt i = 0 ; |
|
608 TInt index = KErrNotFound; |
|
609 |
|
610 |
|
611 for ( TInt iCnt = 0 ; iCnt < controlCount ; iCnt++ ) |
|
612 { |
|
613 index = myList.Find( iControls[i]->ControlIndex() ); |
|
614 |
|
615 if ( index == KErrNotFound ) |
|
616 { |
|
617 // |
|
618 // Delete control since it doesn't exist in new list |
|
619 // |
|
620 delete iControls[i]; |
|
621 iControls.Delete( i ); |
|
622 } |
|
623 else |
|
624 { |
|
625 // |
|
626 // Control exists in new list. |
|
627 // Remove it from the new list. |
|
628 // |
|
629 myList.Remove( index ); |
|
630 i++; |
|
631 } |
|
632 } |
|
633 |
|
634 // |
|
635 // The updated list will contain added controls only |
|
636 // |
|
637 for ( TInt j = 0 ; j < myList.Count() ; j++ ) |
|
638 { |
|
639 AppendControlL( myList[j] ); |
|
640 } |
|
641 |
|
642 if ( aUpdateVisibility ) |
|
643 { |
|
644 UpdateControlsVisibility(); |
|
645 } |
|
646 |
|
647 CleanupStack::PopAndDestroy(); |
|
648 } |
|
649 |
|
650 // ------------------------------------------------------------------------------------------------- |
|
651 // CMPXVideoPlaybackControlsController::AppendControlL() |
|
652 // ------------------------------------------------------------------------------------------------- |
|
653 // |
|
654 void CMPXVideoPlaybackControlsController::AppendControlL( TMPXVideoPlaybackControls aControlIndex ) |
|
655 { |
|
656 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::AppendControlL()"), |
|
657 _L("control index = %d"), aControlIndex ); |
|
658 |
|
659 TUint properties = 0; |
|
660 |
|
661 iControlsPolicy->SetControlProperties( aControlIndex, properties, iFileDetails ); |
|
662 |
|
663 TFileName iconsPath; |
|
664 LocateBitmapFileL( iconsPath ); |
|
665 |
|
666 switch ( aControlIndex ) |
|
667 { |
|
668 case EMPXSoftkeyBack: |
|
669 { |
|
670 CreateFakeSoftKeyL( R_MPX_VIDEO_PLAYBACK_CONTROLS_FAKE_SK_BACK, |
|
671 ETrue, |
|
672 aControlIndex, |
|
673 properties ); |
|
674 break; |
|
675 } |
|
676 case EMPXButtonBar: |
|
677 { |
|
678 TAknLayoutRect buttonBarPaneRect; |
|
679 buttonBarPaneRect.LayoutRect( |
|
680 iRect, |
|
681 AknLayoutScalable_Avkon::area_side_right_pane( 0 ).LayoutLine() ); |
|
682 |
|
683 TAknLayoutRect buttonBarRect; |
|
684 buttonBarRect.LayoutRect( buttonBarPaneRect.Rect(), |
|
685 grid_sctrl_middle_pane( 0 ).LayoutLine() ); |
|
686 |
|
687 TRect btBarRect( buttonBarRect.Rect() ); |
|
688 btBarRect.iBr.iY -= 25; |
|
689 btBarRect.iTl.iY += 15; |
|
690 CMPXVideoPlaybackButtonBar* buttonBar = |
|
691 CMPXVideoPlaybackButtonBar::NewL( this, btBarRect ); |
|
692 |
|
693 CleanupStack::PushL( buttonBar ); |
|
694 |
|
695 CMPXVideoPlaybackControl* control = |
|
696 CMPXVideoPlaybackControl::NewL( this, |
|
697 buttonBar, |
|
698 btBarRect, |
|
699 aControlIndex, |
|
700 properties ); |
|
701 |
|
702 CleanupStack::PushL( control ); |
|
703 |
|
704 iControls.AppendL( control ); |
|
705 |
|
706 CleanupStack::Pop( 2 ); // buttonBar, control |
|
707 |
|
708 break; |
|
709 } |
|
710 case EMPXVolumeBar: |
|
711 { |
|
712 TAknLayoutRect volumeLayoutRect; |
|
713 volumeLayoutRect.LayoutRect( iRect, popup_slider_window_cp02().LayoutLine() ); |
|
714 TRect rect = volumeLayoutRect.Rect(); |
|
715 |
|
716 CMPXVideoPlaybackVolumeBar* volBar = CMPXVideoPlaybackVolumeBar::NewL( this, rect ); |
|
717 |
|
718 CleanupStack::PushL( volBar ); |
|
719 |
|
720 CMPXVideoPlaybackControl* control = CMPXVideoPlaybackControl::NewL( this, |
|
721 volBar, |
|
722 rect, |
|
723 aControlIndex, |
|
724 properties ); |
|
725 |
|
726 CleanupStack::PushL( control ); |
|
727 |
|
728 iControls.AppendL( control ); |
|
729 |
|
730 CleanupStack::Pop( 2 ); // volBar, control |
|
731 |
|
732 break; |
|
733 } |
|
734 case EMPXProgressBar: |
|
735 { |
|
736 TAknLayoutRect progressPaneRect; |
|
737 progressPaneRect.LayoutRect( iRect, mp4_progress_pane( KMP4LayoutSet ).LayoutLine() ); |
|
738 |
|
739 TRect touchPaneRect( progressPaneRect.Rect().iTl.iX, |
|
740 progressPaneRect.Rect().iTl.iY, |
|
741 progressPaneRect.Rect().iBr.iX, |
|
742 iRect.Height() ); |
|
743 |
|
744 CMPXVideoPlaybackProgressBar* progBar = |
|
745 CMPXVideoPlaybackProgressBar::NewL( this, touchPaneRect ); |
|
746 |
|
747 CleanupStack::PushL( progBar ); |
|
748 |
|
749 CMPXVideoPlaybackControl* control = CMPXVideoPlaybackControl::NewL( this, |
|
750 progBar, |
|
751 touchPaneRect, |
|
752 aControlIndex, |
|
753 properties ); |
|
754 |
|
755 CleanupStack::PushL( control ); |
|
756 |
|
757 iControls.AppendL( control ); |
|
758 |
|
759 CleanupStack::Pop( 2 ); // progBar, control |
|
760 |
|
761 break; |
|
762 } |
|
763 case EMPXSoftkeyDetails: |
|
764 { |
|
765 CreateFakeSoftKeyL( R_MPX_VIDEO_PLAYBACK_CONTROLS_FAKE_SK_DETAILS, |
|
766 EFalse, |
|
767 aControlIndex, |
|
768 properties ); |
|
769 break; |
|
770 } |
|
771 case EMPXBufferingLabel: |
|
772 { |
|
773 CreateTextLabelWithSpecificLayoutL( R_MPX_LOADING, |
|
774 aControlIndex, |
|
775 properties, |
|
776 main_mp4_pane_t3( KMP4LayoutSet ) ); |
|
777 break; |
|
778 } |
|
779 case EMPXTitleLabel: |
|
780 { |
|
781 CreateTitleControlL( aControlIndex, properties ); |
|
782 |
|
783 break; |
|
784 } |
|
785 case EMPXArtistLabel: |
|
786 { |
|
787 if ( iFileDetails->iArtist && iFileDetails->iArtist->Length() ) |
|
788 { |
|
789 CEikLabel* label = CreateTextLabelL( *(iFileDetails->iArtist) ); |
|
790 |
|
791 CleanupStack::PushL( label ); |
|
792 |
|
793 AknLayoutUtils::LayoutLabel( label, |
|
794 iRect, |
|
795 main_mp3_pane_t3().LayoutLine()); |
|
796 |
|
797 label->OverrideColorL( EColorLabelText, KRgbWhite ); |
|
798 label->OverrideColorL( EColorLabelTextEmphasis, KRgbWhite ); |
|
799 |
|
800 CMPXVideoPlaybackControl* control = |
|
801 CMPXVideoPlaybackControl::NewL( this, |
|
802 label, |
|
803 label->Rect(), |
|
804 aControlIndex, |
|
805 properties ); |
|
806 |
|
807 CleanupStack::PushL( control ); |
|
808 |
|
809 iControls.AppendL( control ); |
|
810 |
|
811 CleanupStack::Pop( 2 ); // label, control |
|
812 } |
|
813 break; |
|
814 } |
|
815 case EMPXRealAudioBitmap: |
|
816 { |
|
817 CreateAudioOnlyBitmapL( iconsPath, |
|
818 EMbmMpxvideoplaybackcontrolsQgn_menu_rp, |
|
819 EMbmMpxvideoplaybackcontrolsQgn_menu_rp_mask, |
|
820 aControlIndex, |
|
821 main_mp3_pane_g3(0).LayoutLine(), |
|
822 properties ); |
|
823 |
|
824 break; |
|
825 } |
|
826 case EMPXSoundBitmap: |
|
827 { |
|
828 CreateAudioOnlyBitmapL( iconsPath, |
|
829 EMbmMpxvideoplaybackcontrolsQgn_indi_onimage_audio, |
|
830 EMbmMpxvideoplaybackcontrolsQgn_indi_onimage_audio_mask, |
|
831 aControlIndex, |
|
832 main_mp3_pane_g4(0).LayoutLine(), |
|
833 properties ); |
|
834 |
|
835 break; |
|
836 } |
|
837 case EMPXNoVideoBitmap: |
|
838 { |
|
839 CreateAudioOnlyBitmapL( iconsPath, |
|
840 EMbmMpxvideoplaybackcontrolsQgn_prop_video_corrupted, |
|
841 EMbmMpxvideoplaybackcontrolsQgn_prop_video_corrupted_mask, |
|
842 aControlIndex, |
|
843 main_mp3_pane_g4(0).LayoutLine(), |
|
844 properties ); |
|
845 |
|
846 break; |
|
847 } |
|
848 case EMPXDownloadPausedIcon: |
|
849 { |
|
850 // |
|
851 // Not added to the control list since it will always be visible |
|
852 // |
|
853 CEikImage* dlPausedBitmap = |
|
854 CreateImageL( iconsPath, |
|
855 EMbmMpxvideoplaybackcontrolsQgn_indi_mp_ongoing_interrupt, |
|
856 EMbmMpxvideoplaybackcontrolsQgn_indi_mp_ongoing_interrupt_mask ); |
|
857 |
|
858 CleanupStack::PushL( dlPausedBitmap ); |
|
859 |
|
860 AknLayoutUtils::LayoutImage( dlPausedBitmap, |
|
861 iRect, |
|
862 AknLayoutScalable_Apps::main_mp4_pane_g6( KMP4LayoutSet ) ); |
|
863 |
|
864 TRect ctrlRect = dlPausedBitmap->Rect(); |
|
865 |
|
866 // |
|
867 // To make it aligned with AspectRatioIcon when touch is supported. |
|
868 // |
|
869 if ( AknLayoutUtils::PenEnabled() ) |
|
870 { |
|
871 ctrlRect.iBr.iY += 10; |
|
872 ctrlRect.iTl.iY += 10; |
|
873 } |
|
874 |
|
875 CMPXVideoPlaybackControl* control = |
|
876 CMPXVideoPlaybackControlPdl::NewL( this, |
|
877 dlPausedBitmap, |
|
878 ctrlRect, |
|
879 aControlIndex, |
|
880 properties ); |
|
881 |
|
882 CleanupStack::PushL( control ); |
|
883 |
|
884 iControls.AppendL( control ); |
|
885 |
|
886 CleanupStack::Pop( 2 ); // dlPausedBitmap, control |
|
887 |
|
888 break; |
|
889 } |
|
890 case EMPXAspectRatioIcon: |
|
891 { |
|
892 |
|
893 TAknLayoutRect aspectRatioPaneRect; |
|
894 aspectRatioPaneRect.LayoutRect( iRect, |
|
895 main_mp4_pane_g5( KMP4LayoutSet ).LayoutLine() ); |
|
896 |
|
897 // |
|
898 // Set the touchable area for aspect ratio |
|
899 // |
|
900 TRect touchableArea = TRect( aspectRatioPaneRect.Rect().iTl.iX - 25, |
|
901 aspectRatioPaneRect.Rect().iTl.iY - 10, |
|
902 aspectRatioPaneRect.Rect().iBr.iX + 15, |
|
903 aspectRatioPaneRect.Rect().iBr.iY + 30 ); |
|
904 |
|
905 CMPXVideoPlaybackAspectRatioIcon* aspectRatioIcon = |
|
906 CMPXVideoPlaybackAspectRatioIcon::NewL( this, touchableArea ); |
|
907 |
|
908 CleanupStack::PushL( aspectRatioIcon ); |
|
909 |
|
910 CMPXVideoPlaybackControl* control = |
|
911 CMPXVideoPlaybackControl::NewL( this, |
|
912 aspectRatioIcon, |
|
913 touchableArea, |
|
914 aControlIndex, |
|
915 properties ); |
|
916 |
|
917 control->MakeVisible( EFalse ); |
|
918 |
|
919 CleanupStack::PushL( control ); |
|
920 |
|
921 iControls.AppendL( control ); |
|
922 |
|
923 CleanupStack::Pop( 2 ); // aspectRatioIcon, control |
|
924 |
|
925 break; |
|
926 } |
|
927 case EMPXBrandingAnimation: |
|
928 { |
|
929 TAknLayoutRect brandingPaneRect; |
|
930 brandingPaneRect.LayoutRect( iRect, main_mp4_pane_g3( KMP4LayoutSet ).LayoutLine() ); |
|
931 |
|
932 // Decrease the size of BrandingAnimation to make it look better. |
|
933 TRect brandingLogoRect( |
|
934 brandingPaneRect.Rect().iTl.iX+20, |
|
935 brandingPaneRect.Rect().iTl.iY+50, |
|
936 brandingPaneRect.Rect().iBr.iX-20, |
|
937 brandingPaneRect.Rect().iBr.iY-50 ); |
|
938 CMPXVideoPlaybackBrandingAnimation* brandingAnimation = |
|
939 CMPXVideoPlaybackBrandingAnimation::NewL( this, |
|
940 brandingLogoRect, |
|
941 iRNFormat ); |
|
942 |
|
943 CleanupStack::PushL( brandingAnimation ); |
|
944 |
|
945 CMPXVideoPlaybackControl* control = |
|
946 CMPXVideoPlaybackControl::NewL( this, |
|
947 brandingAnimation, |
|
948 brandingLogoRect, |
|
949 aControlIndex, |
|
950 properties ); |
|
951 |
|
952 CleanupStack::PushL( control ); |
|
953 |
|
954 iControls.AppendL( control ); |
|
955 |
|
956 CleanupStack::Pop( 2 ); // brandingAnimation, control |
|
957 |
|
958 break; |
|
959 } |
|
960 case EMPXVideoPausedIcon: |
|
961 { |
|
962 CEikImage* pausedBitmap = |
|
963 CreateImageL( iconsPath, |
|
964 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause, |
|
965 EMbmMpxvideoplaybackcontrolsQgn_prop_image_tb_pause_mask ); |
|
966 |
|
967 CleanupStack::PushL( pausedBitmap ); |
|
968 |
|
969 AknLayoutUtils::LayoutImage( pausedBitmap, |
|
970 iRect, |
|
971 AknLayoutScalable_Apps::main_mp4_pane_g4( KMP4LayoutSet ) ); |
|
972 |
|
973 CMPXVideoPlaybackControl* control = |
|
974 CMPXVideoPlaybackControl::NewL( this, |
|
975 pausedBitmap, |
|
976 pausedBitmap->Rect(), |
|
977 aControlIndex, |
|
978 properties ); |
|
979 |
|
980 CleanupStack::PushL( control ); |
|
981 iControls.AppendL( control ); |
|
982 CleanupStack::Pop( 2 ); // pausedBitmap, control |
|
983 break; |
|
984 } |
|
985 } |
|
986 } |
|
987 |
|
988 // ------------------------------------------------------------------------------------------------- |
|
989 // CMPXVideoPlaybackControlsController::CreateTitleControlL() |
|
990 // ------------------------------------------------------------------------------------------------- |
|
991 // |
|
992 void CMPXVideoPlaybackControlsController::CreateTitleControlL( |
|
993 TMPXVideoPlaybackControls aControlIndex, |
|
994 TUint aProperties ) |
|
995 { |
|
996 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::CreateTitleControlL()")); |
|
997 |
|
998 HBufC* displayedTitle; |
|
999 |
|
1000 // |
|
1001 // If Title exists, use the title. If title doesn't exitst, use the filename |
|
1002 // excecpt when streaming functionality is hidden |
|
1003 // |
|
1004 if ( iFileDetails->iTitle ) |
|
1005 |
|
1006 { |
|
1007 displayedTitle = HBufC::NewL( iFileDetails->iTitle->Length() ); |
|
1008 TPtr tempTitle( displayedTitle->Des() ); |
|
1009 tempTitle.Append( iFileDetails->iTitle->Des() ); |
|
1010 } |
|
1011 else |
|
1012 { |
|
1013 // |
|
1014 // If title doesn't exitst, use the filename |
|
1015 // excecpt when streaming functionality is hidden |
|
1016 // |
|
1017 // ! ( iFileDetails->iMode == EStreaming && |
|
1018 // iFileDetails->iHideStreamingFunctionality ) ) |
|
1019 // |
|
1020 TParse parse; |
|
1021 parse.Set( iFileDetails->iClipName->Des(), NULL, NULL); |
|
1022 displayedTitle = parse.Name().AllocL(); |
|
1023 } |
|
1024 |
|
1025 TAknTextComponentLayout layout = main_mp3_pane_t6(); |
|
1026 |
|
1027 if ( iFileDetails->iArtist ) |
|
1028 { |
|
1029 layout = main_mp3_pane_t2(); |
|
1030 } |
|
1031 |
|
1032 CEikLabel* label = CreateTextLabelL( *displayedTitle ); |
|
1033 |
|
1034 CleanupStack::PushL( label ); |
|
1035 |
|
1036 delete displayedTitle; |
|
1037 |
|
1038 AknLayoutUtils::LayoutLabel( label, |
|
1039 iRect, |
|
1040 layout.LayoutLine()); |
|
1041 |
|
1042 label->OverrideColorL( EColorLabelText, KRgbWhite ); |
|
1043 label->OverrideColorL( EColorLabelTextEmphasis, KRgbWhite ); |
|
1044 |
|
1045 CMPXVideoPlaybackControl* control = CMPXVideoPlaybackControl::NewL( this, |
|
1046 label, |
|
1047 label->Rect(), |
|
1048 aControlIndex, |
|
1049 aProperties ); |
|
1050 |
|
1051 iControls.AppendL( control ); |
|
1052 |
|
1053 CleanupStack::Pop( label ); |
|
1054 } |
|
1055 |
|
1056 // ------------------------------------------------------------------------------------------------- |
|
1057 // CMPXVideoPlaybackControlsController::CreateAudioOnlyBitmapL() |
|
1058 // ------------------------------------------------------------------------------------------------- |
|
1059 // |
|
1060 void CMPXVideoPlaybackControlsController::CreateAudioOnlyBitmapL( |
|
1061 TFileName& aIconsPath, |
|
1062 TInt aBitmapIndex, |
|
1063 TInt aBitmapMaskIndex, |
|
1064 TMPXVideoPlaybackControls aControlIndex, |
|
1065 const TAknWindowLineLayout& aLayout, |
|
1066 TUint aProperties ) |
|
1067 { |
|
1068 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::CreateAudioOnlyBitmapL()")); |
|
1069 |
|
1070 CEikImage* audioOnlyBitmap = CreateImageL( aIconsPath, aBitmapIndex, aBitmapMaskIndex ); |
|
1071 |
|
1072 CleanupStack::PushL( audioOnlyBitmap ); |
|
1073 |
|
1074 AknLayoutUtils::LayoutImage( audioOnlyBitmap, iRect, aLayout ); |
|
1075 |
|
1076 CMPXVideoPlaybackControl* control = |
|
1077 CMPXVideoPlaybackControl::NewL( this, |
|
1078 audioOnlyBitmap, |
|
1079 audioOnlyBitmap->Rect(), |
|
1080 aControlIndex, |
|
1081 aProperties ); |
|
1082 |
|
1083 iControls.AppendL( control ); |
|
1084 |
|
1085 CleanupStack::Pop( audioOnlyBitmap ); |
|
1086 } |
|
1087 |
|
1088 // ------------------------------------------------------------------------------------------------- |
|
1089 // CMPXVideoPlaybackControlsController::CreateFakeSoftKeyL() |
|
1090 // ------------------------------------------------------------------------------------------------- |
|
1091 // |
|
1092 void CMPXVideoPlaybackControlsController::CreateFakeSoftKeyL( |
|
1093 TInt aResource, |
|
1094 TBool aTop, |
|
1095 TMPXVideoPlaybackControls aControlIndex, |
|
1096 TUint aProperties ) |
|
1097 { |
|
1098 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::CreateFakeSoftKeyL")); |
|
1099 |
|
1100 HBufC* text = StringLoader::LoadLC( aResource ); |
|
1101 CEikLabel* label = CreateTextLabelL( text->Des() ); |
|
1102 CleanupStack::PopAndDestroy( text ); |
|
1103 |
|
1104 CleanupStack::PushL( label ); |
|
1105 |
|
1106 TAknTextComponentLayout SKLayout; |
|
1107 TAknWindowComponentLayout softkeyPane; |
|
1108 TRect skRect; |
|
1109 |
|
1110 if ( aTop ) |
|
1111 { |
|
1112 SKLayout = main_mp4_pane_t2( KMP4LayoutSet ); |
|
1113 } |
|
1114 else |
|
1115 { |
|
1116 SKLayout = main_mp4_pane_t1( KMP4LayoutSet ); |
|
1117 } |
|
1118 |
|
1119 AknLayoutUtils::LayoutLabel( label, |
|
1120 iRect, |
|
1121 SKLayout.LayoutLine() ); |
|
1122 |
|
1123 if ( AknLayoutUtils::PenEnabled() ) |
|
1124 { |
|
1125 if ( aTop ) |
|
1126 { |
|
1127 label->SetAlignment( EHRightVCenter ); |
|
1128 } |
|
1129 else |
|
1130 { |
|
1131 label->SetAlignment( EHLeftVCenter ); |
|
1132 } |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 if ( aTop ) |
|
1137 { |
|
1138 //Default alignment is EHRightVTop |
|
1139 } |
|
1140 else |
|
1141 { |
|
1142 label->SetAlignment( EHRightVBottom ); |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 skRect = label->Rect(); |
|
1147 |
|
1148 // Enlarge the button region to make it easy to be touched. |
|
1149 skRect.iTl.iY -= 26; |
|
1150 skRect.iBr.iY += 6; |
|
1151 |
|
1152 CMPXVideoPlaybackControl* control = CMPXVideoPlaybackControl::NewL( this, |
|
1153 label, |
|
1154 skRect, |
|
1155 aControlIndex, |
|
1156 aProperties ); |
|
1157 |
|
1158 iControls.AppendL( control ); |
|
1159 |
|
1160 CleanupStack::Pop( label ); |
|
1161 } |
|
1162 |
|
1163 // ------------------------------------------------------------------------------------------------- |
|
1164 // CMPXVideoPlaybackControlsController::CreateTextLabelWithSpecificLayoutL() |
|
1165 // ------------------------------------------------------------------------------------------------- |
|
1166 // |
|
1167 void CMPXVideoPlaybackControlsController::CreateTextLabelWithSpecificLayoutL( |
|
1168 TInt aResource, |
|
1169 TMPXVideoPlaybackControls aControlIndex, |
|
1170 TUint aProperties, |
|
1171 TAknTextComponentLayout aLayout ) |
|
1172 { |
|
1173 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::CreateTextLabelWithSpecificLayoutL()")); |
|
1174 |
|
1175 HBufC* text = StringLoader::LoadLC( aResource ); |
|
1176 CEikLabel* label = CreateTextLabelL( text->Des() ); |
|
1177 CleanupStack::PopAndDestroy( text ); |
|
1178 |
|
1179 CleanupStack::PushL( label ); |
|
1180 |
|
1181 AknLayoutUtils::LayoutLabel( label, |
|
1182 iRect, |
|
1183 aLayout.LayoutLine()); |
|
1184 |
|
1185 CMPXVideoPlaybackControl* control = CMPXVideoPlaybackControl::NewL( this, |
|
1186 label, |
|
1187 label->Rect(), |
|
1188 aControlIndex, |
|
1189 aProperties ); |
|
1190 |
|
1191 iControls.AppendL( control ); |
|
1192 |
|
1193 CleanupStack::Pop( label ); |
|
1194 } |
|
1195 |
|
1196 // ------------------------------------------------------------------------------------------------- |
|
1197 // CMPXVideoPlaybackControlsController::CreateTextLabelL() |
|
1198 // ------------------------------------------------------------------------------------------------- |
|
1199 // |
|
1200 CEikLabel* CMPXVideoPlaybackControlsController::CreateTextLabelL( const TDesC& aText ) |
|
1201 { |
|
1202 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::CreateTextLabelL()")); |
|
1203 |
|
1204 CEikLabel* label = new (ELeave) CEikLabel; |
|
1205 label->SetContainerWindowL( *iContainer ); |
|
1206 label->SetTextL( aText ); |
|
1207 label->MakeVisible( EFalse ); |
|
1208 |
|
1209 return label; |
|
1210 } |
|
1211 |
|
1212 // ------------------------------------------------------------------------------------------------- |
|
1213 // CMPXVideoPlaybackControlsController::ToggleVisibility() |
|
1214 // ------------------------------------------------------------------------------------------------- |
|
1215 // |
|
1216 void CMPXVideoPlaybackControlsController::ToggleVisibility() |
|
1217 { |
|
1218 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::ToggleVisibility()")); |
|
1219 |
|
1220 // |
|
1221 // Toggle visibility only if: |
|
1222 // (a) MediaDetailsViewer is not visble |
|
1223 // (b) TV-Out is not connected and |
|
1224 // (c) we are in playing or paused state |
|
1225 // |
|
1226 if ( ! IsMediaDetailsViewerVisible() && |
|
1227 ! IsTvOutConnected() && |
|
1228 ( iState == EPbStatePlaying || iState == EPbStatePaused ) ) |
|
1229 { |
|
1230 // |
|
1231 // Controls will remain visible for audio only clips |
|
1232 // |
|
1233 if ( iFileDetails->iVideoEnabled ) |
|
1234 { |
|
1235 #ifdef RD_TACTILE_FEEDBACK |
|
1236 if ( iFeedback ) |
|
1237 { |
|
1238 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::ToggleVisibility() tactile")); |
|
1239 iFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
1240 } |
|
1241 #endif //RD_TACTILE_FEEDBACK |
|
1242 |
|
1243 if ( IsVisible() ) |
|
1244 { |
|
1245 HideAllControls(); |
|
1246 } |
|
1247 else |
|
1248 { |
|
1249 ShowControls(); |
|
1250 } |
|
1251 } |
|
1252 } |
|
1253 } |
|
1254 |
|
1255 // ------------------------------------------------------------------------------------------------- |
|
1256 // CMPXVideoPlaybackControlsController::ResetDisappearingTimers() |
|
1257 // ------------------------------------------------------------------------------------------------- |
|
1258 // |
|
1259 void CMPXVideoPlaybackControlsController::ResetDisappearingTimers( TMPXTimerAction aTimerAction ) |
|
1260 { |
|
1261 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::ResetDisappearingTimers()")); |
|
1262 |
|
1263 if ( iControlsTimer->IsActive() ) |
|
1264 { |
|
1265 iControlsTimer->Cancel(); |
|
1266 } |
|
1267 |
|
1268 if ( aTimerAction == EMPXTimerReset && iState == EPbStatePlaying ) |
|
1269 { |
|
1270 // |
|
1271 // Do not start the time for Audio only clips or TV-Out is connected |
|
1272 // |
|
1273 if ( iFileDetails->iVideoEnabled && ! IsTvOutConnected() ) |
|
1274 { |
|
1275 MPX_DEBUG(_L(" Starting Controls Timer")); |
|
1276 |
|
1277 iControlsTimer->Start( |
|
1278 KMPXControlsTimeOut, |
|
1279 0, |
|
1280 TCallBack( CMPXVideoPlaybackControlsController::HandleControlsTimeout, this ) ); |
|
1281 } |
|
1282 } |
|
1283 } |
|
1284 |
|
1285 // ------------------------------------------------------------------------------------------------- |
|
1286 // CMPXVideoPlaybackControlsController::HandleControlsTimeout |
|
1287 // ------------------------------------------------------------------------------------------------- |
|
1288 // |
|
1289 TInt CMPXVideoPlaybackControlsController::HandleControlsTimeout( TAny* aPtr ) |
|
1290 { |
|
1291 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::HandleControlsTimeout()")); |
|
1292 |
|
1293 static_cast<CMPXVideoPlaybackControlsController*>(aPtr)->HideAllControls(); |
|
1294 |
|
1295 return KErrNone; |
|
1296 } |
|
1297 |
|
1298 // ------------------------------------------------------------------------------------------------- |
|
1299 // CMPXVideoPlaybackControlsController::HideAllControls() |
|
1300 // ------------------------------------------------------------------------------------------------- |
|
1301 // |
|
1302 void CMPXVideoPlaybackControlsController::HideAllControls() |
|
1303 { |
|
1304 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HideAllControls()")); |
|
1305 |
|
1306 ResetDisappearingTimers( EMPXTimerCancel ); |
|
1307 |
|
1308 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1309 { |
|
1310 iControls[i]->MakeVisible( EFalse ); |
|
1311 } |
|
1312 } |
|
1313 |
|
1314 // ------------------------------------------------------------------------------------------------- |
|
1315 // CMPXVideoPlaybackControlsController::ShowControls() |
|
1316 // ------------------------------------------------------------------------------------------------- |
|
1317 // |
|
1318 void CMPXVideoPlaybackControlsController::ShowControls() |
|
1319 { |
|
1320 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::ShowControls()"), |
|
1321 _L("iState = %d"), iState ); |
|
1322 |
|
1323 if ( iShowControls ) |
|
1324 { |
|
1325 CloseMediaDetailsViewer(); |
|
1326 |
|
1327 ResetDisappearingTimers( EMPXTimerReset ); |
|
1328 |
|
1329 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1330 { |
|
1331 iControls[i]->SetVisibility( iState ); |
|
1332 } |
|
1333 } |
|
1334 } |
|
1335 |
|
1336 // ------------------------------------------------------------------------------------------------- |
|
1337 // CMPXVideoPlaybackControlsController::IsVisible() |
|
1338 // ------------------------------------------------------------------------------------------------- |
|
1339 // |
|
1340 TBool CMPXVideoPlaybackControlsController::IsVisible() |
|
1341 { |
|
1342 TBool visible = EFalse; |
|
1343 |
|
1344 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1345 { |
|
1346 if ( iControls[i]->ControlIndex() == EMPXSoftkeyBack ) |
|
1347 { |
|
1348 if ( iControls[i]->IsVisible() ) |
|
1349 { |
|
1350 visible = ETrue; |
|
1351 } |
|
1352 |
|
1353 break; |
|
1354 } |
|
1355 } |
|
1356 |
|
1357 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsVisible() [%d]"), visible); |
|
1358 |
|
1359 return visible; |
|
1360 } |
|
1361 |
|
1362 // ------------------------------------------------------------------------------------------------- |
|
1363 // CMPXVideoPlaybackControlsController::UpdateControlsVisibility() |
|
1364 // ------------------------------------------------------------------------------------------------- |
|
1365 // |
|
1366 void CMPXVideoPlaybackControlsController::UpdateControlsVisibility() |
|
1367 { |
|
1368 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::UpdateControlsVisibility()")); |
|
1369 |
|
1370 HideAllControls(); |
|
1371 ShowControls(); |
|
1372 } |
|
1373 |
|
1374 // ------------------------------------------------------------------------------------------------- |
|
1375 // CMPXVideoPlaybackControlsController::HandleCommandL() |
|
1376 // ------------------------------------------------------------------------------------------------- |
|
1377 // |
|
1378 void CMPXVideoPlaybackControlsController::HandleCommandL( TInt aCommand, TInt aValue ) |
|
1379 { |
|
1380 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::HandleCommandL(%d)"), aCommand); |
|
1381 |
|
1382 iContainer->HandleCommandL( aCommand, aValue ); |
|
1383 } |
|
1384 |
|
1385 // ------------------------------------------------------------------------------------------------- |
|
1386 // CMPXVideoPlaybackControlsController::VolumeChanged() |
|
1387 // ------------------------------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CMPXVideoPlaybackControlsController::VolumeChanged( TInt aVolume ) |
|
1390 { |
|
1391 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::VolumeChanged() [%d]"), aVolume); |
|
1392 |
|
1393 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1394 { |
|
1395 if ( iControls[i]->VolumeChanged( aVolume ) ) |
|
1396 { |
|
1397 break; |
|
1398 } |
|
1399 } |
|
1400 |
|
1401 ShowControls(); |
|
1402 } |
|
1403 |
|
1404 // ------------------------------------------------------------------------------------------------- |
|
1405 // CMPXVideoPlaybackControlsController::DurationChangedL() |
|
1406 // ------------------------------------------------------------------------------------------------- |
|
1407 // |
|
1408 void CMPXVideoPlaybackControlsController::DurationChangedL( TInt aDuration ) |
|
1409 { |
|
1410 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::DurationChangedL() [%d]"), aDuration); |
|
1411 |
|
1412 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1413 { |
|
1414 if ( iControls[i]->DurationChangedL( aDuration ) ) |
|
1415 { |
|
1416 break; |
|
1417 } |
|
1418 } |
|
1419 } |
|
1420 |
|
1421 // ------------------------------------------------------------------------------------------------- |
|
1422 // CMPXVideoPlaybackControlsController::PositionChangedL() |
|
1423 // ------------------------------------------------------------------------------------------------- |
|
1424 // |
|
1425 void CMPXVideoPlaybackControlsController::PositionChangedL( TInt aPosition ) |
|
1426 { |
|
1427 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::PositionChangedL() [%d]"), aPosition); |
|
1428 |
|
1429 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1430 { |
|
1431 if ( iControls[i]->PositionChangedL( aPosition ) ) |
|
1432 { |
|
1433 break; |
|
1434 } |
|
1435 } |
|
1436 } |
|
1437 |
|
1438 // ------------------------------------------------------------------------------------------------- |
|
1439 // CMPXVideoPlaybackControlsController::AspectRatioChanged() |
|
1440 // ------------------------------------------------------------------------------------------------- |
|
1441 // |
|
1442 void CMPXVideoPlaybackControlsController::AspectRatioChanged( TInt aAspectRatio ) |
|
1443 { |
|
1444 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::AspectRatioChanged() [%d]"), aAspectRatio); |
|
1445 |
|
1446 iAspectRatio = (TMMFScalingType)aAspectRatio; |
|
1447 |
|
1448 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1449 { |
|
1450 if ( iControls[i]->AspectRatioChanged( aAspectRatio ) ) |
|
1451 { |
|
1452 break; |
|
1453 } |
|
1454 } |
|
1455 } |
|
1456 |
|
1457 // ------------------------------------------------------------------------------------------------- |
|
1458 // CMPXVideoPlaybackControlsController::UpdateStateOnButtonBar() |
|
1459 // ------------------------------------------------------------------------------------------------- |
|
1460 // |
|
1461 void CMPXVideoPlaybackControlsController::UpdateStateOnButtonBar() |
|
1462 { |
|
1463 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::UpdateStateOnButtonBar() [%d]"), iState); |
|
1464 |
|
1465 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1466 { |
|
1467 if ( iControls[i]->UpdateStateOnButtonBar( iState ) ) |
|
1468 { |
|
1469 break; |
|
1470 } |
|
1471 } |
|
1472 } |
|
1473 |
|
1474 // ------------------------------------------------------------------------------------------------ |
|
1475 // CMPXVideoPlaybackControlsController::CreateBitmap() |
|
1476 // ------------------------------------------------------------------------------------------------ |
|
1477 // |
|
1478 CEikImage* |
|
1479 CMPXVideoPlaybackControlsController::CreateBitmapL( TFileName& aIconsPath, |
|
1480 TInt aBitmapIndex, |
|
1481 const TAknWindowLineLayout& aLayout ) |
|
1482 { |
|
1483 CEikImage* eikImage = new (ELeave) CEikImage(); |
|
1484 |
|
1485 CleanupStack::PushL( eikImage ); |
|
1486 |
|
1487 CFbsBitmap* imageBitmap = AknIconUtils::CreateIconL( aIconsPath, aBitmapIndex ); |
|
1488 |
|
1489 CleanupStack::PushL( imageBitmap ); |
|
1490 |
|
1491 eikImage->SetBitmap( imageBitmap ); |
|
1492 eikImage->SetContainerWindowL( *iContainer ); |
|
1493 eikImage->MakeVisible( EFalse ); |
|
1494 |
|
1495 AknLayoutUtils::LayoutImage( eikImage, iRect, aLayout ); |
|
1496 |
|
1497 CleanupStack::Pop( 2 ); // eikImage & imageBitmap |
|
1498 |
|
1499 return eikImage; |
|
1500 } |
|
1501 |
|
1502 // ------------------------------------------------------------------------------------------------ |
|
1503 // CMPXVideoPlaybackControlsController::CreateImageL() |
|
1504 // ------------------------------------------------------------------------------------------------ |
|
1505 // |
|
1506 CEikImage* |
|
1507 CMPXVideoPlaybackControlsController::CreateImageL( TFileName& aIconsPath, |
|
1508 TInt aBitmapIndex, |
|
1509 TInt aBitmapMaskIndex ) |
|
1510 { |
|
1511 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::CreateImageL()")); |
|
1512 |
|
1513 CFbsBitmap* bitmap = NULL; |
|
1514 CFbsBitmap* mask = NULL; |
|
1515 CEikImage* image = new (ELeave) CEikImage(); |
|
1516 |
|
1517 AknIconUtils::CreateIconLC( bitmap, mask, aIconsPath, aBitmapIndex, aBitmapMaskIndex ); |
|
1518 |
|
1519 image->SetPicture( bitmap, mask ); // Ownership transferred |
|
1520 CleanupStack::Pop( 2 ); // bitmap, mask |
|
1521 image->SetContainerWindowL( *iContainer ); |
|
1522 image->MakeVisible( EFalse ); |
|
1523 |
|
1524 return image; |
|
1525 } |
|
1526 |
|
1527 // ------------------------------------------------------------------------------------------------ |
|
1528 // CMPXVideoPlaybackControlsController::StopBrandingAnimation() |
|
1529 // ------------------------------------------------------------------------------------------------ |
|
1530 // |
|
1531 void CMPXVideoPlaybackControlsController::StopBrandingAnimation() |
|
1532 { |
|
1533 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::StopBrandingAnimation()")); |
|
1534 |
|
1535 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1536 { |
|
1537 if ( iControls[i]->StopBrandingAnimationTimer() ) |
|
1538 { |
|
1539 break; |
|
1540 } |
|
1541 } |
|
1542 } |
|
1543 |
|
1544 // ------------------------------------------------------------------------------------------------- |
|
1545 // CMPXVideoPlaybackControlsController::IsRealFormatL() |
|
1546 // ------------------------------------------------------------------------------------------------- |
|
1547 // |
|
1548 TBool CMPXVideoPlaybackControlsController::IsRealFormatL( const TDesC& aDes ) |
|
1549 { |
|
1550 TBool realFormat = EFalse; |
|
1551 |
|
1552 if ( aDes != KNullDesC && aDes.Length() ) |
|
1553 { |
|
1554 if ( iFileDetails->iPlaybackMode == EMPXVideoStreaming || |
|
1555 iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming ) |
|
1556 { |
|
1557 realFormat = RealFormatForStreamingL( aDes ); |
|
1558 } |
|
1559 else |
|
1560 { |
|
1561 realFormat = RealFormatForLocalL(); |
|
1562 } |
|
1563 } |
|
1564 |
|
1565 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsRealFormatL() [%d]"), realFormat); |
|
1566 |
|
1567 return realFormat; |
|
1568 } |
|
1569 |
|
1570 // ------------------------------------------------------------------------------------------------- |
|
1571 // CMPXVideoPlaybackControlsController::RealFormatForStreamingL() |
|
1572 // ------------------------------------------------------------------------------------------------- |
|
1573 // |
|
1574 TBool CMPXVideoPlaybackControlsController::RealFormatForStreamingL( const TDesC& aDes ) |
|
1575 { |
|
1576 TBool realFormat = EFalse; |
|
1577 TParse filePath; |
|
1578 |
|
1579 _LIT(KMPXRMEXT, ".R" ); |
|
1580 |
|
1581 TInt err = filePath.Set( aDes, NULL, NULL ); |
|
1582 |
|
1583 // |
|
1584 // It is valid to have a "\" character in a url, but parsing fails, |
|
1585 // switch these characters to "/" for the local string and try parsing again. |
|
1586 // |
|
1587 if ( err == KErrBadName ) |
|
1588 { |
|
1589 TInt backsashPos = aDes.LocateF('\\'); |
|
1590 |
|
1591 if( backsashPos != KErrNotFound ) |
|
1592 { |
|
1593 HBufC* fileName = aDes.AllocL(); |
|
1594 |
|
1595 TInt count( fileName->Des().Length() ); |
|
1596 |
|
1597 for ( TInt j = backsashPos ; j < count; ++j ) |
|
1598 { |
|
1599 if ( fileName->Des()[j]== '\\' ) |
|
1600 { |
|
1601 fileName->Des()[j]='/'; |
|
1602 } |
|
1603 } |
|
1604 err = filePath.Set( fileName->Des(), NULL, NULL ); |
|
1605 |
|
1606 delete fileName; |
|
1607 } |
|
1608 } |
|
1609 |
|
1610 if ( err == KErrNone ) |
|
1611 { |
|
1612 // |
|
1613 // The requirement to support arguments with the extension in streaming links |
|
1614 // for-ex: /video.3gp?start=10&end=40 will have to supported |
|
1615 // as well. So just by doing p.Ext() would retrieve all the string |
|
1616 // after "." so by doing a Left(2) would retrieve only |
|
1617 // .3g or .rm and so on. This would help better |
|
1618 // interpret the extension and decide the branding accordingly |
|
1619 // |
|
1620 filePath.Set( filePath.NameAndExt(), NULL, NULL ); |
|
1621 TPtrC extension = filePath.Ext().Left( 2 ); |
|
1622 |
|
1623 TBuf<2> buf; |
|
1624 buf.Format( extension ); |
|
1625 buf.UpperCase(); |
|
1626 |
|
1627 // RealMedia Branding |
|
1628 if ( ! buf.Compare( KMPXRMEXT ) ) |
|
1629 { |
|
1630 realFormat = ETrue; |
|
1631 } |
|
1632 } |
|
1633 |
|
1634 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::RealFormatForStreamingL()[%d]"), realFormat); |
|
1635 |
|
1636 return realFormat; |
|
1637 } |
|
1638 |
|
1639 // ------------------------------------------------------------------------------------------------- |
|
1640 // CMPXVideoPlaybackControlsController::RealFormatForLocalL() |
|
1641 // ------------------------------------------------------------------------------------------------- |
|
1642 // |
|
1643 TBool CMPXVideoPlaybackControlsController::RealFormatForLocalL() |
|
1644 { |
|
1645 TBool realFormat = EFalse; |
|
1646 |
|
1647 _LIT(KMPXReal, "real" ); |
|
1648 _LIT(KMPXRN, "rn" ); |
|
1649 |
|
1650 if ( iFileDetails->iMimeType ) |
|
1651 { |
|
1652 iFileDetails->iMimeType->Des().LowerCase(); |
|
1653 |
|
1654 if ( iFileDetails->iMimeType->Find( KMPXReal ) >= 0 || |
|
1655 iFileDetails->iMimeType->Find( KMPXRN ) >= 0 ) |
|
1656 { |
|
1657 // |
|
1658 // RN clip and local mode, add RN logo bitmap to show while initializing |
|
1659 // |
|
1660 CreateRealOneBitmapL(); |
|
1661 SetRealOneBitmapVisibility( ETrue ); |
|
1662 realFormat = ETrue; |
|
1663 } |
|
1664 } |
|
1665 |
|
1666 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::RealFormatForLocalL() [%d]"), realFormat); |
|
1667 |
|
1668 return realFormat; |
|
1669 } |
|
1670 |
|
1671 // ------------------------------------------------------------------------------------------------- |
|
1672 // CMPXVideoPlaybackControlsController::LocateBitmapFileL() |
|
1673 // ------------------------------------------------------------------------------------------------- |
|
1674 // |
|
1675 void CMPXVideoPlaybackControlsController::LocateBitmapFileL( TFileName& aFileName ) |
|
1676 { |
|
1677 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::LocateBitmapFileL()")); |
|
1678 |
|
1679 if ( ! iBitmapFileName.Length() ) |
|
1680 { |
|
1681 TParse parse; |
|
1682 |
|
1683 // |
|
1684 // This is done to ensure upgraded file is used first. |
|
1685 // The drives from Y: to A: will be searched, then Z: last |
|
1686 // |
|
1687 TFindFile find( iFs ); |
|
1688 |
|
1689 // |
|
1690 // Search for the MBM file |
|
1691 // |
|
1692 HBufC* mbmFileName = StringLoader::LoadLC( R_MPX_VIDEO_PLAYBACK_CONTROLS_ICONS_MBM_FILE ); |
|
1693 parse.Set( mbmFileName->Des(), &KDC_APP_BITMAP_DIR, NULL ); |
|
1694 TPtrC mbmPath = parse.FullName(); |
|
1695 |
|
1696 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::LocateBitmapFileL() file %S"), &mbmPath); |
|
1697 |
|
1698 TInt error = find.FindByDir( mbmPath, KNullDesC ); |
|
1699 |
|
1700 if ( error == KErrNone ) |
|
1701 { |
|
1702 parse.Set( find.File(), NULL, NULL ); |
|
1703 } |
|
1704 else |
|
1705 { |
|
1706 // |
|
1707 // MBM file not found, search for the MIF file |
|
1708 // |
|
1709 HBufC* mifFileName = StringLoader::LoadLC( R_MPX_VIDEO_PLAYBACK_CONTROLS_ICONS_MIF_FILE ); |
|
1710 parse.Set( mifFileName->Des(), &KDC_APP_BITMAP_DIR, NULL ); |
|
1711 TPtrC mifPath = parse.FullName(); |
|
1712 CleanupStack::PopAndDestroy( mifFileName ); |
|
1713 |
|
1714 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::LocateBitmapFileL() file %S"), &mifPath); |
|
1715 |
|
1716 // |
|
1717 // If the MBM and the MIF file cannot be found, leave |
|
1718 // |
|
1719 User::LeaveIfError( find.FindByDir( mifPath, KNullDesC ) ); |
|
1720 |
|
1721 parse.Set( find.File(), NULL, NULL ); |
|
1722 } |
|
1723 |
|
1724 // |
|
1725 // File Path must be to the MBM file |
|
1726 // |
|
1727 aFileName.Append( parse.Drive() ); |
|
1728 aFileName.Append( KDC_APP_BITMAP_DIR ); |
|
1729 aFileName.Append( mbmFileName->Des() ); |
|
1730 |
|
1731 CleanupStack::PopAndDestroy( mbmFileName ); |
|
1732 |
|
1733 // |
|
1734 // Save this bitmap file name |
|
1735 // |
|
1736 iBitmapFileName = aFileName; |
|
1737 |
|
1738 } |
|
1739 else |
|
1740 { |
|
1741 aFileName.Append( iBitmapFileName ); |
|
1742 } |
|
1743 |
|
1744 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::LocateBitmapFileL(%S)"),&aFileName); |
|
1745 } |
|
1746 |
|
1747 // ------------------------------------------------------------------------------------------------- |
|
1748 // CMPXVideoPlaybackControlsController::SetDownloadSize() |
|
1749 // ------------------------------------------------------------------------------------------------- |
|
1750 // |
|
1751 void CMPXVideoPlaybackControlsController::SetDownloadSize( TInt aSize ) |
|
1752 { |
|
1753 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::SetDownloadSize() [%d]"), aSize); |
|
1754 |
|
1755 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1756 { |
|
1757 if ( iControls[i]->SetDownloadSize( aSize ) ) |
|
1758 { |
|
1759 break; |
|
1760 } |
|
1761 } |
|
1762 } |
|
1763 |
|
1764 // ------------------------------------------------------------------------------------------------- |
|
1765 // CMPXVideoPlaybackControlsController::UpdateDownloadPosition() |
|
1766 // ------------------------------------------------------------------------------------------------- |
|
1767 // |
|
1768 void CMPXVideoPlaybackControlsController::UpdateDownloadPosition( TInt aSize ) |
|
1769 { |
|
1770 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::UpdateDownloadPosition() [%d]"), aSize); |
|
1771 |
|
1772 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1773 { |
|
1774 if ( iControls[i]->UpdateDownloadPosition( aSize ) ) |
|
1775 { |
|
1776 break; |
|
1777 } |
|
1778 } |
|
1779 } |
|
1780 |
|
1781 // ------------------------------------------------------------------------------------------------- |
|
1782 // CMPXVideoPlaybackControlsController::SetRealOneBitmapVisibility() |
|
1783 // ------------------------------------------------------------------------------------------------- |
|
1784 // |
|
1785 void CMPXVideoPlaybackControlsController::SetRealOneBitmapVisibility( TBool aVisible ) |
|
1786 { |
|
1787 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::SetRealOneBitmapVisibility(%d)"), aVisible); |
|
1788 |
|
1789 if ( iRealOneBitmap ) |
|
1790 { |
|
1791 iRealOneBitmap->MakeVisible( aVisible ); |
|
1792 |
|
1793 if ( ! aVisible ) |
|
1794 { |
|
1795 // HDMI/TV-out cable connected then show the controls |
|
1796 if ( iTvOutConnected && !iShowControls ) |
|
1797 { |
|
1798 iShowControls = ETrue; |
|
1799 UpdateControlsVisibility(); |
|
1800 } |
|
1801 else |
|
1802 { |
|
1803 iShowControls = ETrue; |
|
1804 } |
|
1805 } |
|
1806 }// iRealOneBitmap |
|
1807 } |
|
1808 |
|
1809 // ------------------------------------------------------------------------------------------------- |
|
1810 // CMPXVideoPlaybackControlsController::IsRealOneBitmapVisible() |
|
1811 // ------------------------------------------------------------------------------------------------- |
|
1812 // |
|
1813 TBool CMPXVideoPlaybackControlsController::IsRealOneBitmapVisible() |
|
1814 { |
|
1815 TBool visible = EFalse; |
|
1816 |
|
1817 if ( iRealOneBitmap ) |
|
1818 { |
|
1819 visible = iRealOneBitmap->IsVisible(); |
|
1820 } |
|
1821 |
|
1822 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsRealOneBitmapVisible(%d)"), visible); |
|
1823 |
|
1824 return visible; |
|
1825 } |
|
1826 |
|
1827 // ------------------------------------------------------------------------------------------------- |
|
1828 // CMPXVideoPlaybackControlsController::HandleErrors |
|
1829 // ------------------------------------------------------------------------------------------------- |
|
1830 // |
|
1831 void CMPXVideoPlaybackControlsController::HandleErrors() |
|
1832 { |
|
1833 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HandleErrors()"), |
|
1834 _L("iState = %d"), iState ); |
|
1835 |
|
1836 switch ( iState ) |
|
1837 { |
|
1838 case EPbStateNotInitialised : |
|
1839 case EPbStateInitialising : |
|
1840 { |
|
1841 if ( iFileDetails->iPlaybackMode == EMPXVideoStreaming ) |
|
1842 { |
|
1843 StopBrandingAnimation(); |
|
1844 } |
|
1845 |
|
1846 break; |
|
1847 } |
|
1848 } |
|
1849 } |
|
1850 |
|
1851 // ------------------------------------------------------------------------------------------------- |
|
1852 // CMPXVideoPlaybackControlsController::IsSoftKeyVisible() |
|
1853 // ------------------------------------------------------------------------------------------------- |
|
1854 // |
|
1855 TBool CMPXVideoPlaybackControlsController::IsSoftKeyVisible( TInt aValue ) |
|
1856 { |
|
1857 TBool visible = EFalse; |
|
1858 TInt softKeys; |
|
1859 |
|
1860 if ( aValue == EStdKeyDevice0 ) |
|
1861 { |
|
1862 softKeys = EMPXSoftkeyDetails; |
|
1863 } |
|
1864 else//EStdKeyDevice1 |
|
1865 { |
|
1866 softKeys = EMPXSoftkeyBack; |
|
1867 } |
|
1868 |
|
1869 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1870 { |
|
1871 if ( iControls[i]->ControlIndex() == softKeys ) |
|
1872 { |
|
1873 if ( iControls[i]->IsVisible() ) |
|
1874 { |
|
1875 visible = ETrue; |
|
1876 } |
|
1877 |
|
1878 break; |
|
1879 } |
|
1880 } |
|
1881 |
|
1882 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::IsSoftKeyVisible() [%d]"), visible); |
|
1883 |
|
1884 return visible; |
|
1885 } |
|
1886 |
|
1887 // ------------------------------------------------------------------------------------------------- |
|
1888 // CMPXVideoPlaybackControlsController::HandleTvOutEventL |
|
1889 // ------------------------------------------------------------------------------------------------- |
|
1890 // |
|
1891 void CMPXVideoPlaybackControlsController::HandleTvOutEventL( |
|
1892 TBool aConnected, TMPXVideoPlaybackControlCommandIds aEvent, TBool aShowArIcon ) |
|
1893 { |
|
1894 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HandleTvOutEventL()")); |
|
1895 |
|
1896 iFileDetails->iTvOutConnected = aConnected; |
|
1897 iControlsConfig->UpdateControlListL( aEvent, aShowArIcon ); |
|
1898 ControlsListUpdatedL(); |
|
1899 |
|
1900 for ( TInt i = 0 ; i < iControls.Count() ; i++ ) |
|
1901 { |
|
1902 if ( iControls[i]->UpdateTVOutStatusL( aConnected ) ) |
|
1903 { |
|
1904 break; |
|
1905 } |
|
1906 } |
|
1907 } |
|
1908 |
|
1909 // ------------------------------------------------------------------------------------------------- |
|
1910 // CMPXVideoPlaybackControlsController::HandleSoftKeyPressedL( TInt aValue ) |
|
1911 // ------------------------------------------------------------------------------------------------- |
|
1912 // |
|
1913 void CMPXVideoPlaybackControlsController::HandleSoftKeyPressedL( TInt aValue ) |
|
1914 { |
|
1915 MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::HandleSoftKeyPressedL() [%d]"), aValue); |
|
1916 |
|
1917 if ( IsSoftKeyVisible( aValue ) ) |
|
1918 { |
|
1919 if ( aValue == EStdKeyDevice0 ) |
|
1920 { |
|
1921 iContainer->HandleCommandL( EMPXPbvCmdShowFileDetails ); |
|
1922 } |
|
1923 else//EStdKeyDevice1 |
|
1924 { |
|
1925 iContainer->HandleCommandL( EAknSoftkeyBack ); |
|
1926 } |
|
1927 } |
|
1928 else |
|
1929 { |
|
1930 ShowControls(); |
|
1931 } |
|
1932 } |
|
1933 |
|
1934 // ------------------------------------------------------------------------------------------------- |
|
1935 // CMPXVideoPlaybackControlsController::AddDllPath |
|
1936 // ------------------------------------------------------------------------------------------------- |
|
1937 // |
|
1938 TInt CMPXVideoPlaybackControlsController::AddDllPath( TDes& aFileName ) |
|
1939 { |
|
1940 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::AddDllPath()"), |
|
1941 _L("aFileName = %S"), &aFileName); |
|
1942 |
|
1943 // |
|
1944 // Find drive for dll to search same drive for rsc |
|
1945 // |
|
1946 TFileName dllName; |
|
1947 Dll::FileName( dllName ); |
|
1948 |
|
1949 TPtrC driveAndPath = TParsePtrC( dllName ).DriveAndPath(); |
|
1950 |
|
1951 TParse parse; |
|
1952 |
|
1953 TInt error = parse.Set( aFileName, &driveAndPath, NULL ); |
|
1954 |
|
1955 if ( error == KErrNone ) |
|
1956 { |
|
1957 aFileName.Zero(); |
|
1958 aFileName.Append( parse.FullName() ); |
|
1959 } |
|
1960 |
|
1961 return error; |
|
1962 } |
|
1963 |
|
1964 // ------------------------------------------------------------------------------------------------- |
|
1965 // CMPXVideoPlaybackControlsController::ShowMediaDetailsViewerL |
|
1966 // ------------------------------------------------------------------------------------------------- |
|
1967 // |
|
1968 void CMPXVideoPlaybackControlsController::ShowMediaDetailsViewerL() |
|
1969 { |
|
1970 if ( ! iMediaDetailsViewerControl ) |
|
1971 { |
|
1972 TUint properties = 0; |
|
1973 |
|
1974 CMPXVideoPlaybackMediaDetailsViewer* detailsViewer = |
|
1975 CMPXVideoPlaybackMediaDetailsViewer::NewL( this ); |
|
1976 |
|
1977 CleanupStack::PushL( detailsViewer ); |
|
1978 |
|
1979 iMediaDetailsViewerControl = CMPXVideoPlaybackControl::NewL( this, |
|
1980 detailsViewer, |
|
1981 detailsViewer->ViewerRect(), |
|
1982 EMPXMediaDetailsViewer, |
|
1983 properties ); |
|
1984 |
|
1985 CleanupStack::Pop(); // detailsViewer |
|
1986 } |
|
1987 |
|
1988 HideAllControls(); |
|
1989 iMediaDetailsViewerControl->MakeVisible(ETrue); |
|
1990 |
|
1991 } |
|
1992 |
|
1993 // ------------------------------------------------------------------------------------------------- |
|
1994 // CMPXVideoPlaybackControlsController::IsMediaDetailsViewerVisible |
|
1995 // ------------------------------------------------------------------------------------------------- |
|
1996 // |
|
1997 TBool CMPXVideoPlaybackControlsController::IsMediaDetailsViewerVisible() |
|
1998 { |
|
1999 TBool result = EFalse; |
|
2000 |
|
2001 if ( iMediaDetailsViewerControl ) |
|
2002 { |
|
2003 result = iMediaDetailsViewerControl->IsVisible(); |
|
2004 } |
|
2005 |
|
2006 return result; |
|
2007 } |
|
2008 |
|
2009 // ------------------------------------------------------------------------------------------------- |
|
2010 // CMPXVideoPlaybackControlsController::CloseMediaDetailsViewer |
|
2011 // ------------------------------------------------------------------------------------------------- |
|
2012 // |
|
2013 void CMPXVideoPlaybackControlsController::CloseMediaDetailsViewer() |
|
2014 { |
|
2015 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::CloseMediaDetailsViewer()")); |
|
2016 |
|
2017 if ( iMediaDetailsViewerControl ) |
|
2018 { |
|
2019 iMediaDetailsViewerControl->MakeVisible(EFalse); |
|
2020 delete iMediaDetailsViewerControl; |
|
2021 iMediaDetailsViewerControl = NULL; |
|
2022 } |
|
2023 } |
|
2024 |
|
2025 // ------------------------------------------------------------------------------------------------- |
|
2026 // CMPXVideoPlaybackControlsController::HandleLoadingStarted |
|
2027 // ------------------------------------------------------------------------------------------------- |
|
2028 // |
|
2029 void CMPXVideoPlaybackControlsController::HandleLoadingStarted() |
|
2030 { |
|
2031 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackControlsController::HandleLoadingStarted()")); |
|
2032 |
|
2033 if ( iState != EPbStateBuffering ) |
|
2034 { |
|
2035 iState = EPbStateBuffering; |
|
2036 UpdateStateOnButtonBar(); |
|
2037 UpdateControlsVisibility(); |
|
2038 } |
|
2039 } |
|
2040 |
|
2041 // End of File |