|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Contains an implementation of CSmilPlayerDialog class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <AknUtils.h> //for AknUtils |
|
22 #include <eikmenub.h> // for CEikMenuBar |
|
23 #include <featmgr.h> // for Feature Manager |
|
24 #include <StringLoader.h> // for StringLoader (load and format strings from resources) |
|
25 #include <aknnotewrappers.h> // for Avkon Note Wrappers |
|
26 #include <AknDef.h> // for KEikDynamicLayoutVariantSwitch |
|
27 #include <aknconsts.h> |
|
28 #include <AknStatuspaneUtils.h> // for AknStatuspaneUtils |
|
29 |
|
30 #include <aknappui.h> |
|
31 #include <aknlayoutscalable_apps.cdl.h> // for application LAF |
|
32 #include <aknlayoutscalable_avkon.cdl.h> // for AVKON LAF |
|
33 #include <data_caging_path_literals.hrh> |
|
34 |
|
35 // Find item stuff |
|
36 #include <FindItemmenu.rsg> |
|
37 #include <finditemmenu.h> |
|
38 #include <finditemdialog.h> |
|
39 #include <finditemengine.h> |
|
40 |
|
41 // Help stuff |
|
42 #include <csxhelp/mms.hlp.hrh> |
|
43 #include <hlplch.h> |
|
44 |
|
45 #include <remconcoreapitarget.h> |
|
46 #include <remconinterfaceselector.h> |
|
47 |
|
48 #include <SmilPlayer.rsg> |
|
49 #include "SmilPlayerDialog.h" |
|
50 #include "SmilPlayerPresentationController.h" |
|
51 #include "SmilPlayerPanic.h" |
|
52 |
|
53 #ifdef DIALOG_DEBUG |
|
54 #include "SMilPlayerLogging.h" |
|
55 #endif |
|
56 |
|
57 // CONSTANTS |
|
58 _LIT( KResFileName, "smilplayer.rsc"); // Resource file |
|
59 |
|
60 //used to show time control one sec longer after stop |
|
61 const TInt KStopAfterOneSecond = 1000000; |
|
62 //used to wait until 'corrupted presentation' note is shown |
|
63 const TInt KClosePlayerAfter = 0; |
|
64 |
|
65 const TUid KUidMmsEditor = {0x100058DF}; |
|
66 |
|
67 // ============================ MEMBER FUNCTIONS =============================== |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CSmilPlayerDialog::CSmilPlayerDialog |
|
71 // C++ constructor. Initializes class member variables. |
|
72 // ---------------------------------------------------------------------------- |
|
73 // |
|
74 CSmilPlayerDialog::CSmilPlayerDialog( TBool aPreview, TBool aAudioOn ) : |
|
75 iResLoader( *iCoeEnv ), |
|
76 iPresentationState( ESmilPlayerStateNotReady ) |
|
77 { |
|
78 if ( aPreview ) |
|
79 { |
|
80 iPlayerFlags |= EPreview; |
|
81 } |
|
82 if ( aAudioOn ) |
|
83 { |
|
84 iPlayerFlags |= EAudioOn; |
|
85 } |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------------------------------- |
|
89 // CSmilPlayerDialog::ConstructL |
|
90 // Symbian 2nd phase constructor. Creates only presentation controller since this |
|
91 // is the only thing that differentiates the DOM and file handle dialog construction |
|
92 // "methods". All other 2nd phase constrcution is done on CommonConstructL that should |
|
93 // be called before this function. |
|
94 // ---------------------------------------------------------------------------- |
|
95 // |
|
96 void CSmilPlayerDialog::ConstructL( const TDesC& aBaseUrl, |
|
97 MMediaFactoryFileInfo* aFileInfo, |
|
98 CMDXMLDocument* aDOM ) |
|
99 { |
|
100 #ifdef DIALOG_DEBUG |
|
101 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: ConstructL" ); |
|
102 #endif |
|
103 if ( !aDOM || !aFileInfo ) |
|
104 { |
|
105 User::Leave( KErrArgument ); |
|
106 } |
|
107 |
|
108 iPresentationController = CSmilPlayerPresentationController::NewL( PresentationRect(), |
|
109 aBaseUrl, |
|
110 aFileInfo, |
|
111 this , |
|
112 aDOM, |
|
113 AudioEnabled() ); |
|
114 #ifdef DIALOG_DEBUG |
|
115 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: ConstructL" ); |
|
116 #endif |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // CSmilPlayerDialog::ConstructL |
|
121 // Symbian 2nd phase constructor. Creates only presentation controller since this |
|
122 // is the only thing that differentiates the DOM and file handle dialog construction |
|
123 // "methods". All other 2nd phase constrcution is done on CommonConstructL that should |
|
124 // be called before this function. |
|
125 // ---------------------------------------------------------------------------- |
|
126 // |
|
127 void CSmilPlayerDialog::ConstructL( const TDesC& aBaseUrl, |
|
128 MMediaFactoryFileInfo* aFileInfo, |
|
129 RFile& aFileHandle ) |
|
130 { |
|
131 #ifdef DIALOG_DEBUG |
|
132 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: ConstructL" ); |
|
133 #endif |
|
134 if ( aFileHandle.SubSessionHandle() == KNullHandle || |
|
135 !aFileInfo ) |
|
136 { |
|
137 User::Leave( KErrBadHandle ); |
|
138 } |
|
139 |
|
140 iPresentationController = CSmilPlayerPresentationController::NewL( PresentationRect(), |
|
141 aBaseUrl, |
|
142 aFileInfo, |
|
143 this , |
|
144 aFileHandle, |
|
145 AudioEnabled() ); |
|
146 #ifdef DIALOG_DEBUG |
|
147 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: ConstructL" ); |
|
148 #endif |
|
149 } |
|
150 |
|
151 // ---------------------------------------------------------------------------- |
|
152 // CSmilPlayerDialog::CommonConstructL |
|
153 // Common 2nd phase constructor. Should be called before any ConstructL overloads |
|
154 // are called. |
|
155 // ---------------------------------------------------------------------------- |
|
156 // |
|
157 void CSmilPlayerDialog::CommonConstructL() |
|
158 { |
|
159 #ifdef DIALOG_DEBUG |
|
160 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: CommonConstructL" ); |
|
161 #endif |
|
162 |
|
163 // Load dialog's resource file |
|
164 TParse fileParse; |
|
165 fileParse.Set( KResFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
166 TFileName fileName( fileParse.FullName() ); |
|
167 iResLoader.OpenL( fileName ); |
|
168 |
|
169 // Call the base class' two-phased constructor |
|
170 CAknDialog::ConstructL( R_SMILPLAYER_MENUBAR ); |
|
171 |
|
172 iCoeEnv->AddForegroundObserverL( *this ); |
|
173 |
|
174 FeatureManager::InitializeLibL(); |
|
175 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
176 { |
|
177 iPlayerFlags |= EHelpSupported; |
|
178 } |
|
179 if ( FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ) ) |
|
180 { |
|
181 iPlayerFlags |= EFeatureSideVolumeKeys; |
|
182 } |
|
183 FeatureManager::UnInitializeLib(); |
|
184 |
|
185 iInterfaceSelector = CRemConInterfaceSelector::NewL(); |
|
186 |
|
187 // owned by iInterfaceSelector |
|
188 iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); |
|
189 |
|
190 iInterfaceSelector->OpenTargetL(); |
|
191 |
|
192 // Remote control server command repeat timer. |
|
193 iRCSTimer = CPeriodic::NewL( EPriorityNormal ); |
|
194 |
|
195 // Stop/Close timer |
|
196 iTimer = CPeriodic::NewL( EPriorityLow ); |
|
197 |
|
198 iFindItemMenu = CFindItemMenu::NewL( ESmilPlayerFindItemMenu ); |
|
199 |
|
200 #ifdef DIALOG_DEBUG |
|
201 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: CommonConstructL" ); |
|
202 #endif |
|
203 } |
|
204 |
|
205 |
|
206 // ---------------------------------------------------------------------------- |
|
207 // CSmilPlayerDialog::NewL |
|
208 // Three-phased constructor. |
|
209 // ---------------------------------------------------------------------------- |
|
210 // |
|
211 EXPORT_C CSmilPlayerDialog* CSmilPlayerDialog::NewL( CMDXMLDocument* aDOM, |
|
212 MMediaFactoryFileInfo* aFileInfo, |
|
213 const TDesC& aBaseUrl, |
|
214 TBool aPreview, |
|
215 TBool aAudioOn ) |
|
216 { |
|
217 CSmilPlayerDialog* self = new(ELeave) CSmilPlayerDialog( aPreview, aAudioOn ); |
|
218 |
|
219 CleanupStack::PushL( self ); |
|
220 self->CommonConstructL(); |
|
221 self->ConstructL( aBaseUrl, aFileInfo, aDOM ); |
|
222 CleanupStack::Pop( self ); |
|
223 |
|
224 return self; |
|
225 } |
|
226 |
|
227 // ---------------------------------------------------------------------------- |
|
228 // CSmilPlayerDialog::NewL |
|
229 // Three-phased constructor |
|
230 // ---------------------------------------------------------------------------- |
|
231 // |
|
232 EXPORT_C CSmilPlayerDialog* CSmilPlayerDialog::NewL( RFile& aFileHandle, |
|
233 MMediaFactoryFileInfo* aFileInfo, |
|
234 const TDesC& aBaseUrl, |
|
235 TBool aPreview, |
|
236 TBool aAudioOn ) |
|
237 { |
|
238 CSmilPlayerDialog* self = new(ELeave) CSmilPlayerDialog( aPreview, aAudioOn ); |
|
239 |
|
240 CleanupStack::PushL( self ); |
|
241 self->CommonConstructL(); |
|
242 self->ConstructL( aBaseUrl, aFileInfo, aFileHandle ); |
|
243 CleanupStack::Pop( self ); |
|
244 |
|
245 return self; |
|
246 } |
|
247 |
|
248 // ---------------------------------------------------------------------------- |
|
249 // CSmilPlayerDialog::~CSmilPlayerDialog |
|
250 // Destructor |
|
251 // ---------------------------------------------------------------------------- |
|
252 // |
|
253 CSmilPlayerDialog::~CSmilPlayerDialog() |
|
254 { |
|
255 if ( iAvkonAppUi && iAvkonAppUi->Cba() ) |
|
256 { |
|
257 iAvkonAppUi->Cba()->MakeVisible( ETrue ); |
|
258 } |
|
259 |
|
260 // Remove from stack |
|
261 iCoeEnv->RemoveForegroundObserver( *this ); |
|
262 |
|
263 // Unload the resourcefile |
|
264 iResLoader.Close(); |
|
265 |
|
266 delete iTimer; |
|
267 delete iRCSTimer; |
|
268 |
|
269 delete iInterfaceSelector; |
|
270 iCoreTarget = NULL; // For LINT. Owned by iInterfaceSelector |
|
271 |
|
272 delete iFindItemMenu; |
|
273 delete iPresentationController; |
|
274 } |
|
275 |
|
276 // ---------------------------------------------------------------------------- |
|
277 // CSmilPlayerDialog::ExecuteLD |
|
278 // Calls CAknDialog's ExecuteLD() with correct resourceId |
|
279 // ---------------------------------------------------------------------------- |
|
280 // |
|
281 EXPORT_C TInt CSmilPlayerDialog::ExecuteLD() |
|
282 { |
|
283 #ifdef DIALOG_DEBUG |
|
284 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: ExecuteLD" ); |
|
285 #endif |
|
286 |
|
287 return CAknDialog::ExecuteLD( R_SMILPLAYER_DIALOG ); |
|
288 } |
|
289 |
|
290 // ---------------------------------------------------------------------------- |
|
291 // CSmilPlayerDialog::PresentationStoppedL |
|
292 // Called by the presentation controller when presentation stop event is received. |
|
293 // Changes the current state to stopped.. |
|
294 // ---------------------------------------------------------------------------- |
|
295 // |
|
296 void CSmilPlayerDialog::PresentationStoppedL() |
|
297 { |
|
298 ChangeStateL( ESmilPlayerStateStop ); |
|
299 } |
|
300 |
|
301 // ---------------------------------------------------------------------------- |
|
302 // CSmilPlayerDialog::HandleGainingForeground |
|
303 // Updates the presentation to screen. |
|
304 // ---------------------------------------------------------------------------- |
|
305 // |
|
306 void CSmilPlayerDialog::HandleGainingForeground() |
|
307 { |
|
308 #ifdef DIALOG_DEBUG |
|
309 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: HandleGainingForeground" ); |
|
310 #endif |
|
311 |
|
312 if ( iPresentationController ) |
|
313 { |
|
314 iPresentationController->DrawNow(); |
|
315 } |
|
316 |
|
317 #ifdef DIALOG_DEBUG |
|
318 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: HandleGainingForeground" ); |
|
319 #endif |
|
320 } |
|
321 |
|
322 // ---------------------------------------------------------------------------- |
|
323 // CSmilPlayerDialog::HandleLosingForeground |
|
324 // Pauses the presentation if it is playing. |
|
325 // ---------------------------------------------------------------------------- |
|
326 // |
|
327 void CSmilPlayerDialog::HandleLosingForeground() |
|
328 { |
|
329 #ifdef DIALOG_DEBUG |
|
330 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: HandleLosingForeground" ); |
|
331 #endif |
|
332 |
|
333 //Check if player is playing then goes to paused |
|
334 if ( iPresentationState == ESmilPlayerStatePlaying ) |
|
335 { |
|
336 TRAP_IGNORE( ChangeStateL( ESmilPlayerStatePause ) ); |
|
337 } |
|
338 |
|
339 #ifdef DIALOG_DEBUG |
|
340 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: HandleLosingForeground" ); |
|
341 #endif |
|
342 } |
|
343 |
|
344 // ---------------------------------------------------------------------------- |
|
345 // CSmilPlayerDialog::ProcessCommandL |
|
346 // Prosesses menu commands |
|
347 // ---------------------------------------------------------------------------- |
|
348 // |
|
349 void CSmilPlayerDialog::ProcessCommandL( TInt aCommandId ) |
|
350 { |
|
351 #ifdef DIALOG_DEBUG |
|
352 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: ProcessCommandL" ); |
|
353 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: aCommandId=%d"), aCommandId ); |
|
354 #endif |
|
355 |
|
356 if ( iFindItemMenu->CommandIsValidL( aCommandId ) ) |
|
357 { |
|
358 CAknDialog::HideMenu(); |
|
359 DoFindItemL( aCommandId ); |
|
360 return; |
|
361 } |
|
362 |
|
363 switch ( aCommandId ) |
|
364 { |
|
365 case ESmilPlayerCmdOpenLink: |
|
366 { |
|
367 CAknDialog::HideMenu(); |
|
368 |
|
369 TBool internalLink( iPresentationController->AnchorIsInternalLink() ); |
|
370 |
|
371 if ( internalLink ) |
|
372 { |
|
373 // Deactivate scrolling before opening the internal link |
|
374 DeactivateScrollingL(); |
|
375 } |
|
376 |
|
377 iPresentationController->OpenLinkL(); |
|
378 |
|
379 if ( internalLink ) |
|
380 { |
|
381 // Opening an internal link pauses the presentation to speficied position, |
|
382 ChangeStateL( ESmilPlayerStatePlaying ); |
|
383 } |
|
384 |
|
385 break; |
|
386 } |
|
387 case ESmilPlayerCmdPlaySVG: |
|
388 { |
|
389 CAknDialog::HideMenu(); |
|
390 iPresentationController->ActivateFocusedL(); |
|
391 break; |
|
392 } |
|
393 case ESmilPlayerCmdActivateScroll: |
|
394 { |
|
395 if ( |
|
396 #ifdef RD_SCALABLE_UI_V2 |
|
397 (!(iPlayerFlags & EScrollingActivated)) && |
|
398 #endif |
|
399 ( iPresentationState == ESmilPlayerStatePause || |
|
400 iPresentationState == ESmilPlayerStateStop ) ) |
|
401 { |
|
402 ActivateScrollingL(); |
|
403 } |
|
404 break; |
|
405 } |
|
406 case ESmilPlayerCmdDeactivateScroll: |
|
407 { |
|
408 if ( iPresentationState == ESmilPlayerStatePause || |
|
409 iPresentationState == ESmilPlayerStateStop ) |
|
410 { |
|
411 DeactivateScrollingL(); |
|
412 } |
|
413 break; |
|
414 } |
|
415 case ESmilPlayerCmdReplay: |
|
416 { |
|
417 DoReplayL(); |
|
418 break; |
|
419 } |
|
420 case ESmilPlayerCmdPause: |
|
421 { |
|
422 ChangeStateL( ESmilPlayerStatePause ); |
|
423 break; |
|
424 } |
|
425 case ESmilPlayerCmdResume: |
|
426 { |
|
427 ChangeStateL( ESmilPlayerStatePlaying ); |
|
428 break; |
|
429 } |
|
430 case EAknCmdHelp: |
|
431 { |
|
432 LaunchHelpL(); |
|
433 break; |
|
434 } |
|
435 case EAknCmdExit: |
|
436 case EEikCmdExit: |
|
437 { |
|
438 MEikCommandObserver* commandObserver = |
|
439 static_cast<MEikCommandObserver*>( iEikonEnv->EikAppUi() ); |
|
440 commandObserver->ProcessCommandL( EAknCmdExit ); |
|
441 break; |
|
442 } |
|
443 default : |
|
444 { |
|
445 break; |
|
446 } |
|
447 } |
|
448 |
|
449 CAknDialog::ProcessCommandL( aCommandId ); |
|
450 |
|
451 #ifdef DIALOG_DEBUG |
|
452 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: ProcessCommandL" ); |
|
453 #endif |
|
454 } |
|
455 |
|
456 // ---------------------------------------------------------------------------- |
|
457 // CSmilPlayerDialog::OfferKeyEventL |
|
458 // Handles key events. This dialog handles only event keys. Uses CAknDialog as |
|
459 // a default handler. |
|
460 // ---------------------------------------------------------------------------- |
|
461 // |
|
462 TKeyResponse CSmilPlayerDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
463 TEventCode aType ) |
|
464 { |
|
465 #ifdef DIALOG_DEBUG |
|
466 SMILPLAYERLOGGER_WRITE_TIMESTAMP( " --------------------------------" ); |
|
467 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: OfferKeyEventL" ); |
|
468 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: aKeyEvent.iCode=%d"), aKeyEvent.iCode ); |
|
469 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: aType=%d"), aType ); |
|
470 #endif |
|
471 |
|
472 TKeyResponse result( EKeyWasNotConsumed ); |
|
473 |
|
474 if ( CAknDialog::MenuShowing() ) |
|
475 { |
|
476 // If a menu is showing offer key events to it. |
|
477 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
478 } |
|
479 else if ( aType == EEventKey ) |
|
480 { |
|
481 // Only interested in standard key events |
|
482 result = HandleKeyEventL( aKeyEvent, aType ); |
|
483 } |
|
484 |
|
485 if ( result == EKeyWasNotConsumed ) |
|
486 { |
|
487 // Default handler |
|
488 result = CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
489 } |
|
490 |
|
491 #ifdef DIALOG_DEBUG |
|
492 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: result=%d"), result ); |
|
493 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: OfferKeyEventL" ); |
|
494 #endif |
|
495 |
|
496 return result; |
|
497 } |
|
498 |
|
499 // ---------------------------------------------------------------------------- |
|
500 // CSmilPlayerDialog::MrccatoCommand |
|
501 // Handles side volume key events. |
|
502 // ---------------------------------------------------------------------------- |
|
503 // |
|
504 void CSmilPlayerDialog::MrccatoCommand( TRemConCoreApiOperationId aOperationId, |
|
505 TRemConCoreApiButtonAction aButtonAct ) |
|
506 { |
|
507 #ifdef DIALOG_DEBUG |
|
508 SMILPLAYERLOGGER_WRITE_TIMESTAMP( " --------------------------------" ); |
|
509 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: MrccatoCommand" ); |
|
510 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: aOperationId=%d"), aOperationId ); |
|
511 SMILPLAYERLOGGER_WRITEF( _L("[SMILPLAYER] Dialog: aButtonAct=%d"), aButtonAct ); |
|
512 #endif |
|
513 |
|
514 TRequestStatus status; |
|
515 |
|
516 switch ( aOperationId ) |
|
517 { |
|
518 case ERemConCoreApiVolumeUp: // Volume Up |
|
519 case ERemConCoreApiVolumeDown: // Volume Down |
|
520 { |
|
521 switch ( aButtonAct ) |
|
522 { |
|
523 case ERemConCoreApiButtonPress: |
|
524 { |
|
525 // This is called after system default repeat time from button press |
|
526 // if button has not been released |
|
527 if ( iPresentationController ) |
|
528 { |
|
529 iPresentationController->HandleRCSOperation( aOperationId ); |
|
530 } |
|
531 |
|
532 // Volume key pressed |
|
533 iRCSTimer->Cancel(); |
|
534 |
|
535 iRepeatId = aOperationId; |
|
536 iRCSTimer->Start( KAknStandardKeyboardRepeatRate, |
|
537 KAknStandardKeyboardRepeatRate, |
|
538 TCallBack( DoVolumeRepeat, this ) ); |
|
539 |
|
540 break; |
|
541 } |
|
542 case ERemConCoreApiButtonRelease: |
|
543 { |
|
544 // Volume key released |
|
545 iRCSTimer->Cancel(); |
|
546 break; |
|
547 } |
|
548 case ERemConCoreApiButtonClick: |
|
549 { |
|
550 // Volume key clicked |
|
551 if ( iPresentationController ) |
|
552 { |
|
553 iPresentationController->HandleRCSOperation( aOperationId ); |
|
554 } |
|
555 break; |
|
556 } |
|
557 default: |
|
558 { |
|
559 // Never hits this |
|
560 break; |
|
561 } |
|
562 } |
|
563 |
|
564 if ( aOperationId == ERemConCoreApiVolumeUp ) |
|
565 { |
|
566 iCoreTarget->VolumeUpResponse( status, KErrNone ); |
|
567 } |
|
568 else |
|
569 { |
|
570 iCoreTarget->VolumeDownResponse( status, KErrNone ); |
|
571 } |
|
572 |
|
573 User::WaitForRequest( status ); |
|
574 break; |
|
575 } |
|
576 default : |
|
577 { |
|
578 iCoreTarget->SendResponse( status, aOperationId, KErrNone ); |
|
579 |
|
580 User::WaitForRequest( status ); |
|
581 break; |
|
582 } |
|
583 } |
|
584 |
|
585 #ifdef DIALOG_DEBUG |
|
586 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: MrccatoCommand" ); |
|
587 #endif |
|
588 } |
|
589 |
|
590 // ---------------------------------------------------------------------------- |
|
591 // CSmilPlayerDialog::DynInitMenuPaneL |
|
592 // Initializes menu items |
|
593 // ---------------------------------------------------------------------------- |
|
594 // |
|
595 void CSmilPlayerDialog::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) |
|
596 { |
|
597 #ifdef DIALOG_DEBUG |
|
598 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: DynInitMenuPaneL" ); |
|
599 #endif |
|
600 |
|
601 switch ( aMenuId ) |
|
602 { |
|
603 case R_SMILPLAYER_MENU_OPTIONS: |
|
604 { |
|
605 // in pause state with left softkey "Options" |
|
606 aMenuPane->SetItemDimmed( ESmilPlayerCmdOpenLink, |
|
607 !iPresentationController->AnchorExist() ); |
|
608 aMenuPane->SetItemDimmed( ESmilPlayerCmdPlaySVG, |
|
609 !iPresentationController->IsFocused( EMsgMediaSvg ) ); |
|
610 aMenuPane->SetItemDimmed( ESmilPlayerCmdActivateScroll, |
|
611 !iPresentationController->ScrollingActivationEnabled() ); |
|
612 aMenuPane->SetItemDimmed( ESmilPlayerCmdDeactivateScroll, |
|
613 !iPresentationController->ScrollingDeactivationEnabled() ); |
|
614 aMenuPane->SetItemDimmed( ESmilPlayerCmdResume, |
|
615 iPresentationState == ESmilPlayerStateStop ); |
|
616 if ( iPresentationController->PresentationContains( EMsgMediaText ) || |
|
617 iPresentationController->PresentationContains( EMsgMediaXhtml ) ) |
|
618 { |
|
619 iFindItemMenu->DisplayFindItemMenuItemL( *aMenuPane, |
|
620 ESmilPlayerCmdReplay ); |
|
621 } |
|
622 aMenuPane->SetItemDimmed( EAknCmdHelp, !( iPlayerFlags & EHelpSupported ) ); |
|
623 break; |
|
624 } |
|
625 case R_FINDITEMMENU_MENU: |
|
626 { |
|
627 iFindItemMenu->DisplayFindItemCascadeMenuL( *aMenuPane ); |
|
628 break; |
|
629 } |
|
630 case R_SMILPLAYER_SELECT_MENUPANE_IN_PLAYING_STATE: |
|
631 { |
|
632 aMenuPane->SetItemDimmed( ESmilPlayerCmdOpenLink, |
|
633 !iPresentationController->AnchorExist() ); |
|
634 aMenuPane->SetItemDimmed( ESmilPlayerCmdActivateScroll, |
|
635 !iPresentationController->ScrollingActivationEnabled() ); |
|
636 aMenuPane->SetItemDimmed( ESmilPlayerCmdDeactivateScroll, |
|
637 !iPresentationController->ScrollingDeactivationEnabled() ); |
|
638 aMenuPane->SetItemDimmed( ESmilPlayerCmdPause, |
|
639 !iPresentationController->AnchorExist() && |
|
640 !iPresentationController->ScrollingActivationEnabled() && |
|
641 !iPresentationController->ScrollingDeactivationEnabled() ); |
|
642 break; |
|
643 } |
|
644 case R_SMILPLAYER_SELECT_MENUPANE_IN_PAUSE_STATE: |
|
645 { |
|
646 aMenuPane->SetItemDimmed( ESmilPlayerCmdOpenLink, |
|
647 !iPresentationController->AnchorExist() ); |
|
648 aMenuPane->SetItemDimmed( ESmilPlayerCmdPlaySVG, |
|
649 !iPresentationController->IsFocused( EMsgMediaSvg ) ); |
|
650 aMenuPane->SetItemDimmed( ESmilPlayerCmdActivateScroll, |
|
651 !iPresentationController->ScrollingActivationEnabled() ); |
|
652 aMenuPane->SetItemDimmed( ESmilPlayerCmdDeactivateScroll, |
|
653 !iPresentationController->ScrollingDeactivationEnabled() ); |
|
654 break; |
|
655 } |
|
656 case R_SMILPLAYER_SELECT_MENUPANE_IN_STOP_STATE: |
|
657 { |
|
658 aMenuPane->SetItemDimmed( ESmilPlayerCmdOpenLink, |
|
659 !iPresentationController->AnchorExist() ); |
|
660 aMenuPane->SetItemDimmed( ESmilPlayerCmdPlaySVG, |
|
661 !iPresentationController->IsFocused( EMsgMediaSvg ) ); |
|
662 aMenuPane->SetItemDimmed( ESmilPlayerCmdActivateScroll, |
|
663 !iPresentationController->ScrollingActivationEnabled() ); |
|
664 aMenuPane->SetItemDimmed( ESmilPlayerCmdDeactivateScroll, |
|
665 !iPresentationController->ScrollingDeactivationEnabled() ); |
|
666 break; |
|
667 } |
|
668 default: |
|
669 { |
|
670 break; |
|
671 } |
|
672 } |
|
673 |
|
674 #ifdef DIALOG_DEBUG |
|
675 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: DynInitMenuPaneL" ); |
|
676 #endif |
|
677 } |
|
678 |
|
679 // ---------------------------------------------------------------------------- |
|
680 // CSmilPlayerDialog::OkToExitL |
|
681 // Called by framework when the OK button is pressed |
|
682 // ---------------------------------------------------------------------------- |
|
683 // |
|
684 TBool CSmilPlayerDialog::OkToExitL( TInt aButtonId ) |
|
685 { |
|
686 switch ( aButtonId ) |
|
687 { |
|
688 case ESmilPlayerCmdReplay: |
|
689 case ESmilPlayerCmdPause: |
|
690 case ESmilPlayerCmdResume: |
|
691 { |
|
692 ProcessCommandL( aButtonId ); |
|
693 return EFalse; |
|
694 } |
|
695 case EEikBidOk: |
|
696 { |
|
697 return EFalse; |
|
698 } |
|
699 case EAknSoftkeyContextOptions: |
|
700 { |
|
701 HandleSelectionKeyL(); |
|
702 return EFalse; |
|
703 } |
|
704 default: |
|
705 { |
|
706 TBool value = CAknDialog::OkToExitL( aButtonId ); |
|
707 if ( value ) |
|
708 { |
|
709 //switch layout |
|
710 iPresentationController->PrepareExitL(); |
|
711 } |
|
712 return value; |
|
713 } |
|
714 } |
|
715 } |
|
716 |
|
717 // ---------------------------------------------------------------------------- |
|
718 // CSmilPlayerDialog::GetHelpContext |
|
719 // ---------------------------------------------------------------------------- |
|
720 // |
|
721 void CSmilPlayerDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
722 { |
|
723 if ( iPlayerFlags & EHelpSupported ) |
|
724 { |
|
725 aContext.iMajor = KUidMmsEditor; |
|
726 aContext.iContext = KMMS_HLP_PRESENTAT_VIEW_VIEWER; |
|
727 } |
|
728 } |
|
729 |
|
730 // ---------------------------------------------------------------------------- |
|
731 // CSmilPlayerDialog::ActivateL |
|
732 // Initializes and activates the dialog. Also updated presentation dialog layout |
|
733 // if there has been dynamic layout change during dialog construction. This is only |
|
734 // done if client application does not have "locked" orientation. |
|
735 // If there is an error on presentation controller initialization error |
|
736 // note is shown and dialog is closed. |
|
737 // ---------------------------------------------------------------------------- |
|
738 // |
|
739 void CSmilPlayerDialog::ActivateL() |
|
740 { |
|
741 #ifdef DIALOG_DEBUG |
|
742 SMILPLAYERLOGGER_ENTERFN( "[SMILPLAYER] Dialog: ActivateL" ); |
|
743 #endif |
|
744 |
|
745 iAvkonAppUi->Cba()->MakeVisible( EFalse ); |
|
746 |
|
747 if ( !AknStatuspaneUtils::StaconPaneActive() ) |
|
748 { |
|
749 ButtonGroupContainer().MakeVisible( EFalse ); |
|
750 } |
|
751 |
|
752 if ( iPresentationController->InitializeL() ) |
|
753 { |
|
754 if ( iPresentationController->Rect().Size() != PresentationRect().Size() && |
|
755 ( iAvkonAppUiBase->Orientation() == CAknAppUiBase::EAppUiOrientationAutomatic || |
|
756 iAvkonAppUiBase->Orientation() == CAknAppUiBase::EAppUiOrientationUnspecified ) ) |
|
757 { |
|
758 LayoutPresentationL(); |
|
759 } |
|
760 |
|
761 if ( iPresentationState == ESmilPlayerStateNotReady || |
|
762 iPresentationState == ESmilPlayerStateStop ) |
|
763 { |
|
764 ChangeStateL( ESmilPlayerStatePlaying ); |
|
765 } |
|
766 } |
|
767 else |
|
768 { |
|
769 ButtonGroupContainer().MakeVisible( ETrue ); |
|
770 |
|
771 ShowInformationNoteL( R_SMILPLAYER_UNSUPPORTED_PRESENTATION, ETrue ); |
|
772 |
|
773 iTimer->Cancel(); //just in case |
|
774 iTimer->Start( KClosePlayerAfter, |
|
775 KClosePlayerAfter, |
|
776 TCallBack( DoClosePlayer, this ) ); |
|
777 } |
|
778 |
|
779 #ifdef DIALOG_DEBUG |
|
780 SMILPLAYERLOGGER_LEAVEFN( "[SMILPLAYER] Dialog: ActivateL" ); |
|
781 #endif |
|
782 } |
|
783 |
|
784 // ---------------------------------------------------------------------------- |
|
785 // CSmilPlayerDialog::DoReplayL |
|
786 // Performs replay operation. Makes internal state change to stopped state and |
|
787 // then changes state to play. |
|
788 // ---------------------------------------------------------------------------- |
|
789 // |
|
790 void CSmilPlayerDialog::DoReplayL() |
|
791 { |
|
792 DeactivateScrollingL(); |
|
793 |
|
794 iPresentationState = ESmilPlayerStateNotReady; |
|
795 |
|
796 iTimer->Cancel(); |
|
797 |
|
798 iPresentationController->ChangeStateL( CSmilPlayerPresentationController::EStateStop ); |
|
799 iPresentationState = ESmilPlayerStateStop; |
|
800 |
|
801 ChangeStateL( ESmilPlayerStatePlaying ); |
|
802 } |
|
803 |
|
804 // ---------------------------------------------------------------------------- |
|
805 // CSmilPlayerDialog::ChangeStateL |
|
806 // Performs necessary steps needed for state change. |
|
807 // ---------------------------------------------------------------------------- |
|
808 // |
|
809 void CSmilPlayerDialog::ChangeStateL( TSmilPlayerPresentationStates aState ) |
|
810 { |
|
811 if ( iPresentationState == aState ) |
|
812 { |
|
813 // Prevents needless function calls |
|
814 return; |
|
815 } |
|
816 |
|
817 switch ( aState ) |
|
818 { |
|
819 case ESmilPlayerStatePlaying: |
|
820 { |
|
821 iTimer->Cancel(); |
|
822 DeactivateScrollingL(); |
|
823 |
|
824 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
825 cba.SetCommandSetL( R_SMILPLAYER_SOFTKEYS_PLAYING ); |
|
826 |
|
827 if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() ) |
|
828 { |
|
829 TInt dummy; |
|
830 iPresentationController->SwitchStatusPaneL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS, |
|
831 ETrue, |
|
832 dummy ); |
|
833 } |
|
834 |
|
835 if ( !AknStatuspaneUtils::StaconPaneActive() ) |
|
836 { |
|
837 cba.MakeVisible( EFalse ); |
|
838 } |
|
839 else |
|
840 { |
|
841 cba.MakeVisible( ETrue ); |
|
842 } |
|
843 |
|
844 iPresentationController->DrawNow(); |
|
845 |
|
846 if ( iPresentationState == ESmilPlayerStatePause ) |
|
847 { |
|
848 iPresentationState = aState; |
|
849 iPresentationController->ChangeStateL( CSmilPlayerPresentationController::EStateResume ); |
|
850 } |
|
851 else |
|
852 { |
|
853 iPresentationState = aState; |
|
854 iPresentationController->ChangeStateL( CSmilPlayerPresentationController::EStatePlay ); |
|
855 } |
|
856 |
|
857 break; |
|
858 } |
|
859 case ESmilPlayerStatePause: |
|
860 { |
|
861 iPresentationState = aState; |
|
862 iPresentationController->ChangeStateL( CSmilPlayerPresentationController::EStatePause ); |
|
863 |
|
864 if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() ) |
|
865 { |
|
866 TInt dummy; |
|
867 iPresentationController->SwitchStatusPaneL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, |
|
868 ETrue, |
|
869 dummy ); |
|
870 } |
|
871 |
|
872 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
873 |
|
874 if( iPlayerFlags & EPreview ) |
|
875 { |
|
876 cba.SetCommandSetL( R_SMILPLAYER_SOFTKEYS_PAUSE_IN_PREVIEW ); |
|
877 } |
|
878 else |
|
879 { |
|
880 cba.SetCommandSetL( R_SMILPLAYER_SOFTKEYS_PAUSE_IN_NORMAL ); |
|
881 } |
|
882 |
|
883 cba.MakeVisible( ETrue ); |
|
884 cba.DrawNow(); |
|
885 break; |
|
886 } |
|
887 case ESmilPlayerStateStop: |
|
888 { |
|
889 iPresentationState = aState; |
|
890 |
|
891 //Used to show timer one second longer, before getting back to beginning |
|
892 // of the presentation |
|
893 iTimer->Cancel(); |
|
894 iTimer->Start( KStopAfterOneSecond, |
|
895 KStopAfterOneSecond, |
|
896 TCallBack( DoStopTiming, this ) ); |
|
897 if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() ) |
|
898 { |
|
899 TInt dummy; |
|
900 iPresentationController->SwitchStatusPaneL( R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT, |
|
901 ETrue, |
|
902 dummy ); |
|
903 } |
|
904 |
|
905 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
906 if( iPlayerFlags & EPreview ) |
|
907 { |
|
908 cba.SetCommandSetL( R_SMILPLAYER_SOFTKEYS_STOP_IN_PREVIEW ); |
|
909 } |
|
910 else |
|
911 { |
|
912 cba.SetCommandSetL( R_SMILPLAYER_SOFTKEYS_STOP_IN_NORMAL ); |
|
913 } |
|
914 |
|
915 cba.MakeVisible( ETrue ); |
|
916 cba.DrawNow(); |
|
917 break; |
|
918 } |
|
919 default: |
|
920 { |
|
921 __ASSERT_DEBUG( EFalse, Panic( ESmilPlayerUnknownState ) ); |
|
922 break; |
|
923 } |
|
924 } |
|
925 } |
|
926 |
|
927 // ---------------------------------------------------------------------------- |
|
928 // CSmilPlayerDialog::DoStopTiming |
|
929 // Performs StopTiming function when timer is triggered. |
|
930 // ---------------------------------------------------------------------------- |
|
931 // |
|
932 TInt CSmilPlayerDialog::DoStopTiming( TAny* aObject ) |
|
933 { |
|
934 // cast, and call non-static function |
|
935 CSmilPlayerDialog* dialog = static_cast<CSmilPlayerDialog*>( aObject ); |
|
936 dialog->StopTiming(); |
|
937 return KErrNone; |
|
938 } |
|
939 |
|
940 // ---------------------------------------------------------------------------- |
|
941 // CSmilPlayerDialog::DoClosePlayer |
|
942 // Performs ClosePlayer function when timer is triggered. |
|
943 // ---------------------------------------------------------------------------- |
|
944 // |
|
945 TInt CSmilPlayerDialog::DoClosePlayer( TAny* aObject ) |
|
946 { |
|
947 // cast, and call non-static function |
|
948 CSmilPlayerDialog* dialog = static_cast<CSmilPlayerDialog*>( aObject ); |
|
949 dialog->ClosePlayer(); |
|
950 return KErrNone; |
|
951 } |
|
952 |
|
953 // ---------------------------------------------------------------------------- |
|
954 // CSmilPlayerDialog::DoVolumeRepeat |
|
955 // Performs ClosePlayer function when timer is triggered. |
|
956 // ---------------------------------------------------------------------------- |
|
957 // |
|
958 TInt CSmilPlayerDialog::DoVolumeRepeat( TAny* aObject ) |
|
959 { |
|
960 // cast, and call non-static function |
|
961 CSmilPlayerDialog* dialog = static_cast<CSmilPlayerDialog*>( aObject ); |
|
962 dialog->VolumeRepeat(); |
|
963 return KErrNone; |
|
964 } |
|
965 |
|
966 // ---------------------------------------------------------------------------- |
|
967 // CSmilPlayerDialog::StopTiming |
|
968 // Calls presentation controller to stop time indicator. |
|
969 // ---------------------------------------------------------------------------- |
|
970 // |
|
971 void CSmilPlayerDialog::StopTiming() |
|
972 { |
|
973 iPresentationController->StopTimer(); |
|
974 iTimer->Cancel(); |
|
975 } |
|
976 |
|
977 // ---------------------------------------------------------------------------- |
|
978 // CSmilPlayerDialog::ClosePlayer |
|
979 // Deletes dialog |
|
980 // ---------------------------------------------------------------------------- |
|
981 // |
|
982 void CSmilPlayerDialog::ClosePlayer() |
|
983 { |
|
984 delete this; |
|
985 } |
|
986 |
|
987 // ---------------------------------------------------------------------------- |
|
988 // CSmilPlayerDialog::ClosePlayer |
|
989 // Deletes dialog |
|
990 // ---------------------------------------------------------------------------- |
|
991 // |
|
992 void CSmilPlayerDialog::VolumeRepeat() |
|
993 { |
|
994 iPresentationController->HandleRCSOperation( iRepeatId ); |
|
995 } |
|
996 |
|
997 // ---------------------------------------------------------------------------- |
|
998 // CSmilPlayer::ShowInformationNoteL |
|
999 // Shows information note with specified string to the user. |
|
1000 // ---------------------------------------------------------------------------- |
|
1001 // |
|
1002 void CSmilPlayerDialog::ShowInformationNoteL( TInt aResourceID, TBool aWaiting ) |
|
1003 { |
|
1004 HBufC* string = StringLoader::LoadLC( aResourceID, iCoeEnv ); |
|
1005 |
|
1006 CAknInformationNote* note = new(ELeave) CAknInformationNote( aWaiting ); |
|
1007 note->ExecuteLD( *string ); |
|
1008 |
|
1009 CleanupStack::PopAndDestroy( string ); |
|
1010 } |
|
1011 |
|
1012 // ---------------------------------------------------------------------------- |
|
1013 // CSmilPlayerDialog::LaunchHelpL |
|
1014 // Launches help. |
|
1015 // ---------------------------------------------------------------------------- |
|
1016 // |
|
1017 void CSmilPlayerDialog::LaunchHelpL() const |
|
1018 { |
|
1019 if ( iPlayerFlags & EHelpSupported ) |
|
1020 { |
|
1021 CCoeAppUi* appUi = static_cast<CCoeAppUi*>( iCoeEnv->AppUi() ); |
|
1022 CArrayFix<TCoeHelpContext>* helpContext = appUi->AppHelpContextL(); |
|
1023 |
|
1024 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 // ---------------------------------------------------------------------------- |
|
1029 // CSmilPlayerDialog::DoFindItemL |
|
1030 // Performs find item functionality. First text buffer containing all text included |
|
1031 // on presentation so that each individual text is separated with two paragraph separators |
|
1032 // is retrieved from presentation controller. Then this text buffer is given to the |
|
1033 // find item dialog that performs find operation and shows result to user. Statuspane |
|
1034 // is changed to "normal" during find item dialog execution so that find item dialog |
|
1035 // is shown correctly. After execution returns from find item dialog statuspane is |
|
1036 // switched to the one used by SMIL player. |
|
1037 // ---------------------------------------------------------------------------- |
|
1038 // |
|
1039 void CSmilPlayerDialog::DoFindItemL( TInt aCommandId ) |
|
1040 { |
|
1041 HBufC* textBuffer = iPresentationController->PresentationTextL(); |
|
1042 if ( textBuffer ) |
|
1043 { |
|
1044 CleanupStack::PushL( textBuffer ); |
|
1045 |
|
1046 CFindItemDialog* dialog = CFindItemDialog::NewL( *textBuffer, iFindItemMenu->SearchCase( aCommandId ) ); |
|
1047 CleanupStack::PushL( dialog ); |
|
1048 |
|
1049 // Set the presentation overlap flag to true. |
|
1050 iPresentationController->SetPresentationOverlapped( ETrue ); |
|
1051 iPresentationController->SetStatusPaneVisibilityL( ETrue ); |
|
1052 LayoutOverlappedPresentation( ); |
|
1053 |
|
1054 //need to shed some player-dialog pixels from top. This unique condition |
|
1055 //occurs because dialog with usual-statuspane overlaps the player-dialog |
|
1056 //which has a widescreen-usual-flat-statuspane. |
|
1057 TRect statusPaneWindow; |
|
1058 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneWindow ); |
|
1059 TRect smilPlayerWindow = PresentationRect(); |
|
1060 smilPlayerWindow.iTl.iY = statusPaneWindow.iBr.iY; |
|
1061 iPresentationController->SetRect( smilPlayerWindow ); |
|
1062 |
|
1063 CleanupStack::Pop( dialog ); |
|
1064 |
|
1065 iAvkonAppUi->Cba()->MakeVisible( ETrue ); |
|
1066 TRAPD(error, dialog->ExecuteLD() ); |
|
1067 iAvkonAppUi->Cba()->MakeVisible( EFalse ); |
|
1068 |
|
1069 // Reset the presentation overlap flag to false. |
|
1070 iPresentationController->SetPresentationOverlapped( EFalse ); |
|
1071 iPresentationController->SetStatusPaneVisibilityL( EFalse ); |
|
1072 LayoutOverlappedPresentation( ); |
|
1073 |
|
1074 User::LeaveIfError( error ); |
|
1075 |
|
1076 CleanupStack::PopAndDestroy( textBuffer ); |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 // ---------------------------------------------------------------------------- |
|
1081 // CSmilPlayerDialog::LayoutOverlappedPresentation |
|
1082 // Sets the correct player layout, when a dialog (e.g. FindUi) |
|
1083 // is overlapping the presentation. |
|
1084 // ---------------------------------------------------------------------------- |
|
1085 // |
|
1086 void CSmilPlayerDialog::LayoutOverlappedPresentation() |
|
1087 { |
|
1088 iPresentationController->SetRect( PresentationRect() ); |
|
1089 iPresentationController->LayoutOverlappedPresentation(); |
|
1090 } |
|
1091 |
|
1092 |
|
1093 // ---------------------------------------------------------------------------- |
|
1094 // CSmilPlayerDialog::HandleResourceChange |
|
1095 // Calls LayoutPresentationL to handle dynamic layout switching. |
|
1096 // ---------------------------------------------------------------------------- |
|
1097 // |
|
1098 void CSmilPlayerDialog::HandleResourceChange( TInt aType ) |
|
1099 { |
|
1100 CAknDialog::HandleResourceChange( aType ); |
|
1101 |
|
1102 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
1103 { |
|
1104 TRAP_IGNORE( LayoutPresentationL() ); |
|
1105 } |
|
1106 } |
|
1107 |
|
1108 // ---------------------------------------------------------------------------- |
|
1109 // CSmilPlayerDialog::LayoutPresentationL |
|
1110 // Sets correct layout for the presentation controller and calls presentation |
|
1111 // control to change it's child control layouts. Also force change dialog state to |
|
1112 // stopped. |
|
1113 // ---------------------------------------------------------------------------- |
|
1114 // |
|
1115 void CSmilPlayerDialog::LayoutPresentationL() |
|
1116 { |
|
1117 iPresentationState = ESmilPlayerStateNotReady; |
|
1118 |
|
1119 iPresentationController->SetRect( PresentationRect() ); |
|
1120 |
|
1121 if ( iPresentationController->OwnStatusPaneVisible() ) |
|
1122 { |
|
1123 iPresentationController->SetStatusPaneVisibilityL( EFalse ); |
|
1124 } |
|
1125 |
|
1126 if ( iPresentationController->IsPresentationOverlapped() ) |
|
1127 { |
|
1128 // reset setups to layout the presentation correctly |
|
1129 iAvkonAppUi->Cba()->MakeVisible( EFalse ); |
|
1130 iPresentationController->SetPresentationOverlapped( EFalse ); |
|
1131 LayoutOverlappedPresentation( ); |
|
1132 // set the settings back |
|
1133 iPresentationController->SetPresentationOverlapped( ETrue ); |
|
1134 } |
|
1135 |
|
1136 iPresentationController->LayoutPresentationL(); |
|
1137 |
|
1138 if ( iPresentationController->IsPresentationOverlapped() ) |
|
1139 { |
|
1140 LayoutOverlappedPresentation( ); |
|
1141 TRect statusPaneWindow; |
|
1142 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneWindow ); |
|
1143 TRect smilPlayerWindow = PresentationRect(); |
|
1144 smilPlayerWindow.iTl.iY = statusPaneWindow.iBr.iY; |
|
1145 iPresentationController->SetRect( smilPlayerWindow ); |
|
1146 iAvkonAppUi->Cba()->MakeVisible( ETrue ); |
|
1147 } |
|
1148 |
|
1149 if ( !iPresentationController->OwnStatusPaneVisible() ) |
|
1150 { |
|
1151 iPresentationController->SetStatusPaneVisibilityL( ETrue ); |
|
1152 } |
|
1153 |
|
1154 ChangeStateL( ESmilPlayerStateStop ); |
|
1155 |
|
1156 DrawDeferred(); |
|
1157 } |
|
1158 |
|
1159 // ---------------------------------------------------------------------------- |
|
1160 // CSmilPlayerDialog::PresentationRect |
|
1161 // Calculates presentation controller rectangle according to current LAF information. |
|
1162 // ---------------------------------------------------------------------------- |
|
1163 // |
|
1164 TRect CSmilPlayerDialog::PresentationRect() const |
|
1165 { |
|
1166 TRect appWindowRect; |
|
1167 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, appWindowRect ); |
|
1168 |
|
1169 TAknLayoutRect mainPane; |
|
1170 |
|
1171 if ( CSmilPlayerPresentationController::UseWidescreenStatusPane() ) |
|
1172 { |
|
1173 // select appropriate main_pane variety based on presentation overlap flag |
|
1174 if ( iPresentationController && iPresentationController->IsPresentationOverlapped() ) |
|
1175 mainPane.LayoutRect( appWindowRect, AknLayoutScalable_Avkon::main_pane( 4 ) ); |
|
1176 else |
|
1177 mainPane.LayoutRect( appWindowRect, AknLayoutScalable_Avkon::main_pane( 22 ) ); |
|
1178 } |
|
1179 else if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
1180 { |
|
1181 mainPane.LayoutRect( appWindowRect, AknLayoutScalable_Avkon::main_pane( 4 ) ); |
|
1182 } |
|
1183 else |
|
1184 { |
|
1185 mainPane.LayoutRect( appWindowRect, AknLayoutScalable_Avkon::main_pane( 0 ) ); |
|
1186 } |
|
1187 |
|
1188 TAknLayoutRect mainSmilPane; |
|
1189 mainSmilPane.LayoutRect( mainPane.Rect(), AknLayoutScalable_Apps::main_smil_pane() ); |
|
1190 |
|
1191 return mainSmilPane.Rect(); |
|
1192 } |
|
1193 |
|
1194 // ---------------------------------------------------------------------------- |
|
1195 // CSmilPlayerDialog::DeactivateScrolling |
|
1196 // Removes scrolling flag and calls presentation control to deactivate scrolling |
|
1197 // if scrolling deactivationg is enabled. |
|
1198 // ---------------------------------------------------------------------------- |
|
1199 // |
|
1200 void CSmilPlayerDialog::DeactivateScrollingL() |
|
1201 { |
|
1202 if ( iPresentationController->ScrollingDeactivationEnabled() ) |
|
1203 { |
|
1204 iPlayerFlags &= ~EScrollingActivated; |
|
1205 iPresentationController->DeactivateScrollingL(); |
|
1206 } |
|
1207 } |
|
1208 |
|
1209 // ---------------------------------------------------------------------------- |
|
1210 // CSmilPlayerDialog::ActivateScrolling |
|
1211 // Sets scrolling flag and calls presentation control to activate scrolling. |
|
1212 // ---------------------------------------------------------------------------- |
|
1213 // |
|
1214 void CSmilPlayerDialog::ActivateScrollingL() |
|
1215 { |
|
1216 iPlayerFlags |= EScrollingActivated; |
|
1217 iPresentationController->ActivateScrollingL(); |
|
1218 } |
|
1219 |
|
1220 // ---------------------------------------------------------------------------- |
|
1221 // CSmilPlayerDialog::HandleKeyEventL |
|
1222 // Performs event key handling. Each key code is mapped to correct operation and |
|
1223 // each operation is performed on separate function. When side volume keys are |
|
1224 // present all the left/right events are consumed without volume change. |
|
1225 // ---------------------------------------------------------------------------- |
|
1226 // |
|
1227 TKeyResponse CSmilPlayerDialog::HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
1228 { |
|
1229 TKeyResponse result( EKeyWasNotConsumed ); |
|
1230 |
|
1231 switch ( aKeyEvent.iCode ) |
|
1232 { |
|
1233 case EKeyRightArrow: |
|
1234 case EKeyLeftArrow: |
|
1235 { |
|
1236 result = HandleScrollKeyL( aKeyEvent, aType ); |
|
1237 if ( result == EKeyWasNotConsumed ) |
|
1238 { |
|
1239 if ( iPlayerFlags & EFeatureSideVolumeKeys ) |
|
1240 { |
|
1241 result = EKeyWasConsumed; |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 result = HandleVolumeKeyL( aKeyEvent, aType ); |
|
1246 } |
|
1247 } |
|
1248 break; |
|
1249 } |
|
1250 case EKeyDownArrow: |
|
1251 case EKeyUpArrow: |
|
1252 { |
|
1253 result = HandleScrollKeyL( aKeyEvent, aType ); |
|
1254 break; |
|
1255 } |
|
1256 case EKeyEnter: |
|
1257 case EKeyOK: |
|
1258 { |
|
1259 result = HandleSelectionKeyL(); |
|
1260 break; |
|
1261 } |
|
1262 case EKeyApplication0: // apps key |
|
1263 { |
|
1264 // Do this already here to avoid video |
|
1265 // rendering on top of fast swap window |
|
1266 HandleLosingForeground(); |
|
1267 break; |
|
1268 } |
|
1269 default: |
|
1270 { |
|
1271 break; |
|
1272 } |
|
1273 } |
|
1274 |
|
1275 return result; |
|
1276 } |
|
1277 |
|
1278 // ---------------------------------------------------------------------------- |
|
1279 // CSmilPlayerDialog::HandleScrollKeyL |
|
1280 // Performs scrolling operation. Calls presentation controller to handle scroll |
|
1281 // key event. |
|
1282 // ---------------------------------------------------------------------------- |
|
1283 // |
|
1284 TKeyResponse CSmilPlayerDialog::HandleScrollKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
1285 { |
|
1286 return iPresentationController->HandleScrollKeyEventL( aKeyEvent, aType ); |
|
1287 } |
|
1288 |
|
1289 // ---------------------------------------------------------------------------- |
|
1290 // CSmilPlayerDialog::HandleVolumeKeyL |
|
1291 // Performs volume change operation. |
|
1292 // ---------------------------------------------------------------------------- |
|
1293 // |
|
1294 TKeyResponse CSmilPlayerDialog::HandleVolumeKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
1295 { |
|
1296 TKeyResponse result( EKeyWasNotConsumed ); |
|
1297 |
|
1298 if ( AudioEnabled() ) |
|
1299 { |
|
1300 result = iPresentationController->HandleVolumeKeyEventL( aKeyEvent, aType ); |
|
1301 } |
|
1302 |
|
1303 return result; |
|
1304 } |
|
1305 |
|
1306 // ---------------------------------------------------------------------------- |
|
1307 // CSmilPlayerDialog::HandleSelectionKeyL |
|
1308 // Performs needed operation when user has pressed selection key. |
|
1309 // ---------------------------------------------------------------------------- |
|
1310 // |
|
1311 TKeyResponse CSmilPlayerDialog::HandleSelectionKeyL() |
|
1312 { |
|
1313 TKeyResponse result( EKeyWasNotConsumed ); |
|
1314 |
|
1315 if ( iPresentationState == ESmilPlayerStatePlaying && |
|
1316 iPresentationController->ObjectFocused() ) |
|
1317 { |
|
1318 if ( iPresentationController->ScrollingActivationEnabled() ) |
|
1319 { |
|
1320 // Selection key pressed on playing state when scrollable object is focused. |
|
1321 ChangeStateL( ESmilPlayerStatePause ); |
|
1322 ActivateScrollingL(); |
|
1323 } |
|
1324 else if ( iPresentationController->AnchorExist() && |
|
1325 iPresentationController->AnchorIsInternalLink() ) |
|
1326 { |
|
1327 // Selection key pressed on playing state when internal link is focused. |
|
1328 iPresentationController->OpenLinkL(); |
|
1329 } |
|
1330 else if ( iPresentationController->IsFocused( EMsgMediaSvg ) ) |
|
1331 { |
|
1332 ChangeStateL( ESmilPlayerStatePause ); |
|
1333 iPresentationController->ActivateFocusedL(); |
|
1334 } |
|
1335 else |
|
1336 { |
|
1337 // Otherwise activate object |
|
1338 iPresentationController->ActivateFocusedMediaL(); |
|
1339 } |
|
1340 |
|
1341 result = EKeyWasConsumed; |
|
1342 } |
|
1343 else if ( iPresentationState == ESmilPlayerStatePause ) |
|
1344 { |
|
1345 // in pause state of the presentation |
|
1346 ShowMenubarL( R_SMILPLAYER_SELECT_MENUBAR_IN_PAUSE_STATE ); |
|
1347 result = EKeyWasConsumed; |
|
1348 } |
|
1349 else if ( iPresentationState == ESmilPlayerStateStop ) |
|
1350 { |
|
1351 // in stop state of the presentation |
|
1352 ShowMenubarL( R_SMILPLAYER_SELECT_MENUBAR_IN_STOP_STATE ); |
|
1353 result = EKeyWasConsumed; |
|
1354 } |
|
1355 else if ( iPresentationState == ESmilPlayerStateNotReady ) |
|
1356 { |
|
1357 result = EKeyWasConsumed; |
|
1358 } |
|
1359 |
|
1360 return result; |
|
1361 } |
|
1362 |
|
1363 // ---------------------------------------------------------------------------- |
|
1364 // CSmilPlayerDialog::ShowMenubarL |
|
1365 // Shows given menubar (i.e. context menu) to user and changes the menubar to |
|
1366 // default one after that. |
|
1367 // ---------------------------------------------------------------------------- |
|
1368 // |
|
1369 void CSmilPlayerDialog::ShowMenubarL( TInt aResourceId ) |
|
1370 { |
|
1371 iMenuBar->SetMenuTitleResourceId( aResourceId ); |
|
1372 iMenuBar->SetMenuType(CEikMenuBar::EMenuContext); |
|
1373 iMenuBar->TryDisplayMenuBarL(); |
|
1374 iMenuBar->SetMenuTitleResourceId( R_SMILPLAYER_MENUBAR ); |
|
1375 iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); |
|
1376 } |
|
1377 |
|
1378 // ---------------------------------------------------------------------------- |
|
1379 // CSmilPlayerDialog::AudioEnabled |
|
1380 // ---------------------------------------------------------------------------- |
|
1381 TBool CSmilPlayerDialog::AudioEnabled() const |
|
1382 { |
|
1383 return iPlayerFlags & EAudioOn; |
|
1384 } |
|
1385 |
|
1386 // ---------------------------------------------------------------------------- |
|
1387 // CSmilPlayerDialog::PlayTappedL |
|
1388 // ---------------------------------------------------------------------------- |
|
1389 void CSmilPlayerDialog::PlayTappedL() |
|
1390 { |
|
1391 #ifdef RD_SCALABLE_UI_V2 |
|
1392 ChangeStateL( ESmilPlayerStatePlaying ); |
|
1393 #endif |
|
1394 } |
|
1395 |
|
1396 // ---------------------------------------------------------------------------- |
|
1397 // CSmilPlayerDialog::PauseTappedL |
|
1398 // ---------------------------------------------------------------------------- |
|
1399 void CSmilPlayerDialog::PauseTappedL() |
|
1400 { |
|
1401 #ifdef RD_SCALABLE_UI_V2 |
|
1402 ChangeStateL( ESmilPlayerStatePause ); |
|
1403 #endif |
|
1404 } |
|
1405 |
|
1406 |
|
1407 // End of File |