1 /* |
|
2 * Copyright (c) 2004,2005 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: This file implements the SVGT Dialog which |
|
15 * is used to display SVGT content |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
20 #include <uikon/eikctrlstatus.h> |
|
21 #endif |
|
22 |
|
23 #include <e32std.h> |
|
24 #include <AknDialog.h> |
|
25 #include <coeaui.h> |
|
26 #include <eikenv.h> |
|
27 #include <bautils.h> |
|
28 #include <eikdialg.h> |
|
29 #include <eikmenup.h> |
|
30 #include <eikspane.h> |
|
31 |
|
32 #ifdef __SERIES60_HELP |
|
33 #include <hlplch.h> |
|
34 #endif // __SERIES60_HELP |
|
35 |
|
36 #include <coeaui.h> |
|
37 #include <aknnavi.h> |
|
38 #include <aknnavide.h> |
|
39 #include <AknWaitNoteWrapper.h> |
|
40 #include <SVGRequestObserver.h> |
|
41 #include <aknnotewrappers.h> |
|
42 #include <akntitle.h> |
|
43 #include <data_caging_path_literals.hrh> |
|
44 #include <StringLoader.h> |
|
45 #include <svgtuicontrol.rsg> |
|
46 #include <csxhelp/svgt.hlp.hrh> |
|
47 //----------- |
|
48 |
|
49 // User Includes |
|
50 #include "SVGTAppObserver.h" |
|
51 #include "SVGTCustControl.h" |
|
52 #include "SVGTUIDialog.h" |
|
53 #include "svgtfileviewdetails.h" |
|
54 |
|
55 #include "SVGTUIDialog.hrh" |
|
56 #include "SvgtDecoratorControl.h" |
|
57 |
|
58 const TInt KButtonContainerDisplayTime = 5000000; |
|
59 |
|
60 // Constants |
|
61 |
|
62 // The Middle softkey has position 3 at button group's stack |
|
63 const TInt KMiddleSKId=3; |
|
64 _LIT( KResourceFileName, "Z:SVGTUIControl.rsc" ); |
|
65 #ifdef _DEBUG |
|
66 //_LIT( KUnknownCommandStr, "Unknown Command" ); |
|
67 #endif |
|
68 |
|
69 #ifdef __SERIES60_HELP |
|
70 // Help Context UID = DLL UID3 |
|
71 const TUid KSvgtHelpContextUid = { 0x101F8749 }; |
|
72 #endif // __SERIES60_HELP |
|
73 |
|
74 // Times longer than this many seconds are shown using the long format |
|
75 const TInt KShortTimeLimit = 59*60 + 59; |
|
76 |
|
77 // Maximum number of seconds shown in the time duration field |
|
78 const TInt KMaxTotalTimeSeconds = 9*60*60 + 59*60 + 59; // 59:59 |
|
79 |
|
80 // Maximum length for both the time elapsed/remaining string "mm:ss/mm:ss" |
|
81 // and post-recording text "Length: mm:ss" |
|
82 const TInt KMaxTimeTextLength = 40; |
|
83 |
|
84 // This many microseconds in a second |
|
85 const TInt KMicro = 1000000; |
|
86 |
|
87 // Key Constant for toggling between Full/Normal Screen |
|
88 const TInt KSvgScreenToggleKey = '*'; |
|
89 // ============================ MEMBER FUNCTIONS =============================== |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CSVGTUIDialog::CSVGTUIDialog |
|
93 // Default Constructor. Initialises Dialog State Variables. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CSVGTUIDialog::CSVGTUIDialog() |
|
97 { |
|
98 // SVGT Viewer State Variables |
|
99 iSaveEnable = EFalse; |
|
100 iPreview = EFalse; |
|
101 iCustControl = NULL; |
|
102 iAppObserver = NULL; |
|
103 iIsVolumeMuted = EFalse; |
|
104 iLastCommandID = EAknSoftkeyOptions; |
|
105 iIsButtonContainerVisible = ETrue; |
|
106 iQuietExitWhenOrientationChange = EFalse; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CSVGTUIDialog::ConstructL |
|
111 // Second Phase Constructor for CSVGTUIDialog. Opens resource file, reads the |
|
112 // dialog menu resource and calls CAknDialog::ConstructL with the resource as |
|
113 // param. |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void CSVGTUIDialog::ConstructL() |
|
117 { |
|
118 // Find which drive this DLL is installed. |
|
119 TFileName fileName; |
|
120 |
|
121 // Get the full resource file |
|
122 TParse lParse; |
|
123 |
|
124 // Add the resource dir |
|
125 lParse.Set( KResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
126 |
|
127 // Get the filename with full path |
|
128 fileName = lParse.FullName(); |
|
129 |
|
130 BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), fileName ); //for |
|
131 // localization |
|
132 iResourceOffset = iEikonEnv->AddResourceFileL( fileName ); |
|
133 |
|
134 // Read time format strings from AVKON resource |
|
135 iTimeFormatShort = |
|
136 iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO ); |
|
137 iTimeFormatLong = |
|
138 iEikonEnv->AllocReadResourceL( R_QTN_TIME_DURAT_LONG ); |
|
139 |
|
140 iBtnCntrTimer = CPeriodic::NewL( CActive::EPriorityStandard); |
|
141 CAknDialog::ConstructL( R_SVGT_DIALOG_MENUBAR ); |
|
142 |
|
143 } |
|
144 |
|
145 // ----------------------------------------------------------------------------- |
|
146 // CSVGTUIDialog::NewL |
|
147 // Factory function for creating CSVGTUIDialog objects. |
|
148 // Returns: CSVGTUIDialog* ; Pointer to the created object. |
|
149 // Leaves if error occurs during creation. |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 EXPORT_C CSVGTUIDialog* CSVGTUIDialog::NewL() |
|
153 { |
|
154 CSVGTUIDialog* self = CSVGTUIDialog::NewLC(); |
|
155 CleanupStack::Pop( self ); |
|
156 return self; |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CSVGTUIDialog::NewLC |
|
161 // Factory function for creating CSVGTUIDialog objects. It also pushes the |
|
162 // created dialog object onto the cleanup stack. |
|
163 // Returns: CSVGTUIDialog* ; Pointer to the created object. |
|
164 // Leaves if error occurs during creation. |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C CSVGTUIDialog* CSVGTUIDialog::NewLC() |
|
168 { |
|
169 CSVGTUIDialog* self = new ( ELeave ) CSVGTUIDialog(); |
|
170 CleanupStack::PushL( self ); |
|
171 self->ConstructL(); |
|
172 return self; |
|
173 } |
|
174 |
|
175 // Destructor |
|
176 CSVGTUIDialog::~CSVGTUIDialog() |
|
177 { |
|
178 if ( iResourceOffset != 0 ) |
|
179 { |
|
180 iEikonEnv->DeleteResourceFile( iResourceOffset ); |
|
181 } |
|
182 // Custom Control will be automatically destroyed by dialog framework |
|
183 iCustControl = NULL; |
|
184 // App Observer is reset. |
|
185 iAppObserver = NULL; |
|
186 |
|
187 // Set the text in status pane to the stored one |
|
188 if (iAppTitleText) |
|
189 { |
|
190 // Get the Status Pane Control |
|
191 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
192 // Get the title pane |
|
193 CAknTitlePane* tp = NULL; |
|
194 TRAPD( errGetControl, |
|
195 tp = static_cast< CAknTitlePane* >( sp->ControlL( |
|
196 TUid::Uid( EEikStatusPaneUidTitle ) ) ) ); |
|
197 if ( errGetControl == KErrNone && tp ) |
|
198 { |
|
199 //set application name in the title pane |
|
200 TRAPD( errSetText, |
|
201 tp->SetTextL(*iAppTitleText) ); |
|
202 if ( errSetText != KErrNone ) |
|
203 { |
|
204 // No error handling here |
|
205 } |
|
206 } |
|
207 |
|
208 delete iAppTitleText; |
|
209 iAppTitleText = NULL; |
|
210 |
|
211 delete iProgressText; |
|
212 iProgressText = NULL; |
|
213 } |
|
214 |
|
215 // Clear the Navi-Pane Decorator |
|
216 if ( iNaviDecorator ) |
|
217 { |
|
218 // Restore the old navi-pane |
|
219 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
220 |
|
221 CAknNavigationControlContainer* np = NULL; |
|
222 TRAPD( errGetNaviControl, |
|
223 np = static_cast< CAknNavigationControlContainer* > |
|
224 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ) ); |
|
225 if ( errGetNaviControl == KErrNone && np ) |
|
226 { |
|
227 TRAPD( errPushDefNaviControl, |
|
228 np->PushDefaultL ()); // Set default. |
|
229 if ( errPushDefNaviControl != KErrNone ) |
|
230 { |
|
231 // No error handling here. |
|
232 } |
|
233 } |
|
234 delete iNaviDecorator; |
|
235 } |
|
236 iCbaGroup=NULL; |
|
237 // Callers responsibility of closing the file handle. |
|
238 iFileHandlePtr = NULL; |
|
239 // Delete the format strings |
|
240 delete iTimeFormatShort; |
|
241 delete iTimeFormatLong; |
|
242 |
|
243 delete iBtnCntrTimer; |
|
244 } |
|
245 |
|
246 TInt CSVGTUIDialog::ButtonContainerTimerCallBack(TAny* aAny) |
|
247 { |
|
248 CSVGTUIDialog* dlg = (CSVGTUIDialog*)(aAny); |
|
249 dlg->iBtnCntrTimer->Cancel(); |
|
250 dlg->iIsButtonContainerVisible = EFalse; |
|
251 TRAP_IGNORE(dlg->SwitchDialogLayoutL( ETrue )); |
|
252 |
|
253 return KErrNone; |
|
254 } |
|
255 |
|
256 TBool CSVGTUIDialog::HandleCustControlPointerEventL(const TPointerEvent& /* aPointerEvent */) |
|
257 { |
|
258 TBool fullScreenStatus; |
|
259 TBool isEventHandled = EFalse; |
|
260 TCallBack callBack(CSVGTUIDialog::ButtonContainerTimerCallBack, this); |
|
261 |
|
262 iBtnCntrTimer->Cancel(); |
|
263 |
|
264 if(iIsButtonContainerVisible) |
|
265 { |
|
266 return isEventHandled; |
|
267 } |
|
268 |
|
269 iCustControl->GetCurrentFullScreenStatus(fullScreenStatus); |
|
270 if(fullScreenStatus) |
|
271 { |
|
272 TRect appRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
|
273 |
|
274 if(iBtnGrpPos.iX && iBtnGrpPos.iY) |
|
275 SetSize(TSize(appRect.Width() - iBtnGrpSize.iWidth, appRect.Height() - iBtnGrpSize.iHeight)); |
|
276 if(iBtnGrpPos.iX) |
|
277 SetSize(TSize(appRect.Width() - iBtnGrpSize.iWidth, appRect.Height())); |
|
278 else if(iBtnGrpPos.iY) |
|
279 SetSize(TSize(appRect.Width(), appRect.Height() - iBtnGrpSize.iHeight)); |
|
280 |
|
281 CEikButtonGroupContainer& bgc = ButtonGroupContainer(); |
|
282 //bgc.MakeVisible(ETrue); |
|
283 //bgc.SetSize(iBtnGrpSize); |
|
284 //bgc.SetExtent(iBtnGrpPos, iBtnGrpSize); |
|
285 //bgc.DrawDeferred(); |
|
286 iIsButtonContainerVisible = ETrue; |
|
287 isEventHandled = ETrue; |
|
288 iBtnCntrTimer->Start(KButtonContainerDisplayTime, 0, callBack); |
|
289 } |
|
290 |
|
291 return isEventHandled; |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CSVGTUIDialog::ExecuteLD |
|
296 // Reimplements CAknDialog::ExecuteLD. It initialises the member variables of |
|
297 // the class and calls CAknDialog::ExecuteLD() with the dialog resource. |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 TInt CSVGTUIDialog::ExecuteLD( |
|
301 RFile& aFileHandle, // Filename of SVGT Content |
|
302 MSvgtAppObserver* ptr ) // Applications Implementation of callbacks |
|
303 { |
|
304 // Save this pointer since there are leaving functions in the flow |
|
305 CleanupStack::PushL( this ); |
|
306 |
|
307 iFileHandlePtr = &aFileHandle; |
|
308 iIsFileHandleValid = ETrue; |
|
309 iAppObserver = ptr; |
|
310 iQuietExitWhenOrientationChange = iAppObserver->ExitWhenOrientationChange(); |
|
311 |
|
312 // Get the Status Pane Control |
|
313 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
314 |
|
315 // Get the Title Pane Control |
|
316 CAknTitlePane* tp = static_cast< CAknTitlePane* >( sp->ControlL( |
|
317 TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
318 |
|
319 // Store the Application's title text |
|
320 iAppTitleText = HBufC::NewL(tp->Text()->Length()); |
|
321 *iAppTitleText = *tp->Text(); |
|
322 |
|
323 // Display the filename in the title pane of application |
|
324 |
|
325 TFileName lFileName; |
|
326 // Get the file name from the file handle |
|
327 if ( !aFileHandle.Name( lFileName ) ) |
|
328 { |
|
329 TParse p; |
|
330 p.Set( lFileName, NULL, NULL); |
|
331 |
|
332 // SetTextL also ensures that if the length exceeds the layout space |
|
333 // available the text is truncated from the end. |
|
334 tp->SetTextL( p.NameAndExt() ); // p.NameAndExt() gives "Filename.ext" |
|
335 |
|
336 } |
|
337 |
|
338 CSVGTDrmHelper *drmHelper = CSVGTDrmHelper::NewLC(); |
|
339 // Check if the "Save" Option should be shown or not. |
|
340 // The calling application of the dialog decides this. |
|
341 if ( iAppObserver ) |
|
342 { |
|
343 iSaveEnable = iAppObserver->CanShowSave(); |
|
344 } |
|
345 |
|
346 // Check Rights Status |
|
347 iPreview = drmHelper->IsPreviewL( aFileHandle ); |
|
348 |
|
349 CleanupStack::PopAndDestroy( drmHelper ); |
|
350 |
|
351 // ExecuteLD will delete this, so we have to Pop it... |
|
352 CleanupStack::Pop( this ); |
|
353 |
|
354 if ( iPreview ) |
|
355 { |
|
356 return CAknDialog::ExecuteLD( R_SVGT_VIEWER_PREVIEW_DIALOG ); |
|
357 } |
|
358 else |
|
359 { |
|
360 return CAknDialog::ExecuteLD( R_SVGT_VIEWER_DIALOG ); |
|
361 } |
|
362 |
|
363 } |
|
364 |
|
365 // ----------------------------------------------------------------------------- |
|
366 // CSVGTUIDialog::FormatTimeL |
|
367 // Convert a time given in seconds to a descriptor. |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 void CSVGTUIDialog::FormatTimeL( |
|
371 const TUint& aDuration, // duration in |
|
372 // seconds |
|
373 TDes& aBuf // Buffer holding formatted |
|
374 // string |
|
375 ) const |
|
376 |
|
377 { |
|
378 TTime time( TInt64( aDuration ) * KMicro ); |
|
379 |
|
380 if ( time.Int64() > TInt64( KMaxTotalTimeSeconds ) * KMicro ) |
|
381 { |
|
382 time = TInt64( KMaxTotalTimeSeconds ) * KMicro; |
|
383 } |
|
384 |
|
385 if ( time.Int64() < TInt64( KShortTimeLimit ) * KMicro ) |
|
386 { |
|
387 time.FormatL( aBuf, *iTimeFormatShort ); |
|
388 } |
|
389 else |
|
390 { |
|
391 time.FormatL( aBuf, *iTimeFormatLong ); |
|
392 } |
|
393 |
|
394 // Arabic number conversion |
|
395 AknTextUtils::LanguageSpecificNumberConversion( aBuf ); |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // CSVGTUIDialog::SaveNeededL |
|
400 // This function checks if Save is displayed and saving is already done |
|
401 // and prompts a confirmation query to the user and then calls DoSaveL |
|
402 // ----------------------------------------------------------------------------- |
|
403 // |
|
404 TBool CSVGTUIDialog::SaveNeededL( TInt aButtonId ) |
|
405 { |
|
406 if ( ( iAppObserver->CanShowSave() || |
|
407 iCustControl->IsTextContentChanged()) && |
|
408 !iAppObserver->IsSavingDone() && |
|
409 !iPreview && |
|
410 LaunchSaveQueryDialogL() ) |
|
411 { |
|
412 iAppObserver->DoSaveL( aButtonId ); |
|
413 return ETrue; |
|
414 } |
|
415 else |
|
416 { |
|
417 return EFalse; |
|
418 } |
|
419 } |
|
420 // ----------------------------------------------------------------------------- |
|
421 // CSVGTUIDialog::LaunchSaveQueryDialogL |
|
422 // ----------------------------------------------------------------------------- |
|
423 // |
|
424 TBool CSVGTUIDialog::LaunchSaveQueryDialogL() const |
|
425 { |
|
426 HBufC* titleText = NULL; |
|
427 |
|
428 TFileName lFileName; |
|
429 if ( iFileHandlePtr ) |
|
430 { |
|
431 iFileHandlePtr->Name( lFileName ); |
|
432 } |
|
433 else |
|
434 { |
|
435 return EFalse; |
|
436 } |
|
437 titleText = StringLoader::LoadLC( R_QTN_SVGT_QUERY_CONF_SAVE_DOWNLOADED, |
|
438 lFileName ); |
|
439 |
|
440 CAknQueryDialog* query = CAknQueryDialog::NewL( ); |
|
441 TBool retVal = query->ExecuteLD( R_SVGT_CONFIRMATION_QUERY_YES_NO, |
|
442 *titleText ); |
|
443 CleanupStack::PopAndDestroy( titleText ); |
|
444 |
|
445 if ( retVal == EAknSoftkeyOk || retVal == EAknSoftkeyYes ) |
|
446 { |
|
447 return ETrue; |
|
448 } |
|
449 return EFalse; |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CSVGTUIDialog::SwitchDialogLayoutL |
|
454 // This function changes the layout of the dialog |
|
455 // ----------------------------------------------------------------------------- |
|
456 // |
|
457 void CSVGTUIDialog::SwitchDialogLayoutL( TBool aIsFullScreen ) |
|
458 { |
|
459 if ( aIsFullScreen ) |
|
460 { |
|
461 // Full Screen Mode |
|
462 // Expand Dialog Window to occupy full screen |
|
463 SetExtentToWholeScreen(); |
|
464 // Hide the Status Pane |
|
465 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
466 sp->MakeVisible( EFalse ); |
|
467 |
|
468 // Hide the CBA |
|
469 CEikButtonGroupContainer* cp = &( ButtonGroupContainer() ); |
|
470 //cp->SetExtent( TPoint( 0, 0 ), TSize( 0, 0) ); |
|
471 cp->SetSize( TSize( 0, 0) ); |
|
472 |
|
473 } |
|
474 else |
|
475 { |
|
476 // Normal Screen Mode |
|
477 // Show the Status Pane |
|
478 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
479 sp->MakeVisible( ETrue ); |
|
480 |
|
481 // Restore the size and position of the dialog |
|
482 // to normal screen size(Client Rectangle) |
|
483 TRect lRect; |
|
484 iCustControl->GetNormalScreenLayoutRect( lRect ); |
|
485 SetSizeAndPosition( lRect.Size() ); |
|
486 // Restore original layout |
|
487 Layout(); |
|
488 iBtnCntrTimer->Cancel(); |
|
489 } |
|
490 |
|
491 iIsButtonContainerVisible = !aIsFullScreen; |
|
492 |
|
493 } |
|
494 |
|
495 // ----------------------------------------------------------------------------- |
|
496 // CSVGTUIDialog::DynInitMenuPaneL |
|
497 // Reimplements CAknDialog::DynInitMenuPaneL inorder to support dynamic hiding |
|
498 // of menu items based on current state of the viewer. |
|
499 // ----------------------------------------------------------------------------- |
|
500 // |
|
501 void CSVGTUIDialog::DynInitMenuPaneL( |
|
502 TInt aResourceId, // Resource Id for which this func is called |
|
503 CEikMenuPane* aMenuPane ) // Menupane object pointer for manipulation |
|
504 { |
|
505 iBtnCntrTimer->Cancel(); |
|
506 |
|
507 if( |
|
508 (aResourceId==R_SVGT_DIALOG_MENU) |
|
509 &&iCustControl->GetMSKLabelFlag(EAknSoftkeyContextOptions) |
|
510 &&(aMenuPane) |
|
511 ) |
|
512 { |
|
513 iCustControl->ChangeMSKLabelFlag(EAknSoftkeyContextOptions); |
|
514 if ( iAppObserver ) |
|
515 { |
|
516 iSaveEnable = iAppObserver->CanShowSave(); |
|
517 } |
|
518 aMenuPane->SetItemDimmed(ESvgtDlgSaveCommand, |
|
519 !( iSaveEnable|| |
|
520 iCustControl->IsTextContentChanged() ) ); |
|
521 |
|
522 TSvgtViewerAnimStatus lAnimState; |
|
523 iCustControl->GetCurrentAnimState( lAnimState ); |
|
524 TBool isLoadingDone = iCustControl->IsProcessDone(); |
|
525 aMenuPane->SetItemDimmed(ESvgtDlgPlayCommand, |
|
526 !isLoadingDone || |
|
527 (lAnimState == ESvgAnimPlayingState )); |
|
528 aMenuPane->SetItemDimmed(ESvgtDlgPauseCommand, |
|
529 !isLoadingDone || |
|
530 (lAnimState != ESvgAnimPlayingState )); |
|
531 aMenuPane->SetItemDimmed(ESvgtDlgStopCommand, |
|
532 !isLoadingDone || |
|
533 (lAnimState ==ESvgAnimStoppedState)); |
|
534 |
|
535 |
|
536 //All the other menu items are dimmed since they are not the part of |
|
537 // context menu |
|
538 aMenuPane->SetItemDimmed(ESvgtDlgZoomInCommand,ETrue); |
|
539 aMenuPane->SetItemDimmed(ESvgtDlgZoomOutCommand,ETrue); |
|
540 aMenuPane->SetItemDimmed(ESvgtDlgSelectTextCommand,ETrue); |
|
541 aMenuPane->SetItemDimmed(ESvgtDlgEditTextCommand,ETrue); |
|
542 aMenuPane->SetItemDimmed(ESvgtDlgLoopCascadeCommand,ETrue); |
|
543 aMenuPane->SetItemDimmed(ESvgtDlgFindTextCommand,ETrue); |
|
544 aMenuPane->SetItemDimmed(ESvgtDlgFullScreenCommand,ETrue); |
|
545 aMenuPane->SetItemDimmed(ESvgtDlgNormalScreenCommand,ETrue); |
|
546 aMenuPane->SetItemDimmed(ESvgtDlgListRotateCascadeCommand,ETrue); |
|
547 aMenuPane->SetItemDimmed(ESvgtDlgViewDetailsCommand,ETrue); |
|
548 aMenuPane->SetItemDimmed(ESvgtDlgListDownloadCommand,ETrue); |
|
549 aMenuPane->SetItemDimmed(ESvgtDlgHelpCommand,ETrue); |
|
550 aMenuPane->SetItemDimmed(EAknCmdExit,ETrue); |
|
551 #ifdef RD_SVGT_AUDIO_SUPPORT |
|
552 aMenuPane->SetItemDimmed( ESvgtDlgMuteCommand,ETrue); |
|
553 aMenuPane->SetItemDimmed( ESvgtDlgUnmuteCommand,ETrue); |
|
554 aMenuPane->SetItemDimmed(ESvgtDlgSetVolumeCommand,ETrue); |
|
555 #endif //RD_SVGT_AUDIO_SUPPORT |
|
556 } |
|
557 |
|
558 else if ( ( aResourceId == R_SVGT_DIALOG_MENU ) && ( aMenuPane ) ) |
|
559 { |
|
560 if ( iAppObserver ) |
|
561 { |
|
562 iSaveEnable = iAppObserver->CanShowSave(); |
|
563 } |
|
564 aMenuPane->SetItemDimmed( |
|
565 ESvgtDlgSaveCommand, |
|
566 !( iSaveEnable || |
|
567 iCustControl->IsTextContentChanged() ) ); |
|
568 TInt zoomLvl = 0; |
|
569 iCustControl->GetCurrentZoomLevel( zoomLvl ); |
|
570 aMenuPane->SetItemDimmed( |
|
571 ESvgtDlgZoomOutCommand, |
|
572 ( zoomLvl == 0 ) ); |
|
573 |
|
574 // Select Text Option |
|
575 aMenuPane->SetItemDimmed( ESvgtDlgSelectTextCommand, |
|
576 !iCustControl->IsTextSelectOn() ); |
|
577 |
|
578 // Edit Text Option |
|
579 aMenuPane->SetItemDimmed( ESvgtDlgEditTextCommand, |
|
580 !iCustControl->IsTextEditOn() ); |
|
581 |
|
582 if ( !iCustControl->IsAnimationPresent() ) |
|
583 { |
|
584 // No Animations case - dim the Play/Pause/Stop buttons |
|
585 aMenuPane->SetItemDimmed( |
|
586 ESvgtDlgPlayCommand, |
|
587 ETrue ); |
|
588 |
|
589 aMenuPane->SetItemDimmed( |
|
590 ESvgtDlgPauseCommand, |
|
591 ETrue ); |
|
592 |
|
593 aMenuPane->SetItemDimmed( |
|
594 ESvgtDlgStopCommand, |
|
595 ETrue ); |
|
596 aMenuPane->SetItemDimmed( |
|
597 ESvgtDlgLoopCascadeCommand, |
|
598 ETrue ); |
|
599 } |
|
600 else |
|
601 { |
|
602 // Animations case - normal behaviour |
|
603 // Play/Pause Options |
|
604 TSvgtViewerAnimStatus lAnimState; |
|
605 iCustControl->GetCurrentAnimState( lAnimState ); |
|
606 TBool isLoadingDone = iCustControl->IsProcessDone(); |
|
607 |
|
608 aMenuPane->SetItemDimmed( |
|
609 ESvgtDlgPlayCommand, |
|
610 !isLoadingDone || |
|
611 ( lAnimState == ESvgAnimPlayingState ) ); |
|
612 |
|
613 aMenuPane->SetItemDimmed( |
|
614 ESvgtDlgPauseCommand, |
|
615 !isLoadingDone || |
|
616 ( lAnimState != ESvgAnimPlayingState ) ); |
|
617 |
|
618 aMenuPane->SetItemDimmed( |
|
619 ESvgtDlgStopCommand, |
|
620 !isLoadingDone || |
|
621 ( lAnimState == ESvgAnimStoppedState ) ); |
|
622 // Loop Option |
|
623 aMenuPane->SetItemDimmed( |
|
624 ESvgtDlgLoopCascadeCommand, |
|
625 !isLoadingDone || |
|
626 !iCustControl->IsLoopAllowed() ); |
|
627 } |
|
628 #ifdef RD_SVGT_AUDIO_SUPPORT |
|
629 aMenuPane->SetItemDimmed( ESvgtDlgMuteCommand, iIsVolumeMuted ); |
|
630 |
|
631 aMenuPane->SetItemDimmed( ESvgtDlgUnmuteCommand, !iIsVolumeMuted ); |
|
632 #endif //RD_SVGT_AUDIO_SUPPORT |
|
633 TBool isFullScreenOn; |
|
634 iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); |
|
635 aMenuPane->SetItemDimmed( |
|
636 ESvgtDlgFullScreenCommand, |
|
637 isFullScreenOn ); |
|
638 |
|
639 aMenuPane->SetItemDimmed( |
|
640 ESvgtDlgNormalScreenCommand, |
|
641 !isFullScreenOn ); |
|
642 |
|
643 aMenuPane->SetItemDimmed( |
|
644 ESvgtDlgFindTextCommand, |
|
645 EFalse ); |
|
646 |
|
647 aMenuPane->SetItemDimmed( |
|
648 ESvgtDlgViewDetailsCommand, |
|
649 !iIsFileHandleValid); |
|
650 aMenuPane->SetItemDimmed( |
|
651 ESvgtDlgListDownloadCommand, |
|
652 !iAppObserver->CanShowDownload() ); |
|
653 } |
|
654 else |
|
655 { |
|
656 if ( ( aResourceId == R_SVGT_LOOP_SUBMENU ) && ( aMenuPane ) ) |
|
657 { |
|
658 // Loop On/Off Submenu option |
|
659 TBool isLoopOn = ETrue; |
|
660 iCustControl->GetCurrentLoopStatus( isLoopOn ); |
|
661 if ( isLoopOn ) |
|
662 { |
|
663 aMenuPane->SetItemButtonState( ESvgtDlgLoopOnCommand, |
|
664 EEikMenuItemSymbolOn ); |
|
665 aMenuPane->SetItemButtonState( ESvgtDlgLoopOffCommand, |
|
666 EEikMenuItemSymbolIndeterminate ); |
|
667 } |
|
668 else |
|
669 { |
|
670 aMenuPane->SetItemButtonState( ESvgtDlgLoopOffCommand, |
|
671 EEikMenuItemSymbolOn ); |
|
672 aMenuPane->SetItemButtonState( ESvgtDlgLoopOnCommand, |
|
673 EEikMenuItemSymbolIndeterminate ); |
|
674 } |
|
675 } |
|
676 } |
|
677 } |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CSVGTUIDialog::DrawMSKLabelL |
|
680 // Reimplements MSVGTMSKImplL::DrawMSKLabelL.This function is called by the |
|
681 // CSVGTCustControl whenever MSK label needs to be updated. |
|
682 // ----------------------------------------------------------------------------- |
|
683 // |
|
684 void CSVGTUIDialog::DrawMSKLabelL(TInt aResourceID,TInt aCommandID) |
|
685 { |
|
686 iLastCommandID = aCommandID; |
|
687 iCbaGroup= &( ButtonGroupContainer() ); |
|
688 HBufC* middleSKText = StringLoader::LoadLC(aResourceID ); |
|
689 iCbaGroup->AddCommandToStackL(KMiddleSKId, aCommandID,*middleSKText ); |
|
690 iCbaGroup->MakeCommandVisible(aCommandID, ETrue); |
|
691 CleanupStack::PopAndDestroy( middleSKText ); |
|
692 iCbaGroup->DrawDeferred(); |
|
693 } |
|
694 |
|
695 // ---------------------------------------------------------------------------- |
|
696 // CSVGTUIDialog::RemoveMSKLabel |
|
697 // Reimplements MSVGTMSKImplL::RemoveMSKLabel.This function is called by the |
|
698 // CSVGTCustControl before adding new MSK label to button group stack. |
|
699 // ---------------------------------------------------------------------------- |
|
700 // |
|
701 void CSVGTUIDialog::RemoveMSKLabel() |
|
702 { |
|
703 iCbaGroup= &( ButtonGroupContainer() ); |
|
704 MEikButtonGroup* lButtonGroup=iCbaGroup->ButtonGroup(); |
|
705 TInt lCmdID=lButtonGroup->CommandId(KMiddleSKId); |
|
706 iCbaGroup->RemoveCommandFromStack(KMiddleSKId,lCmdID); |
|
707 iCbaGroup->DrawDeferred(); |
|
708 |
|
709 } |
|
710 |
|
711 // ----------------------------------------------------------------------------- |
|
712 // CSVGTUIDialog::OkToExitL |
|
713 // Reimplements CAknDialog::OkToExitL inorder to display custom menu and |
|
714 // trap the back softkey to provide restore view functionality/exit. |
|
715 // ----------------------------------------------------------------------------- |
|
716 // |
|
717 TBool CSVGTUIDialog::OkToExitL( TInt aButtonId ) // ButtonId of button pressed |
|
718 { |
|
719 if ( aButtonId == EAknSoftkeyOptions ) |
|
720 { |
|
721 DisplayMenuL(); |
|
722 return EFalse; |
|
723 } |
|
724 else if(aButtonId==EAknSoftkeyContextOptions) |
|
725 { |
|
726 //Flag to differentiate context menu from normal options menu |
|
727 iCustControl->ChangeMSKLabelFlag(aButtonId); |
|
728 |
|
729 //Display context menu |
|
730 iMenuBar->SetContextMenuTitleResourceId( R_SVGT_DIALOG_MENUBAR ); |
|
731 iMenuBar-> TryDisplayContextMenuBarL(); |
|
732 |
|
733 //No task swapper for context menu |
|
734 iMenuBar->SetMenuType(CEikMenuBar::EMenuOptionsNoTaskSwapper); |
|
735 |
|
736 //Restore the options menu |
|
737 iMenuBar->SetMenuTitleResourceId( R_SVGT_DIALOG_MENUBAR ); |
|
738 iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); |
|
739 |
|
740 return EFalse; |
|
741 } |
|
742 else if(aButtonId ==EAknSoftkeySave) |
|
743 { |
|
744 //Save the content |
|
745 ProcessCommandL(ESvgtDlgSaveCommand); |
|
746 return EFalse; |
|
747 } |
|
748 |
|
749 else |
|
750 { |
|
751 if ( aButtonId == EAknSoftkeyBack ) |
|
752 { |
|
753 // Check whether full screen is active |
|
754 TBool isFullScreenActive; |
|
755 iCustControl->GetCurrentFullScreenStatus( isFullScreenActive ); |
|
756 |
|
757 if ( isFullScreenActive ) |
|
758 { |
|
759 // Yes[FullScreen]: revert back to normal screen |
|
760 ProcessCommandL( ESvgtDlgNormalScreenCommand ); |
|
761 return EFalse; |
|
762 } |
|
763 |
|
764 // Check whether content is zoomed in |
|
765 TInt zoomLvl = 0; |
|
766 iCustControl->GetCurrentZoomLevel( zoomLvl ); |
|
767 |
|
768 if ( zoomLvl > 0 ) |
|
769 { |
|
770 // Yes[ZoomedIn]: restore to original view |
|
771 iCustControl->ProcessViewerCommandL( |
|
772 ESvgtDlgZoomOptimalCommand ); |
|
773 return EFalse; |
|
774 } |
|
775 return !SaveNeededL( aButtonId ); |
|
776 } |
|
777 else |
|
778 { |
|
779 // Ignore Select Key.. |
|
780 if ( aButtonId == EAknSoftkeySelect || aButtonId == EEikBidOk ) |
|
781 { |
|
782 //If animation on mousedown/mouseup is present trigger it |
|
783 if(iCustControl->GetMSKLabelFlag(aButtonId)) |
|
784 { |
|
785 TKeyEvent lKeyEvent; |
|
786 lKeyEvent.iScanCode=EStdKeyDevice3; |
|
787 iCustControl->OfferKeyEventL(lKeyEvent,EEventKey); |
|
788 iCustControl->ChangeMSKLabelFlag(aButtonId); |
|
789 TRAP_IGNORE(iCustControl->SetMSKLabelL()); |
|
790 } |
|
791 |
|
792 |
|
793 |
|
794 // Select button pressed, ignore. |
|
795 return EFalse; |
|
796 } |
|
797 if ( aButtonId == EEikCmdExit ) |
|
798 { |
|
799 return !SaveNeededL( aButtonId ); |
|
800 } |
|
801 } |
|
802 |
|
803 } |
|
804 |
|
805 return ETrue; |
|
806 } |
|
807 |
|
808 |
|
809 // ----------------------------------------------------------------------------- |
|
810 // CSVGTUIDialog::IsLoadingDone |
|
811 // This function is called by the application to check whether the |
|
812 // loading of the svg content is done. |
|
813 // ----------------------------------------------------------------------------- |
|
814 // |
|
815 TBool CSVGTUIDialog::IsLoadingDone() |
|
816 { |
|
817 return iCustControl->IsProcessDone(); |
|
818 } |
|
819 |
|
820 // ----------------------------------------------------------------------------- |
|
821 // CSVGTUIDialog::HandleApplicationForegroundEvent |
|
822 // This API is used by the application to give background/foreground events |
|
823 // to the Dialog. The dialog inturn passes the events to custom control. |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 void CSVGTUIDialog::HandleApplicationForegroundEvent( TBool aForeground ) |
|
827 { |
|
828 if ( iCustControl ) |
|
829 { |
|
830 iCustControl->HandleApplicationForegroundEvent( aForeground ); |
|
831 } |
|
832 } |
|
833 |
|
834 // ----------------------------------------------------------------------------- |
|
835 // CSVGTUIDialog::StopUsingContentFileHandle |
|
836 // ----------------------------------------------------------------------------- |
|
837 // |
|
838 void CSVGTUIDialog::StopUsingContentFileHandle() |
|
839 { |
|
840 // NOTE: Currently the custom control and the engine are |
|
841 // not actively using the File handle. e.g. Engine uses |
|
842 // the file handle only during loading of content. And custom |
|
843 // control uses it when File Details are shown. |
|
844 // If required, in future need to pass this event to custom control. |
|
845 // Block the filedetails option now. |
|
846 iIsFileHandleValid = EFalse; |
|
847 } |
|
848 |
|
849 // ----------------------------------------------------------------------------- |
|
850 // CSVGTUIDialog::StartUsingContentFileHandle |
|
851 // ----------------------------------------------------------------------------- |
|
852 // |
|
853 void CSVGTUIDialog::StartUsingContentFileHandle() |
|
854 { |
|
855 iIsFileHandleValid = ETrue; |
|
856 } |
|
857 |
|
858 // ----------------------------------------------------------------------------- |
|
859 // CSVGTUIDialog::IsTextContentChanged |
|
860 // Function used by the client to check if text in the content was modified, |
|
861 // to check if save is needed. |
|
862 // ----------------------------------------------------------------------------- |
|
863 // |
|
864 TBool CSVGTUIDialog::IsTextContentChanged() |
|
865 { |
|
866 return (iCustControl->IsTextContentChanged()); |
|
867 } |
|
868 |
|
869 // ----------------------------------------------------------------------------- |
|
870 // CSVGTUIDialog::SaveSvgDom |
|
871 // Function used by the client to save the modified svg content |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 TInt CSVGTUIDialog::SaveSvgDom( const TDesC& aFileName ) |
|
875 { |
|
876 if ( iCustControl ) |
|
877 { |
|
878 return ( iCustControl->SaveSvgDom( aFileName ) ); |
|
879 } |
|
880 else |
|
881 { |
|
882 return KErrGeneral; |
|
883 } |
|
884 } |
|
885 |
|
886 // ----------------------------------------------------------------------------- |
|
887 // CSVGTUIDialog::SaveComplete |
|
888 // Function used by the client to indicate saving is complete |
|
889 // ----------------------------------------------------------------------------- |
|
890 // |
|
891 void CSVGTUIDialog::SaveComplete( const TInt aError ) |
|
892 { |
|
893 if ( !aError ) |
|
894 { |
|
895 // Indicate to Custom Control to perform any cleanup |
|
896 // once save is complete |
|
897 iCustControl->SaveComplete( aError ); |
|
898 } |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // CSVGTUIDialog::ProcessCommandL |
|
903 // Reimplements CAknDialog::ProcessCommandL inorder to handle dialog menu |
|
904 // commands. |
|
905 // ----------------------------------------------------------------------------- |
|
906 // |
|
907 void CSVGTUIDialog::ProcessCommandL( TInt aCommandId ) // Command Id |
|
908 { |
|
909 // The Commands are handled by the custom CCoe Control and |
|
910 // a boolean varialble is used inorder to keep track whether |
|
911 // the control command processing needs to be invoked or not. |
|
912 TBool procCmdReqd = ETrue; |
|
913 CAknDialog::ProcessCommandL( aCommandId ); |
|
914 switch ( aCommandId ) |
|
915 { |
|
916 case ESvgtDlgSaveCommand: |
|
917 if ( iAppObserver ) |
|
918 { |
|
919 iAppObserver->DoSaveL( ESvgtDlgCommand1 ); |
|
920 } |
|
921 break; |
|
922 case ESvgtDlgHelpCommand: |
|
923 #ifdef __SERIES60_HELP |
|
924 procCmdReqd = EFalse; |
|
925 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
926 iEikonEnv->EikAppUi()->AppHelpContextL() ); |
|
927 #endif // __SERIES60_HELP |
|
928 break; |
|
929 case ESvgtDlgFindTextCommand: |
|
930 break; |
|
931 case ESvgtDlgViewDetailsCommand: |
|
932 break; |
|
933 case ESvgtDlgListDownloadCommand: |
|
934 { |
|
935 if ( iAppObserver ) |
|
936 { |
|
937 iAppObserver->DisplayDownloadMenuL(); |
|
938 } |
|
939 break; |
|
940 } |
|
941 case ESvgtDlgFullScreenCommand: |
|
942 { |
|
943 if ( iCustControl ) |
|
944 { |
|
945 iCustControl->SetCurrentFullScreenStatus( ETrue ); |
|
946 SwitchDialogLayoutL( ETrue ); // ETrue = Full Screen Mode |
|
947 // Redraw Status Pane and CBA by doing a draw on dialog |
|
948 DrawNow(); |
|
949 } |
|
950 break; |
|
951 } |
|
952 case ESvgtDlgNormalScreenCommand: |
|
953 { |
|
954 if ( iCustControl ) |
|
955 { |
|
956 iCustControl->SetCurrentFullScreenStatus( EFalse ); |
|
957 SwitchDialogLayoutL( EFalse ); // EFalse = Normal Screen Mode |
|
958 // Redraw Status Pane and CBA by doing a draw on dialog |
|
959 DrawNow(); |
|
960 } |
|
961 break; |
|
962 } |
|
963 //@@ Touch support |
|
964 #ifdef RD_SVGT_AUDIO_SUPPORT |
|
965 case ESvgtDlgMuteCommand: |
|
966 iIsVolumeMuted = !iIsVolumeMuted; |
|
967 iCustControl->SetPresentationVolume(0); |
|
968 |
|
969 if(iCustControl->IsContentFinite()) |
|
970 SetNaviPaneInfoL(iIsVolumeMuted, *iProgressText); |
|
971 else |
|
972 SetNaviPaneInfoL(iIsVolumeMuted, KNullDesC); |
|
973 break; |
|
974 |
|
975 case ESvgtDlgUnmuteCommand: |
|
976 iIsVolumeMuted = !iIsVolumeMuted; |
|
977 // Set the volume level to the value it was before muting |
|
978 iCustControl->SetPresentationVolume(iCustControl->GetPrevVolume()); |
|
979 |
|
980 if(iCustControl->IsContentFinite()) |
|
981 SetNaviPaneInfoL(iIsVolumeMuted, *iProgressText); |
|
982 else |
|
983 SetNaviPaneInfoL(iIsVolumeMuted, KNullDesC); |
|
984 break; |
|
985 case ESvgtDlgSetVolumeCommand: // Fall Through |
|
986 #endif //RD_SVGT_AUDIO_SUPPORT |
|
987 //@@ Touch support |
|
988 case ESvgtDlgLoopOnCommand: // Fall Through |
|
989 case ESvgtDlgLoopOffCommand: // Fall Through |
|
990 case ESvgtDlgPlayCommand: // Fall Through |
|
991 case ESvgtDlgPauseCommand: // Fall Through |
|
992 case ESvgtDlgStopCommand: // Fall Through |
|
993 case ESvgtDlgZoomInCommand: // Fall Through |
|
994 case ESvgtDlgZoomOutCommand: // Fall Through |
|
995 case ESvgtDlgAngle90: // Fall Through |
|
996 case ESvgtDlgAngle180: // Fall Through |
|
997 case ESvgtDlgAngle270: // Fall Through |
|
998 case ESvgtDlgSelectTextCommand: // Fall Through |
|
999 case ESvgtDlgEditTextCommand: // Fall Through |
|
1000 break; |
|
1001 case EAknSoftkeyBack: // Fall Through |
|
1002 case EEikCmdExit: |
|
1003 // Close this dialog |
|
1004 procCmdReqd = EFalse; // No Further Processing required. |
|
1005 TryExitL( aCommandId ); |
|
1006 break; |
|
1007 case EAknCmdExit: |
|
1008 // Close this dialog |
|
1009 procCmdReqd = EFalse; // No Further Processing required. |
|
1010 if ( !SaveNeededL( aCommandId ) ) |
|
1011 { |
|
1012 TryExitL( aCommandId ); |
|
1013 iAvkonAppUi->ProcessCommandL( EAknCmdExit ); |
|
1014 } |
|
1015 break; |
|
1016 default: |
|
1017 procCmdReqd = EFalse; |
|
1018 break; |
|
1019 } |
|
1020 // If custom control has been created and control needs |
|
1021 // to process the command invoke the control's ProcessViewerCommandL() |
|
1022 // function |
|
1023 if ( procCmdReqd && iCustControl ) |
|
1024 { |
|
1025 iCustControl->ProcessViewerCommandL( aCommandId ); |
|
1026 } |
|
1027 } |
|
1028 |
|
1029 // ----------------------------------------------------------------------------- |
|
1030 // CSVGTUIDialog::CreateCustomControlL |
|
1031 // Reimplements CAknDialog::CreateCustomControlL inorder to add the SVGT |
|
1032 // custom control as part of the dialog in the UI framework. |
|
1033 // Returns: SEikControlInfo which contains the SVGT Cust Control, if |
|
1034 // aControlType == ESVGTCustControl |
|
1035 // else, |
|
1036 // the structure does not contain any control. |
|
1037 // ----------------------------------------------------------------------------- |
|
1038 // |
|
1039 SEikControlInfo CSVGTUIDialog::CreateCustomControlL( |
|
1040 TInt aControlType ) // Control Type |
|
1041 { |
|
1042 SEikControlInfo controlInfo; |
|
1043 controlInfo.iControl = NULL; |
|
1044 controlInfo.iTrailerTextId = 0; |
|
1045 controlInfo.iFlags = EEikControlHasEars;//EEikControlIsNonFocusing; |
|
1046 |
|
1047 switch ( aControlType ) |
|
1048 { |
|
1049 case ESVGTCustControl: |
|
1050 iCustControl = CSVGTCustControl::NewL( |
|
1051 *iFileHandlePtr, |
|
1052 iAppObserver, |
|
1053 this, |
|
1054 this, |
|
1055 this, |
|
1056 ETrue, // Progressive rendering enabled. |
|
1057 // To enable it pass ETrue |
|
1058 // otherwise EFalse. |
|
1059 NULL, |
|
1060 ESvgDisplayIcons| |
|
1061 ESvgDrawPanIndicator| |
|
1062 ESvgDrawPointer | |
|
1063 ESvgDisplayErrorNotes | |
|
1064 ESvgDrawPauseIndicator | |
|
1065 ESvgUseBackLight |
|
1066 ); |
|
1067 iCustControl->AddListener(this,EAudioListener); |
|
1068 controlInfo.iControl = iCustControl; |
|
1069 controlInfo.iControl->SetContainerWindowL(*this); |
|
1070 iCustControl->SetPointerObserver(this); |
|
1071 break; |
|
1072 default: |
|
1073 return CAknDialog::CreateCustomControlL(aControlType); |
|
1074 } |
|
1075 return controlInfo; |
|
1076 } |
|
1077 |
|
1078 |
|
1079 // ----------------------------------------------------------------------------- |
|
1080 // CSVGTUIDialog::SizeChanged |
|
1081 // Reimplements CAknDialog::SizeChanged inorder to support the resize of the |
|
1082 // dialog when functions such as SetRect, SetExtent are called on the dialog. |
|
1083 // ----------------------------------------------------------------------------- |
|
1084 // |
|
1085 void CSVGTUIDialog::SizeChanged() |
|
1086 { |
|
1087 CAknDialog::SizeChanged(); |
|
1088 iCustControl->SetExtent( Rect().iTl, Rect().Size() ); |
|
1089 AknLayoutUtils::LayoutMetricsPosition(AknLayoutUtils::EControlPane, iBtnGrpPos); |
|
1090 AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EControlPane, iBtnGrpSize); |
|
1091 DrawNow(); |
|
1092 } |
|
1093 |
|
1094 // ----------------------------------------------------------------------------- |
|
1095 // CSVGTUIDialog::OfferKeyEventL |
|
1096 // Handles Key events by reimplementing CCoeControl::OfferKeyEventL. |
|
1097 // Returns: |
|
1098 // EKeyWasConsumed: If this control uses this key. |
|
1099 // EKeyWasNotConsumed: Otherwise. |
|
1100 // ----------------------------------------------------------------------------- |
|
1101 // |
|
1102 TKeyResponse CSVGTUIDialog::OfferKeyEventL( |
|
1103 const TKeyEvent& aKeyEvent, // Key Event |
|
1104 TEventCode aType) // Event Code |
|
1105 { |
|
1106 if ( iCustControl ) |
|
1107 { |
|
1108 if ( aType == EEventKey ) |
|
1109 { |
|
1110 if ( aKeyEvent.iScanCode == EStdKeyEnter ) |
|
1111 { |
|
1112 TryExitL( iLastCommandID ); |
|
1113 |
|
1114 return iCustControl->OfferKeyEventL( aKeyEvent, aType ); |
|
1115 } |
|
1116 |
|
1117 if ( aKeyEvent.iCode == KSvgScreenToggleKey && |
|
1118 aKeyEvent.iRepeats == 0 ) // Ignore Repeat Events |
|
1119 { |
|
1120 // Screen Mode Change Handling |
|
1121 TBool isFullScreenOn; |
|
1122 iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); |
|
1123 if ( isFullScreenOn ) |
|
1124 { |
|
1125 // Toggle to Normal Screen |
|
1126 ProcessCommandL( ESvgtDlgNormalScreenCommand ); |
|
1127 } |
|
1128 else |
|
1129 { |
|
1130 // Toggle to Full Screen |
|
1131 ProcessCommandL( ESvgtDlgFullScreenCommand ); |
|
1132 } |
|
1133 // No further processing required. |
|
1134 return EKeyWasConsumed; |
|
1135 } |
|
1136 } |
|
1137 // Pass the key to the custom control |
|
1138 TKeyResponse lCcRetVal = iCustControl->OfferKeyEventL( aKeyEvent, |
|
1139 aType ); |
|
1140 if ( lCcRetVal == EKeyWasConsumed ) |
|
1141 { |
|
1142 return EKeyWasConsumed; |
|
1143 } |
|
1144 } |
|
1145 return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); |
|
1146 } |
|
1147 |
|
1148 #ifdef __SERIES60_HELP |
|
1149 // ----------------------------------------------------------------------------- |
|
1150 // CSVGTUIDialog::OfferKeyEventL |
|
1151 // Handles Key events by reimplementing CCoeControl::OfferKeyEventL. |
|
1152 // Returns: |
|
1153 // EKeyWasConsumed: If this control uses this key. |
|
1154 // EKeyWasNotConsumed: Otherwise. |
|
1155 // ----------------------------------------------------------------------------- |
|
1156 // |
|
1157 void CSVGTUIDialog::GetHelpContext( TCoeHelpContext& aContext ) const |
|
1158 { |
|
1159 aContext.iMajor = KSvgtHelpContextUid; |
|
1160 aContext.iContext = KSVGT_HLP_VIEWER; |
|
1161 } |
|
1162 #endif // __SERIES60_HELP |
|
1163 |
|
1164 // ----------------------------------------------------------------------------- |
|
1165 // CSVGTUIDialog::HandleResourceChange |
|
1166 // Handles change of skin/Layout |
|
1167 // ----------------------------------------------------------------------------- |
|
1168 // |
|
1169 void CSVGTUIDialog::HandleResourceChange( TInt aType ) |
|
1170 { |
|
1171 CAknDialog::HandleResourceChange( aType ); |
|
1172 |
|
1173 |
|
1174 if ( aType == KAknsMessageSkinChange ) |
|
1175 { |
|
1176 // No skin related action performed. |
|
1177 } |
|
1178 else if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
1179 { |
|
1180 |
|
1181 if( iQuietExitWhenOrientationChange ) |
|
1182 { |
|
1183 TryExitL( EAknCmdExit ); |
|
1184 return; |
|
1185 } |
|
1186 |
|
1187 if ( iCustControl ) |
|
1188 { |
|
1189 TBool isFullScreenOn; |
|
1190 // Check whether the custom control is using full-screen or |
|
1191 // normal screen |
|
1192 iCustControl->GetCurrentFullScreenStatus( isFullScreenOn ); |
|
1193 // Change the layout to reflect layout switch |
|
1194 TRAP_IGNORE( SwitchDialogLayoutL( isFullScreenOn ) ); |
|
1195 } |
|
1196 |
|
1197 // If it is a Layout switch, need to do a redraw |
|
1198 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
1199 { |
|
1200 // Redraw the dialog |
|
1201 DrawDeferred(); |
|
1202 } |
|
1203 |
|
1204 } |
|
1205 |
|
1206 } |
|
1207 // ----------------------------------------------------------------------------- |
|
1208 // CSVGTUIDialog::DrawProgressBarL |
|
1209 // This function updates the progress bar in the navi pane. It is called back |
|
1210 // by the custom control. |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // |
|
1213 void CSVGTUIDialog::DrawProgressBarL( TUint aTimeElapsed, // Time Elapsed in |
|
1214 // Seconds |
|
1215 TUint aTimeTotal ) // Total time in seconds |
|
1216 { |
|
1217 |
|
1218 TBuf<KMaxTimeTextLength> timeElapsedBuf; // Time Elapsed, e.g. "00:12" |
|
1219 TBuf<KMaxTimeTextLength> totalTimeBuf; // Total duration, e.g. "00:55" |
|
1220 |
|
1221 // Format the time to user readable format. The format is locale dependent |
|
1222 FormatTimeL( aTimeElapsed, timeElapsedBuf ); |
|
1223 FormatTimeL( aTimeTotal, totalTimeBuf ); |
|
1224 |
|
1225 // Format label text based on resource |
|
1226 CDesCArrayFlat* strings = new (ELeave) CDesCArrayFlat( 2 ); // Allocate 2 |
|
1227 // strings for |
|
1228 // elapsed time |
|
1229 // and total |
|
1230 // time strings |
|
1231 CleanupStack::PushL( strings ); |
|
1232 strings->AppendL( timeElapsedBuf ); |
|
1233 strings->AppendL( totalTimeBuf ); |
|
1234 |
|
1235 delete iProgressText; |
|
1236 iProgressText = NULL; |
|
1237 iProgressText = StringLoader::LoadL( R_QTN_SVGT_TIME_INDIC, |
|
1238 *strings, |
|
1239 iEikonEnv ); |
|
1240 // Destroy the array of strings |
|
1241 CleanupStack::PopAndDestroy( strings ); |
|
1242 |
|
1243 SetNaviPaneInfoL( iIsVolumeMuted, *iProgressText); |
|
1244 } |
|
1245 |
|
1246 void CSVGTUIDialog::HandleApplicationExitL( TInt aExitCommand ) |
|
1247 { |
|
1248 if((aExitCommand == EAknSoftkeyBack) || ( aExitCommand == EEikCmdExit)) |
|
1249 { |
|
1250 this->TryExitL(aExitCommand); |
|
1251 } |
|
1252 else |
|
1253 { |
|
1254 User::LeaveIfError(KErrArgument); |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 EXPORT_C void CSVGTUIDialog::AssignImageData( const TDesC& aUri, HBufC8* aData ) |
|
1259 { |
|
1260 iCustControl->AssignImageData(aUri, aData); |
|
1261 } |
|
1262 |
|
1263 // ----------------------------------------------------------------------------- |
|
1264 // CSVGTUIDialog::SetNaviPaneInfoL |
|
1265 // Sets the mute icon & text to the navi pane. |
|
1266 // ----------------------------------------------------------------------------- |
|
1267 void CSVGTUIDialog::SetNaviPaneInfoL(TBool aIsVolumeMuted, const TDesC& aText) |
|
1268 { |
|
1269 CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); |
|
1270 CAknNavigationControlContainer* np = |
|
1271 static_cast<CAknNavigationControlContainer*> |
|
1272 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
1273 // Save the old Navi Decorator so that it can be deleted after |
|
1274 // creating the new navi decorator |
|
1275 CAknNavigationDecorator* lOldNaviDecorator = iNaviDecorator; |
|
1276 |
|
1277 iNaviDecorator = NULL; |
|
1278 |
|
1279 CSvgtDecoratorControl* decoControl = new (ELeave) CSvgtDecoratorControl; |
|
1280 CleanupStack::PushL(decoControl); |
|
1281 decoControl->ConstructL(); |
|
1282 decoControl->ShowVolumeMutedIcon(aIsVolumeMuted); |
|
1283 decoControl->SetTextL(aText); |
|
1284 iNaviDecorator = CAknNavigationDecorator::NewL(np, decoControl); |
|
1285 iNaviDecorator->SetContainerWindowL(*this); |
|
1286 CleanupStack::Pop(decoControl); |
|
1287 |
|
1288 // Clear the old Navi-Pane Decorator |
|
1289 if ( lOldNaviDecorator ) |
|
1290 { |
|
1291 delete lOldNaviDecorator ; |
|
1292 lOldNaviDecorator = NULL; |
|
1293 } |
|
1294 // Push the new Navi decorator in the Navigation Pane |
|
1295 np->PushL( *iNaviDecorator ); |
|
1296 } |
|
1297 |
|
1298 void CSVGTUIDialog::VolumeMuted(TBool aVolumeMuted) |
|
1299 { |
|
1300 if(iCustControl->IsContentFinite()) |
|
1301 { |
|
1302 TRAP_IGNORE( SetNaviPaneInfoL(aVolumeMuted, *iProgressText)); |
|
1303 } |
|
1304 else |
|
1305 { |
|
1306 TRAP_IGNORE(SetNaviPaneInfoL(aVolumeMuted, KNullDesC)); |
|
1307 } |
|
1308 iIsVolumeMuted = aVolumeMuted; |
|
1309 } |
|
1310 // End of File |
|