photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 13 71da52165949
parent 9 6b87b143d312
child 14 ce1c7ad1f18b
equal deleted inserted replaced
9:6b87b143d312 13:71da52165949
    83 const TInt KGlxSliderTickValue        =5;
    83 const TInt KGlxSliderTickValue        =5;
    84 /**
    84 /**
    85  * Start Delay for the periodic timer, in microseconds
    85  * Start Delay for the periodic timer, in microseconds
    86  */
    86  */
    87 const TInt KPeriodicStartDelay = 250000; 
    87 const TInt KPeriodicStartDelay = 250000; 
       
    88 /**
       
    89  * Interval delay for the periodic timer, in microseconds
       
    90  */
       
    91 const TInt KPeriodicIntervalDelay = 100000; 
       
    92 
    88 //This constant is used to calculate the index of the item for which texture has to removed.
    93 //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);
    94 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index);
    90 const TInt KFullScreenIterator = 3; 
    95 const TInt KFullScreenIterator = 3; 
    91 //Constant which says maximum number of fullscreen textures that we have have at a time.
    96 //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))
    97 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards))
   305     if(!iMediaList->Count())
   310     if(!iMediaList->Count())
   306 		{
   311 		{
   307         //Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   312         //Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   308         navigationalState->ActivatePreviousViewL();
   313         navigationalState->ActivatePreviousViewL();
   309         }  
   314         }  
       
   315 	else
       
   316 		{
       
   317 		//fix for ESLM-7YYDXC: When in FullScreen View, view mode must be 'EView'
       
   318 		//While coming back from SlideShow to FullScreen view, need to set view mode.
       
   319 		if(navigationalState->ViewingMode() != NGlxNavigationalState::EView)
       
   320 		   	{
       
   321 		   	navigationalState->SetToViewMode();
       
   322 		   	}
       
   323 		}
       
   324 		
   310 	
   325 	
   311     if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
   326     if(naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
   312         {
   327         {
   313         iImgViewerMode = ETrue;
   328         iImgViewerMode = ETrue;
   314         }
   329         }
   319     //Create hdmicontroller when it is only launched from fullscreen.  
   334     //Create hdmicontroller when it is only launched from fullscreen.  
   320     //From filemanager show only clone mode.
   335     //From filemanager show only clone mode.
   321     if(!iImgViewerMode && iMediaList->Count())    
   336     if(!iImgViewerMode && iMediaList->Count())    
   322         {
   337         {
   323         iHdmiController = CGlxHdmiController::NewL();    
   338         iHdmiController = CGlxHdmiController::NewL();    
   324         iOldFocusIndex = iMediaList->FocusIndex(); 
   339         iOldFocusIndex = iMediaList->FocusIndex();
   325         TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   340         SetImageL();
   326         GLX_LOG_INFO("CGlxHdmi - CGlxFullScreenViewImp Create HdmiController");
   341         }
   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))
       
   331             {
       
   332             TInt frameCount(0);
       
   333             TSize orignalSize;
       
   334             TBool aFramesPresent  = item.GetFrameCount(frameCount);
       
   335             TBool adimension  = item.GetDimensions(orignalSize);
       
   336             iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
       
   337             }    
       
   338         }
       
   339 
       
   340     iScreenFurniture->SetActiveView(iViewUid);
   342     iScreenFurniture->SetActiveView(iViewUid);
   341 
   343 
   342     // create the screen furniture for touch devices
   344     // create the screen furniture for touch devices
   343     CreateScreenFurnitureL();
   345     CreateScreenFurnitureL();
   344     
   346     
   373     // if the Medialist has any item, set the First index context to Hg Context Utility
   375     // if the Medialist has any item, set the First index context to Hg Context Utility
   374 //    TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   376 //    TGlxMedia item = iMediaList->Item( iMediaList->FocusIndex() );
   375 //    iContextUtility->PublishPhotoContextL(item.Uri());
   377 //    iContextUtility->PublishPhotoContextL(item.Uri());
   376     	if ( !iPeriodic->IsActive() )
   378     	if ( !iPeriodic->IsActive() )
   377 		{
   379 		{
   378 		iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, TCallBack( 
   380         iPeriodic->Start(KPeriodicStartDelay, KPeriodicIntervalDelay,
   379 		        &PeriodicCallback, static_cast<TAny*>( this ) ) );
   381                 TCallBack(&PeriodicCallback, static_cast<TAny*> (this)));
   380 		}
   382 		}
   381 	}
   383 	}
   382 	
   384 	
   383 
   385 
   384 // ---------------------------------------------------------------------------
   386 // ---------------------------------------------------------------------------
   990                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap");   
   992                 GLX_LOG_INFO("CGlxFullScreenViewImp::OfferEventL ETypeDoubleTap");   
   991 
   993 
   992                 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); 
   994                 MulDoubleTapData* DoubleTapData = (MulDoubleTapData*)(aEvent.CustomEventData()); 
   993                 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint;
   995                 TPoint doubleTapPoint = DoubleTapData->mDoubleTapPoint;
   994                 SetSliderLevel();
   996                 SetSliderLevel();
   995                 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint)  );
   997                 TRAP_IGNORE( ActivateZoomControlL(EZoomStartDoubleTap, &doubleTapPoint) );
       
   998                 return EEventConsumed;
       
   999                 }
       
  1000             case ETypeItemRemoved:
       
  1001                 {
       
  1002                 if(iHdmiController)
       
  1003                     {
       
  1004                      SetImageL();
       
  1005                     }
       
  1006                 iOldFocusIndex = iMediaList->FocusIndex();
   996                 return EEventConsumed;
  1007                 return EEventConsumed;
   997                 }
  1008                 }
   998             case ETypeHighlight:
  1009             case ETypeHighlight:
   999                 {
  1010                 {
  1000                 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); 
  1011                 iMediaList->SetFocusL( NGlxListDefs::EAbsolute,(aEvent.CustomEventData())); 
  1004                 	}
  1015                 	}
  1005                 if(iMediaList->Count()> KFullScreenTextureOffset)
  1016                 if(iMediaList->Count()> KFullScreenTextureOffset)
  1006                     {
  1017                     {
  1007                     RemoveTexture();
  1018                     RemoveTexture();
  1008                     }
  1019                     }
  1009 				TGlxMedia item1 = iMediaList->Item( iMediaList->FocusIndex() );
       
  1010                 TInt frameCount(0);
       
  1011                 TSize orignalSize;
       
  1012                 TBool aFramesPresent  = item1.GetFrameCount(frameCount);
       
  1013                 TBool adimension  = item1.GetDimensions(orignalSize);
       
  1014 
       
  1015                 //check if the content  is not video && has proper DRM rights
       
  1016                 //then only call next image in HDMI
       
  1017                 if(iHdmiController)
  1020                 if(iHdmiController)
  1018                     {
  1021                     {
  1019                     if (item1.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL(item1.Uri(),ETrue))
  1022                      SetImageL();
  1020                         {
       
  1021                         GLX_LOG_INFO("CGlxHdmi - FullscreenView - SetImageL");                    
       
  1022                         iHdmiController->SetImageL(item1.Uri(), orignalSize, frameCount);
       
  1023                         }
       
  1024                     else
       
  1025                         {
       
  1026                         iHdmiController->IsVideo();                    
       
  1027                         }
       
  1028                     }
  1023                     }
  1029                 iOldFocusIndex = iMediaList->FocusIndex();
  1024                 iOldFocusIndex = iMediaList->FocusIndex();
  1030                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
  1025                 if ( NGlxNFullScreenUIState::EUiOn == GetUiSate() )
  1031                     {
  1026                     {
  1032                     HideUi(ETrue);
  1027                     HideUi(ETrue);
  1101 		case EGlxCmdFullScreenBack:
  1096 		case EGlxCmdFullScreenBack:
  1102 		    SetSliderLevel();
  1097 		    SetSliderLevel();
  1103 		    DeactivateZoomControlL();
  1098 		    DeactivateZoomControlL();
  1104 		    consumed = ETrue;
  1099 		    consumed = ETrue;
  1105 		    break;
  1100 		    break;
       
  1101 		case EGlxCmdRenameCompleted:
       
  1102 		    {
       
  1103             if (iHdmiController)
       
  1104                 {
       
  1105                 SetImageL();
       
  1106                 }
       
  1107 			consumed = ETrue;
       
  1108             break;
       
  1109             }
  1106 //		case EGlxCmdRotateLeft:
  1110 //		case EGlxCmdRotateLeft:
  1107 //			iCoverFlowWidget->RotateImage(IMulWidget::ERotateLeft,size,KGlxRotationDelay);
  1111 //			iCoverFlowWidget->RotateImage(IMulWidget::ERotateLeft,size,KGlxRotationDelay);
  1108 //		    consumed = ETrue;
  1112 //		    consumed = ETrue;
  1109 //		    break;
  1113 //		    break;
  1110 //		case EGlxCmdRotateRight:
  1114 //		case EGlxCmdRotateRight:
  1137 //
  1141 //
  1138  void CGlxFullScreenViewImp::HandleResourceChangeL (TInt aType)
  1142  void CGlxFullScreenViewImp::HandleResourceChangeL (TInt aType)
  1139      {
  1143      {
  1140      TRACER("CGlxFullScreenViewImp::HandleResourceChangeL");
  1144      TRACER("CGlxFullScreenViewImp::HandleResourceChangeL");
  1141          HandleResourceChangeL ( aType);
  1145          HandleResourceChangeL ( aType);
  1142          switch (aType)
       
  1143              {
       
  1144         case KEikDynamicLayoutVariantSwitch:
       
  1145             {
       
  1146             //if resolution changed
       
  1147 //                 iSliderWidget->control()->Display()->SetVisibleArea( ClientRect() );
       
  1148             break;
       
  1149             }
       
  1150         }       
       
  1151     }   
  1146     }   
  1152 
  1147 
  1153 //----------------------------------------------------------------------------------
  1148 //----------------------------------------------------------------------------------
  1154 // InitialZoomLevel:Calculate the initial Zoom Level for the Image
  1149 // InitialZoomLevel:Calculate the initial Zoom Level for the Image
  1155 //----------------------------------------------------------------------------------
  1150 //----------------------------------------------------------------------------------
  1275 // -----------------------------------------------------------------------------
  1270 // -----------------------------------------------------------------------------
  1276 //
  1271 //
  1277 inline void CGlxFullScreenViewImp::CallPeriodicCallback()
  1272 inline void CGlxFullScreenViewImp::CallPeriodicCallback()
  1278     {
  1273     {
  1279     TRACER("CGlxFullScreenViewImp::CallPeriodicCallback");
  1274     TRACER("CGlxFullScreenViewImp::CallPeriodicCallback");
  1280     if(iPeriodic->IsActive())
       
  1281 		{
       
  1282 		iPeriodic->Cancel();
       
  1283 		}
       
  1284     /*
       
  1285      * function can leave
       
  1286      */
       
  1287     TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1275     TRAP_IGNORE(ShowDrmExpiaryNoteL());
  1288     }
  1276     }
  1289 	
  1277 	
  1290 // ---------------------------------------------------------------------------
  1278 // ---------------------------------------------------------------------------
  1291 // 
  1279 // 
  1296 	{
  1284 	{
  1297 	TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1285 	TRACER("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL");
  1298 	if(iMediaList->Count()>0)
  1286 	if(iMediaList->Count()>0)
  1299 		{
  1287 		{
  1300         const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1288         const TGlxMedia& media = iMediaList->Item(iMediaList->FocusIndex());
  1301         if (media.IsDrmProtected())
  1289         TInt tnError = GlxErrorManager::HasAttributeErrorL(
       
  1290                 media.Properties(), KGlxMediaIdThumbnail);
       
  1291         GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
       
  1292                 " tnError=%d ", tnError);
       
  1293 
       
  1294         TSize tnSize = iUiUtility->DisplaySize();
       
  1295         TMPXAttribute qtyTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail,
       
  1296                 GlxFullThumbnailAttributeId(ETrue, tnSize.iWidth,
       
  1297                         tnSize.iHeight));
       
  1298         const CGlxThumbnailAttribute* qtyTn = media.ThumbnailAttribute(
       
  1299                 qtyTnAttrib);
       
  1300 
       
  1301         if (qtyTn)
  1302             {
  1302             {
       
  1303             if (iPeriodic->IsActive())
       
  1304                 {
       
  1305                 iPeriodic->Cancel();
       
  1306                 }
       
  1307             }
       
  1308 
       
  1309         if (tnError == KErrNone && qtyTn && media.IsDrmProtected())
       
  1310             {
       
  1311             GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
       
  1312                     "- ConsumeDRMRightsL()");
  1303             const TDesC& uri = media.Uri();
  1313             const TDesC& uri = media.Uri();
  1304             ConsumeDRMRightsL(uri);
  1314             ConsumeDRMRightsL(uri);
       
  1315             }
       
  1316 
       
  1317         if (tnError != KErrNone)
       
  1318             {
       
  1319             if (iPeriodic->IsActive())
       
  1320                 {
       
  1321                 iPeriodic->Cancel();
       
  1322                 }
       
  1323 
       
  1324             CGlxNavigationalState* navigationalState =
       
  1325                     CGlxNavigationalState::InstanceL();
       
  1326             CleanupClosePushL(*navigationalState);
       
  1327             CMPXCollectionPath* naviState = navigationalState->StateLC();
       
  1328             if (naviState->Id() == TMPXItemId(
       
  1329                     KGlxCollectionPluginImageViewerImplementationUid))
       
  1330                 {
       
  1331                 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiaryNoteL()"
       
  1332                         "- ShowErrorNoteL()");
       
  1333                 GlxGeneralUiUtilities::ShowErrorNoteL(tnError);
       
  1334                 }
       
  1335             CleanupStack::PopAndDestroy(naviState);
       
  1336             CleanupStack::PopAndDestroy(navigationalState);
  1305             }
  1337             }
  1306          }
  1338          }
  1307 	}
  1339 	}
  1308 
  1340 
  1309 // ---------------------------------------------------------------------------
  1341 // ---------------------------------------------------------------------------
  1396     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1428     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1397     
  1429     
  1398     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1430     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1399     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1431     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1400     }
  1432     }
       
  1433 // ---------------------------------------------------------------------------
       
  1434 // 
       
  1435 // Set the image to external display - HDMI
       
  1436 // ---------------------------------------------------------------------------
       
  1437 //
       
  1438 void CGlxFullScreenViewImp::SetImageL()
       
  1439     {
       
  1440     TRACER("CGlxFullScreenViewImp::SetImageL - CGlxHdmi");
       
  1441     TGlxMedia item = iMediaList->Item(iMediaList->FocusIndex());
       
  1442     TInt error = GlxErrorManager::HasAttributeErrorL(item.Properties(),
       
  1443             KGlxMediaIdThumbnail);
       
  1444     if (item.Category() != EMPXVideo && iDrmUtility->CheckOpenRightsL(
       
  1445             item.Uri(), ETrue) && (error == KErrNone))
       
  1446         {
       
  1447         TInt frameCount(0);
       
  1448         TSize orignalSize;
       
  1449         TBool aFramesPresent = item.GetFrameCount(frameCount);
       
  1450         TBool adimension = item.GetDimensions(orignalSize);
       
  1451         iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
       
  1452         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling SetImage");
       
  1453         }
       
  1454     else
       
  1455         {
       
  1456         GLX_LOG_INFO("CGlxFullScreenViewImp::SetImageL - CGlxHdmi - calling IsVideo");
       
  1457         //Set the external display to cloning mode.
       
  1458         //If the current item is a video, corruted thumbnail
       
  1459         iHdmiController->IsVideo();
       
  1460         }
       
  1461     }