photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 9 6b87b143d312
parent 4 57d388cc48c1
child 13 71da52165949
equal deleted inserted replaced
5:f7f0874bfe7d 9:6b87b143d312
    65 #include <glxdrmutility.h>
    65 #include <glxdrmutility.h>
    66 #include <glxscreenfurniture.h>
    66 #include <glxscreenfurniture.h>
    67 //#include <glxsinglelinemetapanecontrol.h>
    67 //#include <glxsinglelinemetapanecontrol.h>
    68 #include "glxfullscreenviewimp.h"
    68 #include "glxfullscreenviewimp.h"
    69 #include <glxnavigationalstate.h>
    69 #include <glxnavigationalstate.h>
       
    70 #include <glxmedia.h>
       
    71 #include <glxnavigationalstate.h>
       
    72 #include <mpxcollectionpath.h>
       
    73 #include <glxcollectionpluginimageviewer.hrh>
    70 
    74 
    71 using namespace Alf;
    75 using namespace Alf;
    72 
    76 
    73 const TInt KGlxScreenTimeout =10000000;
    77 const TInt KGlxScreenTimeout =10000000;
    74 const TInt KCoverflowDataWindowSize = 1;
    78 const TInt KCoverflowDataWindowSize = 1;
   148 	MLViewBaseConstructL (aMediaListFactory, aTitle , EFalse);
   152 	MLViewBaseConstructL (aMediaListFactory, aTitle , EFalse);
   149 	
   153 	
   150 	iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   154 	iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
   151 	//Register the view to recieve toolbar events. ViewBase handles the events
   155 	//Register the view to recieve toolbar events. ViewBase handles the events
   152 	SetToolbarObserver(this);
   156 	SetToolbarObserver(this);
   153 	
   157 	iImgViewerMode = EFalse;
   154 	// Presently image viewer dont have toolbar
   158 	// Presently image viewer dont have toolbar
   155 	// So need to remove if image viewer using full screen
   159 	// So need to remove if image viewer using full screen
   156 	CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
   160 	CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
   157 	CleanupClosePushL( *navigationalState );
   161 	CleanupClosePushL( *navigationalState );
   158 	CMPXCollectionPath* naviState = navigationalState->StateLC();
   162 	CMPXCollectionPath* naviState = navigationalState->StateLC();
   291     CAknToolbar* toolbar = Toolbar();
   295     CAknToolbar* toolbar = Toolbar();
   292     if(toolbar)
   296     if(toolbar)
   293         {
   297         {
   294         toolbar->SetToolbarVisibility(EFalse); 
   298         toolbar->SetToolbarVisibility(EFalse); 
   295         }
   299         }
   296     	//Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   300 
   297 	if(!iMediaList->Count())
   301     CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
       
   302     CleanupClosePushL( *navigationalState );
       
   303     CMPXCollectionPath* naviState = navigationalState->StateLC();
       
   304     
       
   305     if(!iMediaList->Count())
   298 		{
   306 		{
   299 	  	CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
   307         //Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   300 	  	CleanupClosePushL( *navigationalState );
   308         navigationalState->ActivatePreviousViewL();
   301 	  	navigationalState->ActivatePreviousViewL();
   309         }  
   302 	  	CleanupStack::PopAndDestroy( navigationalState );
   310 	
   303 		}  
   311     if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
   304 	//need to create the instance first,other wise panics while
   312         {
   305 	// zooming from imgvwr.
   313         iImgViewerMode = ETrue;
   306 	iHdmiController = CGlxHdmiController::NewL();
   314         }
   307 	if(iMediaList->Count())
   315     //destroy and close navistate and navipath
   308 	    {
   316     CleanupStack::PopAndDestroy( naviState );
   309 	    iOldFocusIndex = iMediaList->FocusIndex(); 
   317     CleanupStack::PopAndDestroy( navigationalState );
       
   318 
       
   319     //Create hdmicontroller when it is only launched from fullscreen.  
       
   320     //From filemanager show only clone mode.
       
   321     if(!iImgViewerMode && iMediaList->Count())    
       
   322         {
       
   323         iHdmiController = CGlxHdmiController::NewL();    
       
   324         iOldFocusIndex = iMediaList->FocusIndex(); 
   310         TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   325         TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   311         GLX_LOG_INFO("CGlxHdmi - CGlxFullScreenViewImp Create HdmiController");
   326         GLX_LOG_INFO("CGlxHdmi - CGlxFullScreenViewImp Create HdmiController");
   312         if (item.Category() != EMPXVideo)
   327         
       
   328         //check if the content  is not video && has proper DRM rights
       
   329         //then only call setimage in HDMI
       
   330         if (item.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL(item.Uri(),ETrue))
   313             {
   331             {
   314             TInt frameCount(0);
   332             TInt frameCount(0);
   315             TSize orignalSize;
   333             TSize orignalSize;
   316             TBool aFramesPresent  = item.GetFrameCount(frameCount);
   334             TBool aFramesPresent  = item.GetFrameCount(frameCount);
   317             TBool adimension  = item.GetDimensions(orignalSize);
   335             TBool adimension  = item.GetDimensions(orignalSize);
   318             iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
   336             iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
   319             }    
   337             }    
   320 	    }
   338         }
       
   339 
   321     iScreenFurniture->SetActiveView(iViewUid);
   340     iScreenFurniture->SetActiveView(iViewUid);
   322 
   341 
   323     // create the screen furniture for touch devices
   342     // create the screen furniture for touch devices
   324     CreateScreenFurnitureL();
   343     CreateScreenFurnitureL();
   325     
   344     
   466     TRACER("CGlxFullScreenViewImp::ShowUiL");
   485     TRACER("CGlxFullScreenViewImp::ShowUiL");
   467 
   486 
   468     TInt index = iMediaList->FocusIndex();
   487     TInt index = iMediaList->FocusIndex();
   469     const TGlxMedia& item = iMediaList->Item(index);
   488     const TGlxMedia& item = iMediaList->Item(index);
   470     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   489     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(), KGlxMediaIdThumbnail);
   471     // Display slider only for non corrupted images
   490        
   472     if (error == KErrNone && item.Category() == EMPXImage)
   491     TBool isDrmRightsValid = ETrue;
       
   492 	if(item.IsDrmProtected())
       
   493 		{
       
   494 		isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(),
       
   495 												(item.Category() == EMPXImage));
       
   496 		}
       
   497 	
       
   498     // Display slider only for non corrupted images and items with valid DRM license
       
   499     if (error == KErrNone && item.Category() == EMPXImage && isDrmRightsValid)
   473         {
   500         {
   474         //To set the Slider values.
   501         //To set the Slider values.
   475         SetSliderLevel();
   502         SetSliderLevel();
   476         //show the slider
   503         //show the slider
   477         iSliderWidget->ShowWidget(ETrue);
   504         iSliderWidget->ShowWidget(ETrue);
   663     {
   690     {
   664     TRACER("CGlxFullScreenViewImp::ActivateZoomControlL");
   691     TRACER("CGlxFullScreenViewImp::ActivateZoomControlL");
   665     TInt focus = iMediaList->FocusIndex();
   692     TInt focus = iMediaList->FocusIndex();
   666     TGlxMedia item = iMediaList->Item( focus );
   693     TGlxMedia item = iMediaList->Item( focus );
   667     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties() , KGlxMediaIdThumbnail);
   694     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties() , KGlxMediaIdThumbnail);
   668            
   695    
   669     if(KErrNone == error)
   696     // Check if DRM rights expired for a specific media item 
   670         {        
   697     TBool isDrmRightsValid = ETrue;
   671         if(EMPXImage == item.Category())
   698     if(item.IsDrmProtected())
       
   699     	{
       
   700     	isDrmRightsValid = iDrmUtility->CheckOpenRightsL(item.Uri(),
       
   701 												(item.Category() == EMPXImage));
       
   702     	}
       
   703     // Activate Zoom if the item is an image and its DRM rights is not expired
       
   704     if(KErrNone == error && (EMPXImage == item.Category()) && isDrmRightsValid)
       
   705         {
       
   706         if(iZoomControl && !iZoomControl->Activated())
   672             {
   707             {
   673             if(iZoomControl && !iZoomControl->Activated())
   708             if(iHdmiController)
   674                 {
   709                 {
   675                 iHdmiController->ActivateZoom();
   710                 iHdmiController->ActivateZoom();
   676                 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, item, apZoomFocus);
   711                 }
   677 
   712             iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus,
   678                 // Now to remove all textures other than the one we are focussing on.  
   713                                         item, apZoomFocus,iImgViewerMode);
   679                 TInt count = iMediaList->Count();
   714             // Now to remove all textures other than the one we are focussing on.  
   680                 while (count > 0)
   715             TInt count = iMediaList->Count();
       
   716             while (count > 0)
       
   717                 {
       
   718                 TGlxMedia mediaItem = iMediaList->Item(count-1);	
       
   719                 if (mediaItem.Id() != item.Id() )
   681                     {
   720                     {
   682                     TGlxMedia mediaItem = iMediaList->Item(count-1);	
   721                     iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse);
   683                     if (mediaItem.Id() != item.Id() )
       
   684                         {
       
   685                         iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse);
       
   686                         }
       
   687                     count--;
       
   688                     }
   722                     }
       
   723                 count--;
   689                 }
   724                 }
   690             else
       
   691                 {
       
   692                 return;
       
   693                 }
       
   694             DeactivateFullScreen();
       
   695            	GlxSetAppState::SetState(EGlxInZoomedView);
       
   696             }
   725             }
       
   726         else
       
   727             {
       
   728             return;
       
   729             }
       
   730         DeactivateFullScreen();
       
   731         GlxSetAppState::SetState(EGlxInZoomedView);
   697         }
   732         }
   698     }
   733     }
   699 
   734 
   700 // ---------------------------------------------------------------------------
   735 // ---------------------------------------------------------------------------
   701 //DeactivateZoomControl function.
   736 //DeactivateZoomControl function.
   719 // ---------------------------------------------------------------------------
   754 // ---------------------------------------------------------------------------
   720 //
   755 //
   721 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   756 void CGlxFullScreenViewImp::DoMLViewDeactivate()
   722     {
   757     {
   723     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
   758     TRACER("CGlxFullScreenViewImp::DoMLViewDeactivate");
       
   759     // if Medialist Count is Zero, set the navigation state to 
       
   760     // EGlxNavigationBackwards before going back to grid view
       
   761     if(iMediaList->Count() == 0)
       
   762     	{
       
   763     	iUiUtility->SetViewNavigationDirection(EGlxNavigationBackwards);
       
   764     	} 
   724     iScreenFurniture->ViewDeactivated(iViewUid);
   765     iScreenFurniture->ViewDeactivated(iViewUid);
       
   766     iImgViewerMode = EFalse;
   725     if (iHdmiController)
   767     if (iHdmiController)
   726         {
   768         {
   727         delete iHdmiController;
   769         delete iHdmiController;
   728         iHdmiController = NULL;
   770         iHdmiController = NULL;
   729         }
   771         }
   767         iZoomControl->HandleZoomForegroundEvent(aForeground);
   809         iZoomControl->HandleZoomForegroundEvent(aForeground);
   768         }
   810         }
   769 
   811 
   770     if (!aForeground)
   812     if (!aForeground)
   771         {
   813         {
       
   814         
       
   815         if(iHdmiController)
       
   816 			{   
       
   817             iHdmiController->ShiftToCloningMode();
       
   818 			}
       
   819         
   772         iUiUtility->GlxTextureManager().FlushTextures();
   820         iUiUtility->GlxTextureManager().FlushTextures();
   773         }
   821         }
   774     else
   822     else
   775         {
   823         {
   776         if (iMediaList && iMediaList->Count() && iMediaListMulModelProvider)
   824         if (iMediaList && iMediaList->Count() && iMediaListMulModelProvider)
   777             {
   825             {
   778             TInt focusIndex = iMediaList->FocusIndex();
   826             TInt focusIndex = iMediaList->FocusIndex();
   779             iMediaListMulModelProvider->UpdateItems(focusIndex, 1);
   827             iMediaListMulModelProvider->UpdateItems(focusIndex, 1);
       
   828             
       
   829             if(iHdmiController)
       
   830 				{    
       
   831                 iHdmiController->ShiftToPostingMode();
       
   832 				}
   780             }
   833             }
   781         }
   834         }
   782     }
   835     }
   783 
   836 
   784 
   837 
   956 				TGlxMedia item1 = iMediaList->Item( iMediaList->FocusIndex() );
  1009 				TGlxMedia item1 = iMediaList->Item( iMediaList->FocusIndex() );
   957                 TInt frameCount(0);
  1010                 TInt frameCount(0);
   958                 TSize orignalSize;
  1011                 TSize orignalSize;
   959                 TBool aFramesPresent  = item1.GetFrameCount(frameCount);
  1012                 TBool aFramesPresent  = item1.GetFrameCount(frameCount);
   960                 TBool adimension  = item1.GetDimensions(orignalSize);
  1013                 TBool adimension  = item1.GetDimensions(orignalSize);
   961                 if (item1.Category() != EMPXVideo)
  1014 
       
  1015                 //check if the content  is not video && has proper DRM rights
       
  1016                 //then only call next image in HDMI
       
  1017                 if(iHdmiController)
   962                     {
  1018                     {
   963                     GLX_LOG_INFO("CGlxHdmi - FullscreenView - SetImageL");                    
  1019                     if (item1.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL(item1.Uri(),ETrue))
   964                     iHdmiController->SetImageL(item1.Uri(), orignalSize, frameCount);
  1020                         {
       
  1021                         GLX_LOG_INFO("CGlxHdmi - FullscreenView - SetImageL");                    
       
  1022                         iHdmiController->SetImageL(item1.Uri(), orignalSize, frameCount);
       
  1023                         }
       
  1024                     else
       
  1025                         {
       
  1026                         iHdmiController->IsVideo();                    
       
  1027                         }
   965                     }
  1028                     }
   966                 else
       
   967                     {                    
       
   968                     iHdmiController->IsVideo();                    
       
   969 				    }	                    
       
   970                 iOldFocusIndex = iMediaList->FocusIndex();
  1029                 iOldFocusIndex = iMediaList->FocusIndex();
   971                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
  1030                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
   972                     {
  1031                     {
   973                     HideUi(ETrue);
  1032                     HideUi(ETrue);
   974                     }
  1033                     }
  1236 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()
  1295 void CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()
  1237 	{
  1296 	{
  1238 	TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1297 	TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1239 	if(iMediaList->Count()>0)
  1298 	if(iMediaList->Count()>0)
  1240 		{
  1299 		{
  1241 	const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1300         const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1242 	if (media.IsDrmProtected())
  1301         if (media.IsDrmProtected())
  1243 		{
  1302             {
  1244 			const TDesC& uri = media.Uri();
  1303             const TDesC& uri = media.Uri();
  1245 			if ( !iDrmUtility->CheckOpenRightsL(uri , (media.Category() == EMPXImage)) && ( uri.Length()>0 ))
  1304             ConsumeDRMRightsL(uri);
  1246 				{
  1305             }
  1247 				iDrmUtility->ShowRightsInfoL(uri);
  1306          }
  1248 				}
       
  1249 			}
       
  1250 		}
       
  1251 	}
  1307 	}
       
  1308 
       
  1309 // ---------------------------------------------------------------------------
       
  1310 // 
       
  1311 // consumes DRM rights for DRM files, can leave
       
  1312 // ---------------------------------------------------------------------------
       
  1313 //
       
  1314 void CGlxFullScreenViewImp::ConsumeDRMRightsL( const TDesC& uri )
       
  1315     {
       
  1316     TRACER("CGlxFullScreenViewImp::ConsumeDRMRightsL");
       
  1317     if( uri.Length() > 0 )
       
  1318         {
       
  1319         // check if rights have expired
       
  1320         TBool expired = !iDrmUtility->CheckOpenRightsL(uri,ETrue);
       
  1321         if(expired)
       
  1322             {
       
  1323             iDrmUtility->ShowRightsInfoL(uri);
       
  1324             return;
       
  1325             }
       
  1326         iDrmUtility->ConsumeRightsL(uri);                        
       
  1327         }     
       
  1328     }
       
  1329 
  1252 // ---------------------------------------------------------------------------
  1330 // ---------------------------------------------------------------------------
  1253 // 
  1331 // 
  1254 // Gets the Swipe direction
  1332 // Gets the Swipe direction
  1255 // ---------------------------------------------------------------------------
  1333 // ---------------------------------------------------------------------------
  1256 //
  1334 //