40 |
40 |
41 #include <gesturehelper.h> |
41 #include <gesturehelper.h> |
42 |
42 |
43 using namespace GestureHelper; |
43 using namespace GestureHelper; |
44 |
44 |
45 //Hg |
|
46 //#include <hg/hgcontextutility.h> |
|
47 #include <glxhdmicontroller.h> |
45 #include <glxhdmicontroller.h> |
48 |
46 |
49 // Photos Headers |
47 // Photos Headers |
50 #include <glxlog.h> // CGlxLogger |
48 #include <glxlog.h> // CGlxLogger |
51 #include <glxtracer.h> // For Log |
49 #include <glxtracer.h> // For Log |
52 #include <glxmedialistmulmodelprovider.h> // For MulModelProvider |
50 #include <glxmedialistmulmodelprovider.h> // For MulModelProvider |
53 #include <glxcommandhandlers.hrh> // For EGlxCmdFullScreenBack |
51 #include <glxcommandhandlers.hrh> // For EGlxCmdFullScreenBack |
54 #include <glxfullscreenviewdata.rsg> // FS View Resource |
52 #include <glxfullscreenviewdata.rsg> // FS View Resource |
55 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
53 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
56 //#include "glxmediakeyutility.h" |
|
57 #include <glxactivemedialistregistry.h> // For medialist registry |
54 #include <glxactivemedialistregistry.h> // For medialist registry |
58 #include <glxerrormanager.h> |
55 #include <glxerrormanager.h> |
59 #include <glxzoomcontrol.h> |
56 #include <glxzoomcontrol.h> |
60 #include <glxuiutilities.rsg> |
57 #include <glxuiutilities.rsg> |
61 #include <glxgeneraluiutilities.h> |
58 #include <glxgeneraluiutilities.h> |
62 #include <glxtexturemanager.h> |
59 #include <glxtexturemanager.h> |
63 #include <glxicons.mbg> |
60 #include <glxicons.mbg> |
64 #include <glxsetappstate.h> |
61 #include <glxsetappstate.h> |
65 #include <glxdrmutility.h> |
62 #include <glxdrmutility.h> |
66 #include <glxscreenfurniture.h> |
63 #include <glxscreenfurniture.h> |
67 //#include <glxsinglelinemetapanecontrol.h> |
|
68 #include "glxfullscreenviewimp.h" |
64 #include "glxfullscreenviewimp.h" |
69 #include <glxnavigationalstate.h> |
65 #include <glxnavigationalstate.h> |
70 #include <glxmedia.h> |
66 #include <glxmedia.h> |
71 #include <glxnavigationalstate.h> |
67 #include <glxnavigationalstate.h> |
72 #include <mpxcollectionpath.h> |
68 #include <mpxcollectionpath.h> |
73 #include <glxcollectionpluginimageviewer.hrh> |
69 #include <glxcollectionpluginimageviewer.hrh> |
74 |
70 #include "glxfullscreenbusyicon.h" |
75 using namespace Alf; |
71 using namespace Alf; |
76 |
72 |
77 const TInt KGlxScreenTimeout =10000000; |
73 const TInt KGlxScreenTimeout =10000000; |
78 const TInt KCoverflowDataWindowSize = 1; |
74 const TInt KCoverflowDataWindowSize = 1; |
79 const TInt KGlxMaxSmallImageZoomLevel =150; |
75 const TInt KGlxMaxSmallImageZoomLevel =150; |
320 { |
324 { |
321 navigationalState->SetToViewMode(); |
325 navigationalState->SetToViewMode(); |
322 } |
326 } |
323 } |
327 } |
324 |
328 |
325 |
|
326 if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
329 if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
327 { |
330 { |
328 iImgViewerMode = ETrue; |
331 iImgViewerMode = ETrue; |
329 } |
332 } |
330 //destroy and close navistate and navipath |
333 //destroy and close navistate and navipath |
331 CleanupStack::PopAndDestroy( naviState ); |
334 CleanupStack::PopAndDestroy( naviState ); |
332 CleanupStack::PopAndDestroy( navigationalState ); |
335 CleanupStack::PopAndDestroy( navigationalState ); |
333 |
336 |
334 //Create hdmicontroller when it is only launched from fullscreen. |
337 //Create hdmicontroller when it is only launched from fullscreen. |
335 //From filemanager show only clone mode. |
338 //From filemanager show only clone mode. |
336 if(!iImgViewerMode && iMediaList->Count()) |
339 if( !iImgViewerMode ) |
337 { |
340 { |
338 iHdmiController = CGlxHdmiController::NewL(); |
341 iHdmiController = CGlxHdmiController::NewL(); |
339 iOldFocusIndex = iMediaList->FocusIndex(); |
342 SetItemToHDMIL(); |
340 SetImageL(); |
|
341 } |
343 } |
342 iScreenFurniture->SetActiveView(iViewUid); |
344 iScreenFurniture->SetActiveView(iViewUid); |
343 |
345 |
344 // create the screen furniture for touch devices |
346 // create the screen furniture for touch devices |
345 CreateScreenFurnitureL(); |
347 CreateScreenFurnitureL(); |
350 GlxSetAppState::SetState(EGlxInFullScreenView); |
352 GlxSetAppState::SetState(EGlxInFullScreenView); |
351 |
353 |
352 // create the coverflow |
354 // create the coverflow |
353 CreateCoverflowWidgetL(); |
355 CreateCoverflowWidgetL(); |
354 |
356 |
355 |
|
356 CreateSliderWidgetL(); |
357 CreateSliderWidgetL(); |
357 |
358 |
358 // iMediaKeyUtility = CGlxMediaKeyUtility::NewL(); |
359 iBusyIcon = CGlxFullScreenBusyIcon::NewL(*iMediaList,*iUiUtility); |
359 |
|
360 // create a zoom control |
360 // create a zoom control |
361 iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList, |
361 iZoomControl = CGlxZoomControl::NewL(*this, *iMediaList, |
362 *iZoomButtonGroup, *iSliderWidget, iGestureHelper); |
362 *iZoomButtonGroup, *iSliderWidget, iGestureHelper); |
363 |
|
364 // Create the Metapane |
|
365 //iSingleLineMetaPane = CGlxSingleLineMetaPane::NewL(*this,*iMediaList,*iUiUtility); |
|
366 |
363 |
367 // hide the screen furniture |
364 // hide the screen furniture |
368 HideUi(ETrue); |
365 HideUi(ETrue); |
369 // Set active media list pointer, so that UPnP renderer knows about this list |
366 // Set active media list pointer, so that UPnP renderer knows about this list |
370 iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); |
367 iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); |
371 |
368 |
372 //Get the HgContextUtility instance |
369 if ( !iPeriodic->IsActive() ) |
373 // iContextUtility = iUiUtility->ContextUtility(); |
370 { |
374 |
371 iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay, |
375 // if the Medialist has any item, set the First index context to Hg Context Utility |
372 TCallBack(&PeriodicCallback, static_cast<TAny*> (this))); |
376 // TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() ); |
373 } |
377 // iContextUtility->PublishPhotoContextL(item.Uri()); |
|
378 if ( !iPeriodic->IsActive() ) |
|
379 { |
|
380 iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay, |
|
381 TCallBack(&PeriodicCallback, static_cast<TAny*> (this))); |
|
382 } |
|
383 } |
374 } |
384 |
375 |
385 |
376 |
386 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
387 // Creates a coverflow widget |
378 // Creates a coverflow widget |
491 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail); |
479 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail); |
492 |
480 |
493 TBool isDrmRightsValid = ETrue; |
481 TBool isDrmRightsValid = ETrue; |
494 if(item.IsDrmProtected()) |
482 if(item.IsDrmProtected()) |
495 { |
483 { |
496 isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(), |
484 //Fix for ESLM-82WJ59: Since it is always for the focused item - use DisplayRightsL instead of openrightsL |
497 (item.Category() == EMPXImage)); |
485 isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage)); |
498 } |
486 } |
499 |
487 |
500 // Display slider only for non corrupted images and items with valid DRM license |
488 // Display slider only for non corrupted images and items with valid DRM license |
501 if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid) |
489 if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid) |
502 { |
490 { |
697 |
682 |
698 // Check if DRM rights expired for a specific media item |
683 // Check if DRM rights expired for a specific media item |
699 TBool isDrmRightsValid = ETrue; |
684 TBool isDrmRightsValid = ETrue; |
700 if(item.IsDrmProtected()) |
685 if(item.IsDrmProtected()) |
701 { |
686 { |
702 isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(), |
687 //Fix for ESLM-82WJ59: DRM Rights validity check for displayed item |
703 (item.Category() == EMPXImage)); |
688 isDrmRightsValid = iDrmUtility->CheckDisplayRightsL(item.Uri(), (item.Category() == EMPXImage)); |
704 } |
689 } |
705 // Activate Zoom if the item is an image and its DRM rights is not expired |
690 // Activate Zoom if the item is an image and its DRM rights is not expired |
706 if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid) |
691 if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid) |
707 { |
692 { |
708 if(iZoomControl && !iZoomControl->Activated()) |
693 if(iZoomControl && !iZoomControl->Activated()) |
709 { |
694 { |
710 if(iHdmiController) |
695 if(iHdmiController) |
711 { |
696 { |
712 iHdmiController->ActivateZoom(); |
697 TBool autoZoomOut = ETrue; |
|
698 //Set autozoomout to false in pinch zoom, since we would be |
|
699 //zooming out on deactivate once we get the release event. |
|
700 if(aStartMode == EZoomStartPinch) |
|
701 { |
|
702 autoZoomOut = EFalse; |
|
703 } |
|
704 |
|
705 iHdmiController->ActivateZoom(autoZoomOut); |
713 } |
706 } |
714 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, |
707 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, |
715 item, apZoomFocus,iImgViewerMode); |
708 item, apZoomFocus,iImgViewerMode); |
716 // Now to remove all textures other than the one we are focussing on. |
709 // Now to remove all textures other than the one we are focussing on. |
717 TInt count = iMediaList->Count(); |
710 TInt count = iMediaList->Count(); |
739 // --------------------------------------------------------------------------- |
732 // --------------------------------------------------------------------------- |
740 // |
733 // |
741 void CGlxFullScreenViewImp::DeactivateZoomControlL() |
734 void CGlxFullScreenViewImp::DeactivateZoomControlL() |
742 { |
735 { |
743 TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL"); |
736 TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL"); |
744 ActivateFullScreenL(); |
737 ActivateFullScreenL(); |
|
738 //Deactivate HDMI controller for zoom out while pinch zooming. |
|
739 if(iHdmiController) |
|
740 { |
|
741 iHdmiController->DeactivateZoom(); |
|
742 } |
745 if(iZoomControl->Activated()) |
743 if(iZoomControl->Activated()) |
746 { |
744 { |
747 iZoomControl->Deactivate(); |
745 iZoomControl->Deactivate(); |
748 } |
746 } |
749 //Once into fullscreen view,show the screen furniture |
747 //Once into fullscreen view,show the screen furniture |
750 HideUi(ETrue); |
748 HideUi(ETrue); |
751 } |
749 } |
756 // --------------------------------------------------------------------------- |
754 // --------------------------------------------------------------------------- |
757 // |
755 // |
758 void CGlxFullScreenViewImp::DoMLViewDeactivate() |
756 void CGlxFullScreenViewImp::DoMLViewDeactivate() |
759 { |
757 { |
760 TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate"); |
758 TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate"); |
761 // if Medialist Count is Zero, set the navigation state to |
759 //Fix for ESLM-82WJ59: Clear the last uri for which DRM Rights were consumed before going back to grid view |
762 // EGlxNavigationBackwards before going back to grid view |
760 //since the GridView::Activate() and FullScreen::DeActivate() can be called in any order, |
763 if(iMediaList->Count() == 0) |
761 //this call is being made to be on safer side |
764 { |
762 iDrmUtility->ClearLastConsumedItemUri(); |
765 iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards); |
|
766 } |
|
767 iScreenFurniture->ViewDeactivated(iViewUid); |
763 iScreenFurniture->ViewDeactivated(iViewUid); |
768 iImgViewerMode = EFalse; |
764 iImgViewerMode = EFalse; |
769 if (iHdmiController) |
765 if (iHdmiController) |
770 { |
766 { |
771 delete iHdmiController; |
767 delete iHdmiController; |
991 { |
987 { |
992 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap"); |
988 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap"); |
993 |
989 |
994 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); |
990 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); |
995 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint; |
991 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint; |
996 SetSliderLevel(); |
992 TInt focus = iMediaList->FocusIndex(); |
997 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) ); |
993 TGlxMedia item = iMediaList->Item( focus ); |
|
994 TSize size; |
|
995 item.GetDimensions( size ); |
|
996 TRect rect = AlfUtil::ScreenSize(); |
|
997 TInt zoomLevel = GetInitialZoomLevel(); |
|
998 TInt tlX = (rect.Width() - (size.iWidth*zoomLevel)/100)/2; |
|
999 TInt tlY = (rect.Height() - (size.iHeight*zoomLevel)/100)/2; |
|
1000 TRect imageRect(TPoint(tlX, tlY), TSize((size.iWidth*zoomLevel)/100, (size.iHeight*zoomLevel)/100)); |
|
1001 if (imageRect.Contains(doubleTapPoint)) |
|
1002 { |
|
1003 SetSliderLevel(); |
|
1004 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) ); |
|
1005 } |
998 return EEventConsumed; |
1006 return EEventConsumed; |
999 } |
1007 } |
1000 case ETypeItemRemoved: |
1008 case ETypeItemRemoved: |
1001 { |
1009 { |
1002 if(iHdmiController) |
1010 SetItemToHDMIL(); |
1003 { |
|
1004 SetImageL(); |
|
1005 } |
|
1006 iOldFocusIndex = iMediaList->FocusIndex(); |
|
1007 return EEventConsumed; |
1011 return EEventConsumed; |
1008 } |
1012 } |
1009 case ETypeHighlight: |
1013 case ETypeHighlight: |
1010 { |
1014 { |
1011 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); |
1015 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); |
1060 } |
1060 } |
1061 return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). |
1061 return EEventConsumed; // will be consumed even if we are pinching IN (trying to zoom OUT). |
1062 //slider event handling |
1062 //slider event handling |
1063 case ETypePrimaryValueChange: |
1063 case ETypePrimaryValueChange: |
1064 { |
1064 { |
1065 // Zoomview is only launched if the currentslider value is above the level |
|
1066 // of fullscreenlevel. |
|
1067 iTimer->Cancel(); |
1065 iTimer->Cancel(); |
1068 iSliderWidget->ShowWidget( ETrue, 0 ); |
1066 iSliderWidget->ShowWidget( ETrue, 0 ); |
1069 TRAP_IGNORE( ActivateZoomControlL(EZoomStartSlider)); |
1067 TRAPD( err, ActivateZoomControlL(EZoomStartSlider)); |
|
1068 if (err != KErrNone) |
|
1069 { |
|
1070 iSliderModel->SetPrimaryValue(GetInitialZoomLevel()); |
|
1071 } |
1070 } |
1072 } |
1071 return EEventConsumed; |
1073 return EEventConsumed; |
1072 default: |
1074 default: |
1073 return EEventNotHandled; |
1075 return EEventNotHandled; |
1074 } |
1076 } |
1428 TRACER("CGlxFullScreenViewImp::RemoveTexture"); |
1423 TRACER("CGlxFullScreenViewImp::RemoveTexture"); |
1429 |
1424 |
1430 const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved()); |
1425 const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved()); |
1431 iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); |
1426 iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse); |
1432 } |
1427 } |
|
1428 |
1433 // --------------------------------------------------------------------------- |
1429 // --------------------------------------------------------------------------- |
1434 // |
1430 // |
1435 // Set the image to external display - HDMI |
1431 // Set the image to external display - HDMI |
1436 // --------------------------------------------------------------------------- |
1432 // --------------------------------------------------------------------------- |
1437 // |
1433 // |
1438 void CGlxFullScreenViewImp::SetImageL() |
1434 void CGlxFullScreenViewImp::SetItemToHDMIL() |
1439 { |
1435 { |
1440 TRACER("CGlxFullScreenViewImp::SetImageL - CGlxHdmi"); |
1436 TRACER("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi"); |
1441 TGlxMedia item = iMediaList->Item(iMediaList->FocusIndex()); |
1437 |
|
1438 TInt focusIndex = iMediaList->FocusIndex(); |
|
1439 |
|
1440 // If we dont know what item we are focussing on |
|
1441 // or if out medialist is empty |
|
1442 // or if HDMI is not connected |
|
1443 // or if there is no HDMI Controller at all |
|
1444 // then dont SetImageToHDMI :) |
|
1445 if( ( KErrNotFound == focusIndex) |
|
1446 || (0 == iMediaList->Count()) |
|
1447 || (NULL == iHdmiController) |
|
1448 || (!iHdmiController->IsHDMIConnected())) |
|
1449 { |
|
1450 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Cant Set Image To HDMI"); |
|
1451 return; |
|
1452 } |
|
1453 |
|
1454 TGlxMedia item = iMediaList->Item(focusIndex); |
1442 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
1455 TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
1443 KGlxMediaIdThumbnail); |
1456 KGlxMediaIdThumbnail); |
1444 if (item.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL( |
1457 |
1445 item.Uri(), ETrue) && (error == KErrNone)) |
1458 // Item will be supported by HDMI ONLY if |
1446 { |
1459 // it is not a video |
|
1460 // and it has valid DRM Viewing rights |
|
1461 // and it has no attribute error |
|
1462 if ( (item.Category() != EMPXVideo) |
|
1463 && iDrmUtility->CheckOpenRightsL(item.Uri(), ETrue) |
|
1464 && (error == KErrNone) ) |
|
1465 { |
|
1466 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - CGlxHdmi - Setting the Image"); |
1447 TInt frameCount(0); |
1467 TInt frameCount(0); |
1448 TSize orignalSize; |
1468 TSize orignalSize; |
1449 TBool aFramesPresent = item.GetFrameCount(frameCount); |
1469 item.GetFrameCount(frameCount); |
1450 TBool adimension = item.GetDimensions(orignalSize); |
1470 item.GetDimensions(orignalSize); |
1451 iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); |
1471 iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount); |
1452 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling SetImage"); |
|
1453 } |
1472 } |
1454 else |
1473 else |
1455 { |
1474 { |
1456 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling IsVideo"); |
1475 GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageToHDMIL - Unsupported Item"); |
1457 //Set the external display to cloning mode. |
1476 //Set the external display to cloning mode if |
1458 //If the current item is a video, corruted thumbnail |
1477 //the current item is something we dont support |
1459 iHdmiController->IsVideo(); |
1478 //(e.g. video, corrupted item, item with invalid DRM); |
1460 } |
1479 iHdmiController->ItemNotSupported(); |
1461 } |
1480 } |
|
1481 iOldFocusIndex = iMediaList->FocusIndex(); |
|
1482 } |
|
1483 // --------------------------------------------------------------------------- |
|
1484 // HarvestingUpdated |
|
1485 // |
|
1486 // --------------------------------------------------------------------------- |
|
1487 // |
|
1488 void CGlxFullScreenViewImp::HarvestingUpdated( |
|
1489 HarvesterEventObserverType HarvestingUpdated, |
|
1490 HarvesterEventState aHarvesterEventState, |
|
1491 TInt aItemsLeft ) |
|
1492 { |
|
1493 TRACER("CGlxFullScreenViewImp::HarvestingUpdated()"); |
|
1494 if(HarvestingUpdated == EHEObserverTypeMMC) |
|
1495 { |
|
1496 if(iZoomControl && iZoomControl->Activated()) |
|
1497 { |
|
1498 SetSliderLevel(); |
|
1499 DeactivateZoomControlL(); |
|
1500 } |
|
1501 ProcessCommandL(EAknSoftkeyClose); |
|
1502 } |
|
1503 } |