|
1 /* |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of fULL-SCREEN view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // Avkon and System Headers |
|
22 #include <eikbtgpc.h> // CEikButtonGroupContainer |
|
23 #include <aknViewAppUi.h> |
|
24 #include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR |
|
25 #include <glxcollectionpluginimageviewer.hrh> |
|
26 #include <StringLoader.h> // String Loader |
|
27 |
|
28 // Alf Headers |
|
29 #include <alf/ialfwidgetfactory.h> // widget factory |
|
30 #include <alf/alfwidgetcontrol.h> // To get CAlfControl from CAlfWidgetControl |
|
31 #include <alf/ialfviewwidget.h> // View Widget |
|
32 #include <alf/alfwidgetenvextension.h> // Widget Env Extensions to create view widget |
|
33 #include <alf/alfutil.h> // AlfUtil |
|
34 |
|
35 // Antariksh Headers |
|
36 #include <mul/mulevent.h> |
|
37 #include <mul/imulcoverflowwidget.h> // Coverflow widget |
|
38 #include <mul/imulsliderwidget.h> // For Slider Widget |
|
39 #include <mpxcollectionpath.h> |
|
40 |
|
41 #include <gesturehelper.h> |
|
42 |
|
43 using namespace GestureHelper; |
|
44 |
|
45 //Hg |
|
46 //#include <hg/hgcontextutility.h> |
|
47 #include <glxhdmicontroller.h> |
|
48 |
|
49 // Photos Headers |
|
50 #include <glxlog.h> // CGlxLogger |
|
51 #include <glxtracer.h> // For Log |
|
52 #include <glxmedialistmulmodelprovider.h> // For MulModelProvider |
|
53 #include <glxcommandhandlers.hrh> // For EGlxCmdFullScreenBack |
|
54 #include <glxfullscreenviewdata.rsg> // FS View Resource |
|
55 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
|
56 //#include "glxmediakeyutility.h" |
|
57 #include <glxactivemedialistregistry.h> // For medialist registry |
|
58 #include <glxerrormanager.h> |
|
59 #include <glxzoomcontrol.h> |
|
60 #include <glxuiutilities.rsg> |
|
61 #include <glxgeneraluiutilities.h> |
|
62 #include <glxtexturemanager.h> |
|
63 #include <glxicons.mbg> |
|
64 #include <glxsetappstate.h> |
|
65 #include <glxdrmutility.h> |
|
66 #include <glxscreenfurniture.h> |
|
67 //#include <glxsinglelinemetapanecontrol.h> |
|
68 #include "glxfullscreenviewimp.h" |
|
69 #include <glxnavigationalstate.h> |
|
70 |
|
71 using namespace Alf; |
|
72 |
|
73 //To disable AppUi status pane |
|
74 #define GetAppViewUi() (dynamic_cast<CAknViewAppUi*>(CEikonEnv::Static()->EikAppUi())) |
|
75 const TInt KGlxScreenTimeout =10000000; |
|
76 const TInt KCoverflowDataWindowSize = 1; |
|
77 const TInt KGlxRotationDelay = 800; // Milliseconds |
|
78 const TInt KGlxMaxSmallImageZoomLevel =150; |
|
79 const TInt KGlxMaxBigImageZoomLevel =100; |
|
80 const TInt KGlxMinSmallImageZoomLevel =100; |
|
81 const TInt KGlxNeutralPinchPosition =100; |
|
82 const TInt KGlxSliderTickValue =5; |
|
83 _LIT(KGlxIconsFilename, "glxicons.mif"); |
|
84 /** |
|
85 * Start Delay for the periodic timer, in microseconds |
|
86 */ |
|
87 const TInt KPeriodicStartDelay = 250000; |
|
88 //This constant is used to calculate the index of the item for which texture has to removed. |
|
89 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index); |
|
90 const TInt KFullScreenIterator = 3; |
|
91 //Constant which says maximum number of fullscreen textures that we have have at a time. |
|
92 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards)) |
|
93 const TInt KFullScreenTextureOffset = 5; |
|
94 |
|
95 // ======== MEMBER FUNCTIONS ======== |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // C++ default constructor can NOT contain any code, that |
|
99 // might leave. |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 CGlxFullScreenViewImp::CGlxFullScreenViewImp( |
|
103 const TFullScreenViewResourceIds& aResourceIds, TInt aViewUID) : |
|
104 iResourceIds(aResourceIds), iViewUid(aViewUID) |
|
105 { |
|
106 TRACER("CGlxFullScreenViewImp::CGlxFullScreenViewImp"); |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // Two-phased constructor. |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 CGlxFullScreenViewImp* CGlxFullScreenViewImp::NewL( |
|
114 MGlxMediaListFactory* aMediaListFactory, |
|
115 const TFullScreenViewResourceIds& aResourceIds, |
|
116 TInt aViewUID, |
|
117 const TDesC& aTitle) |
|
118 { |
|
119 TRACER("CGlxFullScreenViewImp::NewL"); |
|
120 CGlxFullScreenViewImp* self = CGlxFullScreenViewImp::NewLC ( |
|
121 aMediaListFactory, aResourceIds, aViewUID, aTitle); |
|
122 CleanupStack::Pop (self); |
|
123 return self; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // Two-phased constructor. |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 CGlxFullScreenViewImp* CGlxFullScreenViewImp::NewLC( |
|
131 MGlxMediaListFactory* aMediaListFactory, |
|
132 const TFullScreenViewResourceIds& aResourceIds, TInt aViewUID, |
|
133 const TDesC& aTitle) |
|
134 { |
|
135 TRACER("CGlxFullScreenViewImp::NewLC"); |
|
136 CGlxFullScreenViewImp* self =new (ELeave) CGlxFullScreenViewImp(aResourceIds, aViewUID); |
|
137 CleanupStack::PushL (self); |
|
138 self->ConstructL (aMediaListFactory, aTitle); |
|
139 return self; |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // ConstructL. |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CGlxFullScreenViewImp::ConstructL( |
|
147 MGlxMediaListFactory* aMediaListFactory, const TDesC& aTitle) |
|
148 { |
|
149 TRACER("CGlxFullScreenViewImp::ConstructL"); |
|
150 BaseConstructL (iResourceIds.iViewId); |
|
151 ViewBaseConstructL(); |
|
152 MLViewBaseConstructL (aMediaListFactory, aTitle , EFalse); |
|
153 |
|
154 iTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
155 //Register the view to recieve toolbar events. ViewBase handles the events |
|
156 SetToolbarObserver(this); |
|
157 |
|
158 // Presently image viewer dont have toolbar |
|
159 // So need to remove if image viewer using full screen |
|
160 CGlxNavigationalState* navigationalState = CGlxNavigationalState::InstanceL(); |
|
161 CleanupClosePushL( *navigationalState ); |
|
162 CMPXCollectionPath* naviState = navigationalState->StateLC(); |
|
163 if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
|
164 { |
|
165 CAknToolbar* toolbar = Toolbar(); |
|
166 if(toolbar) |
|
167 { |
|
168 toolbar->DisableToolbarL(ETrue); |
|
169 } |
|
170 ShowToolbarOnViewActivation(EFalse); |
|
171 } |
|
172 else |
|
173 { |
|
174 ShowToolbarOnViewActivation(ETrue); |
|
175 } |
|
176 CleanupStack::PopAndDestroy(naviState); |
|
177 CleanupStack::PopAndDestroy(navigationalState); |
|
178 |
|
179 |
|
180 //Get the ScreenFurniture instance |
|
181 iScreenFurniture = iUiUtility->ScreenFurniture(); |
|
182 |
|
183 //Get the env from the uiutilities |
|
184 iEnv = iUiUtility->Env (); |
|
185 iZoomButtonGroup = CEikButtonGroupContainer::NewL( |
|
186 CEikButtonGroupContainer::ECba, // type |
|
187 CEikButtonGroupContainer::EHorizontal, // orientation |
|
188 this, // command observer |
|
189 R_GLX_FULLSCREEN_SOFTKEYS_ZOOM ); |
|
190 iZoomButtonGroup->MakeVisible( EFalse ); |
|
191 |
|
192 //create the drmutility instance |
|
193 iDrmUtility = CGlxDRMUtility::InstanceL(); |
|
194 // Get object that stores the active media list registry |
|
195 iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL(); |
|
196 if(!iPeriodic) |
|
197 { |
|
198 iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard); |
|
199 } |
|
200 } |
|
201 |
|
202 // --------------------------------------------------------------------------- |
|
203 // ~CGlxFullScreenViewImp() |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 CGlxFullScreenViewImp::~CGlxFullScreenViewImp() |
|
207 { |
|
208 TRACER("CGlxFullScreenViewImp::~CGlxFullScreenViewImp"); |
|
209 delete iMediaListMulModelProvider; |
|
210 if(iTimer->IsActive()) |
|
211 { |
|
212 iTimer->Cancel(); |
|
213 } |
|
214 delete iTimer; |
|
215 if(iZoomButtonGroup) |
|
216 { |
|
217 AppUi()->RemoveFromStack( iZoomButtonGroup ); |
|
218 delete iZoomButtonGroup; |
|
219 } |
|
220 if(iActiveMediaListRegistry) |
|
221 { |
|
222 iActiveMediaListRegistry->Close(); |
|
223 } |
|
224 if( iDrmUtility ) |
|
225 { |
|
226 iDrmUtility->Close(); |
|
227 } |
|
228 if (iPeriodic) |
|
229 { |
|
230 iPeriodic->Cancel(); |
|
231 delete iPeriodic; |
|
232 } |
|
233 } |
|
234 // --------------------------------------------------------------------------- |
|
235 // From CGlxViewBase |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 TUid CGlxFullScreenViewImp::Id() const |
|
239 { |
|
240 TRACER("CGlxFullScreenViewImp::Id"); |
|
241 return TUid::Uid(iViewUid); |
|
242 } |
|
243 |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // Destroys a coverflow widget |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 void CGlxFullScreenViewImp::DestroyWidgets() |
|
250 { |
|
251 TRACER("CGlxFullScreenViewImp::DestroyCoverflowWidget"); |
|
252 if (iCoverFlowWidget) |
|
253 { |
|
254 iCoverFlowWidget->RemoveEventHandler(*this); |
|
255 } |
|
256 // Destror Slider widget |
|
257 DestroySliderWidget(); |
|
258 |
|
259 delete iMediaListMulModelProvider; |
|
260 iMediaListMulModelProvider = NULL; |
|
261 |
|
262 IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); |
|
263 // Destroying this widget calls destructor of single line meta pane |
|
264 widgetFactory.destroyWidget(iViewWidget); |
|
265 |
|
266 iCoverFlowWidget = NULL; |
|
267 iViewWidget = NULL; |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // Destroys a Slider widget |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 void CGlxFullScreenViewImp::DestroySliderWidget() |
|
275 { |
|
276 TRACER("CGlxFullScreenViewImp::DestroySliderWidget"); |
|
277 if(iSliderWidget) |
|
278 { |
|
279 iSliderWidget->RemoveEventHandler(*this); |
|
280 } |
|
281 iSliderWidget = NULL; |
|
282 iSliderModel = NULL; |
|
283 } |
|
284 // --------------------------------------------------------------------------- |
|
285 // From CAknView |
|
286 // Handles a view activation. |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 void CGlxFullScreenViewImp::DoMLViewActivateL( |
|
290 const TVwsViewId & /* aPrevViewId */, TUid /* aCustomMessageId */, |
|
291 const TDesC8 & /* aCustomMessage */) |
|
292 { |
|
293 TRACER("CGlxFullScreenViewImp::DoMLViewActivateL"); |
|
294 //Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash |
|
295 if(!iMediaList->Count()) |
|
296 { |
|
297 CGlxNavigationalState* navigationalState = CGlxNavigationalState::InstanceL(); |
|
298 CleanupClosePushL( *navigationalState ); |
|
299 navigationalState->ActivatePreviousViewL(); |
|
300 CleanupStack::PopAndDestroy( navigationalState ); |
|
301 } |
|
302 //need to create the instance first,other wise panics while |
|
303 // zooming from imgvwr. |
|
304 iHdmiController = CGlxHdmiController::NewL(); |
|
305 if(iMediaList->Count()) |
|
306 { |
|
307 iOldFocusIndex = iMediaList->FocusIndex(); |
|
308 TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); |
|
309 GLX_LOG_INFO("CGlxHdmi - CGlxFullScreenViewImp Create HdmiController"); |
|
310 if (item.Category() != EMPXVideo) |
|
311 { |
|
312 TInt frameCount(0); |
|
313 TSize orignalSize; |
|
314 TBool aFramesPresent = item.GetFrameCount(frameCount); |
|
315 TBool adimension = item.GetDimensions(orignalSize); |
|
316 iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); |
|
317 } |
|
318 } |
|
319 iScreenFurniture->SetActiveView(iViewUid); |
|
320 |
|
321 //set the ui state to off,when the Fullscreen launches |
|
322 SetUiSate(NGlxNFullScreenUIState::EUiOff); |
|
323 |
|
324 GlxSetAppState::SetState(EGlxInFullScreenView); |
|
325 |
|
326 // create the coverflow |
|
327 CreateCoverflowWidgetL(); |
|
328 |
|
329 // create the screen furniture for touch devices |
|
330 CreateScreenFurnitureL(); |
|
331 |
|
332 CreateSliderWidgetL(); |
|
333 |
|
334 // iMediaKeyUtility = CGlxMediaKeyUtility::NewL(); |
|
335 |
|
336 // create a zoom control |
|
337 iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList, |
|
338 *iZoomButtonGroup, *iSliderWidget, iGestureHelper); |
|
339 |
|
340 // Create the Metapane |
|
341 //iSingleLineMetaPane = CGlxSinleLineMetaPane::NewL(*this,*iMediaList,*iUiUtility); |
|
342 |
|
343 // hide the screen furniture |
|
344 HideUi(ETrue); |
|
345 // Set active media list pointer, so that UPnP renderer knows about this list |
|
346 iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); |
|
347 |
|
348 //Get the HgContextUtility instance |
|
349 // iContextUtility = iUiUtility->ContextUtility(); |
|
350 |
|
351 // if the Medialist has any item, set the First index context to Hg Context Utility |
|
352 // TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); |
|
353 // iContextUtility->PublishPhotoContextL(item.Uri()); |
|
354 if ( !iPeriodic->IsActive() ) |
|
355 { |
|
356 iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, TCallBack( |
|
357 &PeriodicCallback, static_cast<TAny*>( this ) ) ); |
|
358 } |
|
359 } |
|
360 |
|
361 |
|
362 // --------------------------------------------------------------------------- |
|
363 // Creates a coverflow widget |
|
364 // --------------------------------------------------------------------------- |
|
365 // |
|
366 void CGlxFullScreenViewImp::CreateCoverflowWidgetL() |
|
367 { |
|
368 TRACER("CGlxFullScreenViewImp::CreateCoverflowWidgetL"); |
|
369 |
|
370 const char* KWidgetName("mulcoverflowwidget"); |
|
371 const char* KCoverflowViewWidget("CoverflowViewWidget"); |
|
372 const char* KCoverflowWidget("CoverflowWidget"); |
|
373 try |
|
374 { |
|
375 // Get widget factory from CAlfEnv |
|
376 // Factory is then used to create the individual widgets & data model |
|
377 |
|
378 IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); |
|
379 |
|
380 // create a view widget |
|
381 iViewWidget = widgetFactory.createViewWidget ( |
|
382 KCoverflowViewWidget, 0x113); |
|
383 // hide control and status pane |
|
384 iViewWidget->enableControlPane(EFalse); |
|
385 iViewWidget->enableStatusPane(EFalse); |
|
386 iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); |
|
387 iViewWidget->show(true); |
|
388 // create coverflow widget |
|
389 iCoverFlowWidget = widgetFactory.createWidget<IMulCoverFlowWidget> ( |
|
390 KWidgetName, KCoverflowWidget, *iViewWidget, NULL); |
|
391 iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap); |
|
392 |
|
393 // Widget takes the ownership |
|
394 iCoverFlowWidget->AddEventHandler (*this); |
|
395 |
|
396 // hide appui's status pane |
|
397 GetAppViewUi()->StatusPane()->MakeVisible(EFalse); |
|
398 |
|
399 // hide appui's softkeys |
|
400 GetAppViewUi()->Cba()->MakeVisible(EFalse); |
|
401 iCoverFlowWidget->ShowWidget(ETrue); |
|
402 iCoverFlowWidget->control()->AcquireFocus(); |
|
403 |
|
404 iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL (*iEnv, |
|
405 *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet, |
|
406 mulwidget::KTemplate4, KCoverflowDataWindowSize ); |
|
407 |
|
408 iGestureHelper = (GestureHelper::CGestureHelper*)iCoverFlowWidget->Gesturehelper(); |
|
409 } |
|
410 |
|
411 catch(...) |
|
412 { |
|
413 User::Leave(KErrGeneral); |
|
414 } |
|
415 |
|
416 } |
|
417 |
|
418 //---------------------------------------------------------------------------- |
|
419 //Initialise the slider widget and the slider model |
|
420 //---------------------------------------------------------------------------- |
|
421 // |
|
422 void CGlxFullScreenViewImp::CreateSliderWidgetL() |
|
423 { |
|
424 const char* KSliderWidgetName("mulsliderwidget"); |
|
425 const char* KZoomSliderWidget("ZoomSliderWidget"); |
|
426 |
|
427 try |
|
428 { |
|
429 IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv); |
|
430 |
|
431 iSliderWidget = widgetFactory.createWidget<IMulSliderWidget>( KSliderWidgetName, |
|
432 KZoomSliderWidget, *iViewWidget, NULL); |
|
433 |
|
434 iSliderWidget->AddEventHandler(*this); |
|
435 iSliderWidget->SetHandleKeyEvent(EFalse); |
|
436 iSliderModel = widgetFactory.createModel<IMulSliderModel> ("mulslidermodel"); |
|
437 iSliderModel->SetTemplate(ESliderTemplate3); |
|
438 iSliderWidget->setModel(iSliderModel); |
|
439 |
|
440 //adding the range and slider tick value |
|
441 if(iSliderModel) |
|
442 { |
|
443 iSliderModel->SetTick(KGlxSliderTickValue); |
|
444 } |
|
445 |
|
446 //SetSliderLevel(); |
|
447 |
|
448 } |
|
449 catch(...) |
|
450 { |
|
451 User::Leave(KErrGeneral); |
|
452 } |
|
453 } |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 // ShowUiL |
|
457 // --------------------------------------------------------------------------- |
|
458 // |
|
459 void CGlxFullScreenViewImp::ShowUiL(TBool aStartTimer) |
|
460 { |
|
461 TRACER("CGlxFullScreenViewImp::ShowUiL"); |
|
462 |
|
463 TInt index = iMediaList->FocusIndex(); |
|
464 const TGlxMedia& item = iMediaList->Item(index); |
|
465 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail); |
|
466 // Display slider only for non corrupted images |
|
467 if (error == KErrNone && item.Category() == EMPXImage) |
|
468 { |
|
469 //To set the Slider values. |
|
470 SetSliderLevel(); |
|
471 //show the slider |
|
472 iSliderWidget->ShowWidget(ETrue); |
|
473 } |
|
474 |
|
475 if (iCoverFlowWidget) |
|
476 { |
|
477 // This is done to set the item counter |
|
478 iCoverFlowWidget->SetUIMode(ETrue); |
|
479 } |
|
480 |
|
481 //show the toolbar |
|
482 CAknToolbar* toolbar = Toolbar(); |
|
483 if(toolbar) |
|
484 { |
|
485 toolbar->SetToolbarVisibility(ETrue); |
|
486 } |
|
487 |
|
488 // For floating toolbar in non-touch devices |
|
489 iScreenFurniture->SetToolbarVisibility(ETrue); |
|
490 //show the softkeys |
|
491 Cba()->MakeVisible( ETrue ); |
|
492 Cba()->DrawNow(); |
|
493 |
|
494 // Show the Metapane |
|
495 //iSingleLineMetaPane->ShowMetaPane(ETrue); |
|
496 |
|
497 //set the ui state to On |
|
498 SetUiSate(NGlxNFullScreenUIState::EUiOn); |
|
499 |
|
500 //start the timer,for the screen timeout |
|
501 iTimer->Cancel(); |
|
502 if(aStartTimer) |
|
503 { |
|
504 iTimer->Start(KGlxScreenTimeout,KGlxScreenTimeout,TCallBack( TimeOut,this )); |
|
505 } |
|
506 } |
|
507 |
|
508 // --------------------------------------------------------------------------- |
|
509 // HideUi |
|
510 // --------------------------------------------------------------------------- |
|
511 // |
|
512 void CGlxFullScreenViewImp::HideUi(TBool aSliderStatus) |
|
513 { |
|
514 TRACER("CGlxFullScreenViewImp::HideUi"); |
|
515 //cancel the timer |
|
516 iTimer->Cancel(); |
|
517 |
|
518 // For floating toolbar in non-touch devices |
|
519 iScreenFurniture->SetToolbarVisibility(EFalse); |
|
520 // hide the slider |
|
521 if(aSliderStatus && iSliderWidget) |
|
522 { |
|
523 iSliderWidget->ShowWidget(EFalse); |
|
524 } |
|
525 |
|
526 if (iCoverFlowWidget) |
|
527 { |
|
528 iCoverFlowWidget->SetUIMode(EFalse); |
|
529 } |
|
530 // hide the toolbar |
|
531 CAknToolbar* toolbar = Toolbar(); |
|
532 if(toolbar) |
|
533 { |
|
534 toolbar->SetToolbarVisibility(EFalse); |
|
535 } |
|
536 |
|
537 // hide the softkeys |
|
538 Cba()->MakeVisible( EFalse ); |
|
539 Cba()->DrawNow(); |
|
540 // Hide the metapane |
|
541 //iSingleLineMetaPane->ShowMetaPane(EFalse); |
|
542 |
|
543 // set the ui state to On |
|
544 SetUiSate(NGlxNFullScreenUIState::EUiOff); |
|
545 } |
|
546 |
|
547 // --------------------------------------------------------------------------- |
|
548 // CreateScreenFurnitureL |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 void CGlxFullScreenViewImp::CreateScreenFurnitureL() |
|
552 { |
|
553 TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL"); |
|
554 // create the softkeys |
|
555 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
556 CleanupStack::PushL( cba ); |
|
557 cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS); |
|
558 CleanupStack::Pop(cba); |
|
559 } |
|
560 |
|
561 // --------------------------------------------------------------------------- |
|
562 // SetUiSate |
|
563 // --------------------------------------------------------------------------- |
|
564 // |
|
565 void CGlxFullScreenViewImp::SetUiSate (NGlxNFullScreenUIState::TUiState aState) |
|
566 { |
|
567 TRACER("CGlxFullScreenViewImp::SetUiSate"); |
|
568 iUiState = aState; |
|
569 } |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // GetUiSate |
|
573 // --------------------------------------------------------------------------- |
|
574 // |
|
575 NGlxNFullScreenUIState::TUiState CGlxFullScreenViewImp::GetUiSate() |
|
576 { |
|
577 TRACER("CGlxFullScreenViewImp::GetUiSate"); |
|
578 return iUiState; |
|
579 } |
|
580 |
|
581 // --------------------------------------------------------------------------- |
|
582 // TimeOut |
|
583 // --------------------------------------------------------------------------- |
|
584 // |
|
585 TInt CGlxFullScreenViewImp::TimeOut(TAny* aSelf) |
|
586 { |
|
587 TRACER("CGlxFullScreenViewImp::TimeOut"); |
|
588 if(aSelf) |
|
589 { |
|
590 CGlxFullScreenViewImp* self = static_cast <CGlxFullScreenViewImp*> (aSelf); |
|
591 if (self) |
|
592 { |
|
593 if ( NGlxNFullScreenUIState::EUiOn == self->GetUiSate()) |
|
594 { |
|
595 // After time out, hide UI only when menu is not being displayed. |
|
596 if( self->MenuBar() && !(self->MenuBar()->IsDisplayed()) ) |
|
597 { |
|
598 self->HideUi(ETrue); |
|
599 } |
|
600 } |
|
601 } |
|
602 } |
|
603 return KErrNone; |
|
604 } |
|
605 |
|
606 // --------------------------------------------------------------------------- |
|
607 //DeactivateFullScreen function. |
|
608 // --------------------------------------------------------------------------- |
|
609 // |
|
610 void CGlxFullScreenViewImp::DeactivateFullScreen() |
|
611 { |
|
612 TRACER("CGlxFullScreenViewImp::DeactivateFullScreen"); |
|
613 if (iCoverFlowWidget) |
|
614 { |
|
615 iCoverFlowWidget->RemoveEventHandler(*this); |
|
616 iCoverFlowWidget->ShowWidget(EFalse); |
|
617 } |
|
618 if(iSliderWidget) |
|
619 { |
|
620 iSliderWidget->RemoveEventHandler(*this); |
|
621 } |
|
622 //Dont Hide the slider,when activating the Zoom control,so pass EFalse |
|
623 HideUi(EFalse); |
|
624 iViewWidget->show(ETrue); |
|
625 } |
|
626 |
|
627 // --------------------------------------------------------------------------- |
|
628 //ActivateFullScreen function. |
|
629 // --------------------------------------------------------------------------- |
|
630 // |
|
631 void CGlxFullScreenViewImp::ActivateFullScreenL() |
|
632 { |
|
633 TRACER("CGlxFullScreenViewImp::ActivateFullScreenL"); |
|
634 |
|
635 if (iCoverFlowWidget) |
|
636 { |
|
637 iCoverFlowWidget->AddEventHandler(*this); |
|
638 iCoverFlowWidget->ShowWidget(ETrue); |
|
639 } |
|
640 if(iSliderWidget) |
|
641 { |
|
642 iSliderWidget->ShowWidget( EFalse ); |
|
643 iSliderWidget->AddEventHandler(*this); |
|
644 } |
|
645 iViewWidget->show(ETrue); |
|
646 iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); |
|
647 GlxSetAppState::SetState(EGlxInFullScreenView); |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------------------------- |
|
651 //ActivateZoomControl function. |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 void CGlxFullScreenViewImp::ActivateZoomControlL(TZoomStartMode aStartMode, TPoint* apZoomFocus) |
|
655 { |
|
656 TRACER("CGlxFullScreenViewImp::ActivateZoomControlL"); |
|
657 TInt focus = iMediaList->FocusIndex(); |
|
658 TGlxMedia item = iMediaList->Item( focus ); |
|
659 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties() , KGlxMediaIdThumbnail); |
|
660 |
|
661 if(KErrNone == error) |
|
662 { |
|
663 if(EMPXImage == item.Category()) |
|
664 { |
|
665 if(iZoomControl && !iZoomControl->Activated()) |
|
666 { |
|
667 iHdmiController->ActivateZoom(); |
|
668 iZoomControl->ActivateL(GetIntialZoomLevel(),aStartMode, focus, item, apZoomFocus); |
|
669 |
|
670 //==Removing all textures other than the focussed one=============== |
|
671 TInt count = iMediaList->Count(); |
|
672 |
|
673 while (count > 0) |
|
674 { |
|
675 TGlxMedia mediaItem = iMediaList->Item(count-1); |
|
676 if (mediaItem.Id() != item.Id() ) |
|
677 { |
|
678 iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse); |
|
679 } |
|
680 count--; |
|
681 } |
|
682 //==\Removing all textures============== |
|
683 } |
|
684 else |
|
685 { |
|
686 return; |
|
687 } |
|
688 DeactivateFullScreen(); |
|
689 GlxSetAppState::SetState(EGlxInZoomedView); |
|
690 } |
|
691 } |
|
692 } |
|
693 |
|
694 // --------------------------------------------------------------------------- |
|
695 //DeactivateZoomControl function. |
|
696 // --------------------------------------------------------------------------- |
|
697 // |
|
698 void CGlxFullScreenViewImp::DeactivateZoomControlL() |
|
699 { |
|
700 TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL"); |
|
701 ActivateFullScreenL(); |
|
702 if(iZoomControl->Activated()) |
|
703 { |
|
704 iHdmiController->DeactivateZoom(); |
|
705 iZoomControl->Deactivate(); |
|
706 } |
|
707 //Once into fullscreen view,show the screen furniture |
|
708 HideUi(ETrue); |
|
709 } |
|
710 |
|
711 // --------------------------------------------------------------------------- |
|
712 // From CAknView |
|
713 // View deactivation function. |
|
714 // --------------------------------------------------------------------------- |
|
715 // |
|
716 void CGlxFullScreenViewImp::DoMLViewDeactivate() |
|
717 { |
|
718 TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate"); |
|
719 iScreenFurniture->ViewDeactivated(iViewUid); |
|
720 if (iHdmiController) |
|
721 { |
|
722 delete iHdmiController; |
|
723 iHdmiController = NULL; |
|
724 } |
|
725 |
|
726 if(iZoomControl) |
|
727 { |
|
728 if(iZoomControl->Activated()) |
|
729 { |
|
730 iZoomControl->Deactivate(); |
|
731 } |
|
732 delete iZoomControl; |
|
733 iZoomControl = NULL; |
|
734 } |
|
735 DestroyWidgets(); |
|
736 iTimer->Cancel(); |
|
737 // Deregister active media list pointer |
|
738 iActiveMediaListRegistry->DeregisterActiveMediaList(iMediaList); |
|
739 |
|
740 /* |
|
741 * safe code-- if user press back very quickly |
|
742 * cancelling the timer while going back to prev view |
|
743 */ |
|
744 if (iPeriodic->IsActive()) |
|
745 { |
|
746 iPeriodic->Cancel(); |
|
747 } |
|
748 |
|
749 } |
|
750 // --------------------------------------------------------------------------- |
|
751 // Foreground event handling function. |
|
752 // --------------------------------------------------------------------------- |
|
753 // |
|
754 void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground) |
|
755 { |
|
756 TRACER("CGlxFullScreenViewImp::HandleForegroundEventL"); |
|
757 CAknView::HandleForegroundEventL(aForeground); |
|
758 |
|
759 if(!aForeground) |
|
760 { |
|
761 if(iZoomControl && iZoomControl->Activated()) |
|
762 { |
|
763 iZoomControl->HandleZoomForegroundEvent(aForeground); |
|
764 } |
|
765 } |
|
766 } |
|
767 |
|
768 |
|
769 // --------------------------------------------------------------------------- |
|
770 // From IAlfWidgetEventHandler.. |
|
771 // --------------------------------------------------------------------------- |
|
772 // |
|
773 bool CGlxFullScreenViewImp::accept( CAlfWidgetControl& /*aControl*/, |
|
774 const TAlfEvent& /*aEvent*/) const |
|
775 { |
|
776 TRACER("CGlxFullScreenViewImp::accept()"); |
|
777 return ETrue; |
|
778 } |
|
779 |
|
780 // --------------------------------------------------------------------------- |
|
781 // From IAlfWidgetEventHandler.. |
|
782 // --------------------------------------------------------------------------- |
|
783 // |
|
784 AlfEventStatus CGlxFullScreenViewImp::offerEvent( |
|
785 CAlfWidgetControl& /*aControl*/, const TAlfEvent& aEvent) |
|
786 { |
|
787 TRACER("CGlxFullScreenViewImp::offerEvent"); |
|
788 // The below function call will not add any values except |
|
789 // to reduce the codescanner warnings to one |
|
790 return OfferEventL(aEvent); |
|
791 } |
|
792 |
|
793 // --------------------------------------------------------------------------- |
|
794 // OfferEventL() |
|
795 // --------------------------------------------------------------------------- |
|
796 // |
|
797 AlfEventStatus CGlxFullScreenViewImp::OfferEventL(const TAlfEvent& aEvent) |
|
798 { |
|
799 TRACER("CGlxFullScreenViewImp::offerEventL"); |
|
800 if ( aEvent.IsKeyEvent()) |
|
801 { |
|
802 switch ( aEvent.KeyEvent().iScanCode ) |
|
803 { |
|
804 case EStdKeyNkpAsterisk : |
|
805 if(iUiUtility->IsPenSupported()) |
|
806 { |
|
807 return EEventNotHandled; |
|
808 } |
|
809 case EStdKeyIncVolume : |
|
810 //Listen EStdKeyApplicationD as EKeyZoomIn key is mapped to TKeyCode:: |
|
811 //EKeyApplicationC for which TStdScancode is EStdKeyApplicatoinC |
|
812 case EStdKeyApplicationC: |
|
813 { |
|
814 if(EEventKeyDown == aEvent.Code()) |
|
815 { |
|
816 //Dont start the timer while activating the zoom control, |
|
817 //when the timer activates while launching the zoom |
|
818 //it causes the crash. |
|
819 ShowUiL(EFalse); |
|
820 SetSliderLevel(); |
|
821 TRAP_IGNORE( ActivateZoomControlL(EZoomStartKey)); |
|
822 return EEventConsumed; |
|
823 } |
|
824 } |
|
825 case EStdKeyUpArrow: |
|
826 case EStdKeyDownArrow: |
|
827 case EStdKeyDevice0: |
|
828 case EStdKeyDevice1: |
|
829 //Listen EStdKeyApplicationC as EKeyZoomOut key is mapped to TKeyCode:: |
|
830 //EKeyApplicationD for which TStdScancode is EStdKeyApplicatoinD |
|
831 case EStdKeyApplicationD: |
|
832 { |
|
833 if ( NGlxNFullScreenUIState::EUiOff == GetUiSate()&& ( |
|
834 aEvent.Code() == EEventKey ) ) |
|
835 { |
|
836 //the Ui timer sjould be started once the UI screen furniture is shown |
|
837 ShowUiL(ETrue); |
|
838 } |
|
839 return EEventHandled; |
|
840 } |
|
841 case EStdKeyLeftArrow: |
|
842 case EStdKeyRightArrow: |
|
843 { |
|
844 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) |
|
845 { |
|
846 HideUi(ETrue); |
|
847 } |
|
848 return EEventHandled; |
|
849 } |
|
850 case EStdKeyApplication1C: |
|
851 { |
|
852 if(iUiUtility->IsPenSupported()) |
|
853 { |
|
854 return EEventNotHandled; |
|
855 } |
|
856 else |
|
857 { |
|
858 ProcessCommandL(KGlxCmdMnShowMap); |
|
859 return EEventHandled; |
|
860 } |
|
861 } |
|
862 default: |
|
863 return EEventNotHandled; |
|
864 } |
|
865 } |
|
866 if(!aEvent.IsCustomEvent()) |
|
867 { |
|
868 GLX_LOG_INFO("Event Not Handled"); |
|
869 return EEventNotHandled; |
|
870 } |
|
871 |
|
872 if(aEvent.IsCustomEvent()) |
|
873 { |
|
874 TInt eventId = aEvent.CustomParameter(); |
|
875 |
|
876 switch(eventId) |
|
877 { |
|
878 case KAlfActionIdDeviceLayoutChanged: |
|
879 { |
|
880 iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize())); |
|
881 |
|
882 iScreenFurniture->SetToolbarPosition(); |
|
883 |
|
884 return EEventNotHandled; |
|
885 } |
|
886 case ETypeSelect: |
|
887 { |
|
888 TBool pensupport = iUiUtility->IsPenSupported(); |
|
889 if ( pensupport ) |
|
890 { |
|
891 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) |
|
892 { |
|
893 //Hide the slider |
|
894 HideUi(ETrue); |
|
895 } |
|
896 else |
|
897 { |
|
898 //the Ui timer should be started once the UI screen furniture is shown |
|
899 ShowUiL(ETrue); |
|
900 } |
|
901 } |
|
902 else |
|
903 { |
|
904 if ( NGlxNFullScreenUIState::EUiOff == GetUiSate() ) |
|
905 { |
|
906 //the Ui timer should be started once the UI screen furniture is shown |
|
907 ShowUiL(ETrue); |
|
908 } |
|
909 } |
|
910 } |
|
911 break; |
|
912 |
|
913 case ETypeRemove: |
|
914 { |
|
915 // Handle the "C" key or the BackSpace key to Delete an item. |
|
916 ProcessCommandL(EGlxCmdDelete); |
|
917 return EEventConsumed; |
|
918 } |
|
919 |
|
920 case ETypeDoubleTap: |
|
921 { |
|
922 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap"); |
|
923 |
|
924 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); |
|
925 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint; |
|
926 SetSliderLevel(); |
|
927 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) ); |
|
928 return EEventConsumed; |
|
929 } |
|
930 case ETypeHighlight: |
|
931 { |
|
932 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); |
|
933 if (AknLayoutUtils::PenEnabled()) |
|
934 { |
|
935 iMediaList->SetVisibleWindowIndexL(aEvent.CustomEventData()); |
|
936 } |
|
937 if(iMediaList->Count()> KFullScreenTextureOffset) |
|
938 { |
|
939 RemoveTexture(); |
|
940 } |
|
941 TGlxMedia item1 = iMediaList->Item( iMediaList->FocusIndex() ); |
|
942 TInt frameCount(0); |
|
943 TSize orignalSize; |
|
944 TBool aFramesPresent = item1.GetFrameCount(frameCount); |
|
945 TBool adimension = item1.GetDimensions(orignalSize); |
|
946 if (item1.Category() != EMPXVideo) |
|
947 { |
|
948 GLX_LOG_INFO("CGlxHdmi - FullscreenView - SetImageL"); |
|
949 iHdmiController->SetImageL(item1.Uri(), orignalSize, frameCount); |
|
950 } |
|
951 else |
|
952 { |
|
953 iHdmiController->IsVideo(); |
|
954 } |
|
955 iOldFocusIndex = iMediaList->FocusIndex(); |
|
956 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) |
|
957 { |
|
958 HideUi(ETrue); |
|
959 } |
|
960 TRAP_IGNORE(ShowDrmExpiaryNoteL()); |
|
961 return EEventConsumed; |
|
962 } |
|
963 case EVideoIconSelect: |
|
964 { |
|
965 TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); |
|
966 if(item.Category() == EMPXVideo) |
|
967 { |
|
968 ProcessCommandL(EGlxCmdPlay); |
|
969 } |
|
970 else |
|
971 { |
|
972 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() ) |
|
973 { |
|
974 HideUi(ETrue); |
|
975 } |
|
976 else |
|
977 { |
|
978 //the Ui timer should be started once the UI screen furniture is shown |
|
979 ShowUiL(ETrue); |
|
980 } |
|
981 } |
|
982 } |
|
983 break; |
|
984 //Zoom Start via pinch |
|
985 case ETypePinch: |
|
986 // Handle only a pinch out. not a pinch in. |
|
987 if (KGlxNeutralPinchPosition < aEvent.CustomEventData()) |
|
988 { |
|
989 SetSliderLevel(); |
|
990 TRAP_IGNORE( ActivateZoomControlL(EZoomStartPinch)); |
|
991 } |
|
992 return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). |
|
993 //slider event handling |
|
994 case ETypePrimaryValueChange: |
|
995 { |
|
996 // Zoomview is only launched if the currentslider value is above the level |
|
997 // of fullscreenlevel. |
|
998 iTimer->Cancel(); |
|
999 iSliderWidget->ShowWidget( ETrue, 0 ); |
|
1000 SetSliderLevel(); |
|
1001 TRAP_IGNORE( ActivateZoomControlL(EZoomStartSlider)); |
|
1002 } |
|
1003 return EEventConsumed; |
|
1004 default: |
|
1005 return EEventNotHandled; |
|
1006 } |
|
1007 } |
|
1008 return EEventNotHandled; |
|
1009 } |
|
1010 // --------------------------------------------------------------------------- |
|
1011 // From HandleViewCommandL.. |
|
1012 // --------------------------------------------------------------------------- |
|
1013 // |
|
1014 TBool CGlxFullScreenViewImp::HandleViewCommandL(TInt aCommand) |
|
1015 { |
|
1016 TRACER("GCGlxFullScreenViewImp::HandleViewCommandL"); |
|
1017 //size calculated for rotation |
|
1018 TSize size = iUiUtility->GetRotatedImageSize(); // ViewBase iUiUtility is use |
|
1019 TBool consumed = EFalse; |
|
1020 switch (aCommand) |
|
1021 { |
|
1022 case EGlxCmdResetView: |
|
1023 { |
|
1024 HideUi(ETrue); |
|
1025 consumed = ETrue; |
|
1026 break; |
|
1027 } |
|
1028 case EGlxCmdFullScreenBack: |
|
1029 SetSliderLevel(); |
|
1030 DeactivateZoomControlL(); |
|
1031 consumed = ETrue; |
|
1032 break; |
|
1033 // case EGlxCmdRotateLeft: |
|
1034 // iCoverFlowWidget->RotateImage(IMulWidget::ERotateLeft,size,KGlxRotationDelay); |
|
1035 // consumed = ETrue; |
|
1036 // break; |
|
1037 // case EGlxCmdRotateRight: |
|
1038 // iCoverFlowWidget->RotateImage(IMulWidget::ERotateRight,size,KGlxRotationDelay); |
|
1039 // consumed = ETrue; |
|
1040 // break; |
|
1041 } |
|
1042 return consumed; |
|
1043 } |
|
1044 |
|
1045 // --------------------------------------------------------------------------- |
|
1046 // From HandleCommandL.. |
|
1047 // --------------------------------------------------------------------------- |
|
1048 // |
|
1049 void CGlxFullScreenViewImp::HandleCommandL(TInt aCommandId, CAlfControl* aControl) |
|
1050 { |
|
1051 TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl"); |
|
1052 //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel |
|
1053 // and activates the fullscreenview |
|
1054 if((aControl == iZoomControl)&& (aCommandId == KGlxZoomOutCommand)) |
|
1055 { |
|
1056 SetSliderLevel(); |
|
1057 DeactivateZoomControlL(); |
|
1058 } |
|
1059 /*else if(aControl == iSingleLineMetaPane) |
|
1060 { |
|
1061 ProcessCommandL(aCommandId); |
|
1062 }*/ |
|
1063 } |
|
1064 |
|
1065 // --------------------------------------------------------------------------- |
|
1066 // From HandleResourceChangeL.. |
|
1067 // --------------------------------------------------------------------------- |
|
1068 // |
|
1069 void CGlxFullScreenViewImp::HandleResourceChangeL (TInt aType) |
|
1070 { |
|
1071 TRACER("CGlxFullScreenViewImp::HandleResourceChangeL"); |
|
1072 HandleResourceChangeL ( aType); |
|
1073 switch (aType) |
|
1074 { |
|
1075 case KEikDynamicLayoutVariantSwitch: |
|
1076 { |
|
1077 //if resolution changed |
|
1078 // iSliderWidget->control()->Display()->SetVisibleArea( ClientRect() ); |
|
1079 break; |
|
1080 } |
|
1081 } |
|
1082 } |
|
1083 |
|
1084 //---------------------------------------------------------------------------------- |
|
1085 // IntialZoomLevel:Calculate the initial Zoom Level for the Image |
|
1086 //---------------------------------------------------------------------------------- |
|
1087 // |
|
1088 TInt CGlxFullScreenViewImp::GetIntialZoomLevel() |
|
1089 { |
|
1090 TRACER("CGlxFullScreenViewImp::IntialZoomLevel"); |
|
1091 TInt focus = iMediaList->FocusIndex(); |
|
1092 TGlxMedia item = iMediaList->Item( focus ); |
|
1093 TSize size; |
|
1094 TUint8 initialZoomLevel; |
|
1095 item.GetDimensions( size ); |
|
1096 TRect rect = AlfUtil::ScreenSize(); |
|
1097 |
|
1098 if( rect.Width()>= size.iWidth && rect.Height() >= size.iHeight) |
|
1099 { |
|
1100 //if Both the Width and Height are lesser than the screen size,the initial Zoom Level will be 100 |
|
1101 initialZoomLevel = KGlxMinSmallImageZoomLevel; |
|
1102 } |
|
1103 else |
|
1104 { |
|
1105 //Calculate (Display Area Width) /Image Width * 100 |
|
1106 //Calculate (Display Area Height) /Image Height * 100 |
|
1107 //Choose the Minimum Of the above. |
|
1108 TReal32 imageWidthRatio = ((TReal32) rect.Width() / size.iWidth )*100.0F; |
|
1109 TReal32 imageHeightRatio = ((TReal32)rect.Height()/ size.iHeight )*100.0F; |
|
1110 initialZoomLevel = Min(imageWidthRatio,imageHeightRatio); |
|
1111 } |
|
1112 return initialZoomLevel; |
|
1113 } |
|
1114 |
|
1115 //---------------------------------------------------------------------------------- |
|
1116 // SetSliderLevel() Set the Initial Zoom Level for the Image |
|
1117 //---------------------------------------------------------------------------------- |
|
1118 // |
|
1119 void CGlxFullScreenViewImp::SetSliderLevel() |
|
1120 { |
|
1121 TRACER("CGlxFullScreenViewImp::SetSliderLevel"); |
|
1122 |
|
1123 TInt value = GetIntialZoomLevel(); |
|
1124 if(iSliderModel) |
|
1125 { |
|
1126 iSliderModel->SetMinRange(value); |
|
1127 (value==KGlxMaxBigImageZoomLevel)?(iSliderModel->SetMaxRange(KGlxMaxSmallImageZoomLevel)) |
|
1128 :(iSliderModel->SetMaxRange(KGlxMaxBigImageZoomLevel)); |
|
1129 iSliderModel->SetPrimaryValue(value); |
|
1130 } |
|
1131 } |
|
1132 |
|
1133 // --------------------------------------------------------------------------- |
|
1134 // From IAlfWidgetEventHandler.. |
|
1135 // --------------------------------------------------------------------------- |
|
1136 // |
|
1137 void CGlxFullScreenViewImp::setEventHandlerData( |
|
1138 const AlfWidgetEventHandlerInitData& /*aData*/) |
|
1139 { |
|
1140 TRACER("CGlxFullScreenViewImp::setEventHandlerData"); |
|
1141 } |
|
1142 |
|
1143 // --------------------------------------------------------------------------- |
|
1144 // From IAlfWidgetEventHandler.. |
|
1145 // --------------------------------------------------------------------------- |
|
1146 // |
|
1147 AlfWidgetEventHandlerInitData* CGlxFullScreenViewImp::eventHandlerData() |
|
1148 { |
|
1149 TRACER("CGlxFullScreenViewImp::eventHandlerData"); |
|
1150 return NULL; |
|
1151 } |
|
1152 |
|
1153 // --------------------------------------------------------------------------- |
|
1154 // From IAlfWidgetEventHandler. |
|
1155 // --------------------------------------------------------------------------- |
|
1156 // |
|
1157 void CGlxFullScreenViewImp::setActiveStates( unsigned int /*aStates*/ ) |
|
1158 { |
|
1159 TRACER("CGlxFullScreenViewImp::setActiveStates"); |
|
1160 } |
|
1161 |
|
1162 // --------------------------------------------------------------------------- |
|
1163 // From IAlfWidgetEventHandler. |
|
1164 // --------------------------------------------------------------------------- |
|
1165 // |
|
1166 |
|
1167 IAlfInterfaceBase* CGlxFullScreenViewImp::makeInterface( const IfId& /*aType*/ ) |
|
1168 { |
|
1169 TRACER("CGlxFullScreenViewImp::makeInterface"); |
|
1170 return NULL; |
|
1171 } |
|
1172 |
|
1173 //---------------------------------------------------------------------------------- |
|
1174 // eventHandlerType |
|
1175 //---------------------------------------------------------------------------------- |
|
1176 // |
|
1177 IAlfWidgetEventHandler::AlfEventHandlerType CGlxFullScreenViewImp::eventHandlerType() |
|
1178 { |
|
1179 TRACER("CGlxFullScreenViewImp::eventHandlerType"); |
|
1180 return IAlfWidgetEventHandler::ELogicalEventHandler; |
|
1181 } |
|
1182 |
|
1183 //---------------------------------------------------------------------------------- |
|
1184 // eventExecutionPhase |
|
1185 //---------------------------------------------------------------------------------- |
|
1186 // |
|
1187 IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CGlxFullScreenViewImp::eventExecutionPhase() |
|
1188 { |
|
1189 TRACER("CGlxFullScreenViewImp::eventHandlerType"); |
|
1190 return EBubblingPhaseEventHandler; |
|
1191 } |
|
1192 |
|
1193 // ----------------------------------------------------------------------------- |
|
1194 // Callback from periodic timer |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // |
|
1197 TInt CGlxFullScreenViewImp::PeriodicCallback(TAny* aPtr ) |
|
1198 { |
|
1199 TRACER("CGlxFullScreenViewImp::PeriodicCallback"); |
|
1200 static_cast< CGlxFullScreenViewImp* >( aPtr )->CallPeriodicCallback(); |
|
1201 return KErrNone; |
|
1202 } |
|
1203 |
|
1204 // ----------------------------------------------------------------------------- |
|
1205 // Callback from periodic timer-- non static |
|
1206 // ----------------------------------------------------------------------------- |
|
1207 // |
|
1208 inline void CGlxFullScreenViewImp::CallPeriodicCallback() |
|
1209 { |
|
1210 TRACER("CGlxFullScreenViewImp::CallPeriodicCallback"); |
|
1211 if(iPeriodic->IsActive()) |
|
1212 { |
|
1213 iPeriodic->Cancel(); |
|
1214 } |
|
1215 /* |
|
1216 * function can leave |
|
1217 */ |
|
1218 TRAP_IGNORE(ShowDrmExpiaryNoteL()); |
|
1219 } |
|
1220 |
|
1221 // --------------------------------------------------------------------------- |
|
1222 // |
|
1223 // Shows expiry note/dialog for expired DRM files, can leave |
|
1224 // --------------------------------------------------------------------------- |
|
1225 // |
|
1226 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL() |
|
1227 { |
|
1228 TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL"); |
|
1229 if(iMediaList->Count()>0) |
|
1230 { |
|
1231 const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex()); |
|
1232 if (media.IsDrmProtected()) |
|
1233 { |
|
1234 const TDesC& uri = media.Uri(); |
|
1235 if ( !iDrmUtility->CheckOpenRightsL(uri , (media.Category() == EMPXImage)) && ( uri.Length()>0 )) |
|
1236 { |
|
1237 iDrmUtility->ShowRightsInfoL(uri); |
|
1238 } |
|
1239 } |
|
1240 } |
|
1241 } |
|
1242 // --------------------------------------------------------------------------- |
|
1243 // |
|
1244 // Gets the Swipe direction |
|
1245 // --------------------------------------------------------------------------- |
|
1246 // |
|
1247 TSwipe CGlxFullScreenViewImp::GetSwipeDirection() |
|
1248 { |
|
1249 TRACER("CGlxFullScreenViewImp::GetSwipeDirection"); |
|
1250 |
|
1251 TInt count = iMediaList->Count(); |
|
1252 TInt focusindex = iMediaList->FocusIndex(); |
|
1253 TSwipe swipedirection; |
|
1254 |
|
1255 if(focusindex == 0) |
|
1256 { |
|
1257 swipedirection = (iOldFocusIndex == 1 ? EBackward : EForward); |
|
1258 } |
|
1259 else if(focusindex == count-1) |
|
1260 { |
|
1261 swipedirection = (iOldFocusIndex == 0 ? EBackward : EForward); |
|
1262 } |
|
1263 else |
|
1264 { |
|
1265 swipedirection = (focusindex-iOldFocusIndex < 0 ? EBackward : EForward) ; |
|
1266 } |
|
1267 return swipedirection; |
|
1268 } |
|
1269 // --------------------------------------------------------------------------- |
|
1270 // |
|
1271 // Gets the index of the item for which the texture has to be removed |
|
1272 // --------------------------------------------------------------------------- |
|
1273 // |
|
1274 TInt CGlxFullScreenViewImp::GetIndexToBeRemoved() |
|
1275 { |
|
1276 TRACER("CGlxFullScreenViewImp::GetIndexToBeRemoved"); |
|
1277 |
|
1278 TSwipe swipedirection = GetSwipeDirection(); |
|
1279 TInt indextoberemoved; |
|
1280 TInt count = iMediaList->Count(); |
|
1281 TInt focusindex = iMediaList->FocusIndex(); |
|
1282 if(swipedirection == EForward) |
|
1283 { |
|
1284 indextoberemoved = focusindex-KFullScreenIterator; |
|
1285 if(indextoberemoved < 0) |
|
1286 { |
|
1287 indextoberemoved = count+indextoberemoved; |
|
1288 } |
|
1289 } |
|
1290 else |
|
1291 { |
|
1292 indextoberemoved = focusindex+KFullScreenIterator; |
|
1293 if(indextoberemoved > count-1) |
|
1294 { |
|
1295 indextoberemoved = indextoberemoved-count; |
|
1296 } |
|
1297 } |
|
1298 GLX_LOG_INFO1("CGlxFullScreenViewImp::GetIndexToBeRemoved index tobe removed %d",indextoberemoved ); |
|
1299 return indextoberemoved; |
|
1300 } |
|
1301 // --------------------------------------------------------------------------- |
|
1302 // |
|
1303 // Remove the texture on every swipe while HDMI is connected. |
|
1304 // --------------------------------------------------------------------------- |
|
1305 // |
|
1306 void CGlxFullScreenViewImp::RemoveTexture() |
|
1307 { |
|
1308 TRACER("CGlxFullScreenViewImp::RemoveTexture"); |
|
1309 |
|
1310 const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved()); |
|
1311 iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); |
|
1312 } |