photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
changeset 1 9ba538e329bd
parent 0 4e91876724a2
child 2 7d9067c6fcb1
equal deleted inserted replaced
0:4e91876724a2 1:9ba538e329bd
    72 
    72 
    73 //To disable AppUi status pane
    73 //To disable AppUi status pane
    74 #define GetAppViewUi() (dynamic_cast<CAknViewAppUi*>(CEikonEnv::Static()->EikAppUi()))
    74 #define GetAppViewUi() (dynamic_cast<CAknViewAppUi*>(CEikonEnv::Static()->EikAppUi()))
    75 const TInt KGlxScreenTimeout =10000000;
    75 const TInt KGlxScreenTimeout =10000000;
    76 const TInt KCoverflowDataWindowSize = 1;
    76 const TInt KCoverflowDataWindowSize = 1;
    77 const TInt KGlxRotationDelay = 800;    // Milliseconds
       
    78 const TInt KGlxMaxSmallImageZoomLevel =150;
    77 const TInt KGlxMaxSmallImageZoomLevel =150;
    79 const TInt KGlxMaxBigImageZoomLevel   =100;
    78 const TInt KGlxMaxBigImageZoomLevel   =100;
    80 const TInt KGlxMinSmallImageZoomLevel =100;
    79 const TInt KGlxMinSmallImageZoomLevel =100;
    81 const TInt KGlxNeutralPinchPosition   =100;
    80 const TInt KGlxNeutralPinchPosition   =100;
    82 const TInt KGlxSliderTickValue        =5;
    81 const TInt KGlxSliderTickValue        =5;
    83 _LIT(KGlxIconsFilename, "glxicons.mif");
       
    84 /**
    82 /**
    85  * Start Delay for the periodic timer, in microseconds
    83  * Start Delay for the periodic timer, in microseconds
    86  */
    84  */
    87 const TInt KPeriodicStartDelay = 250000; 
    85 const TInt KPeriodicStartDelay = 250000; 
    88 //This constant is used to calculate the index of the item for which texture has to removed.
    86 //This constant is used to calculate the index of the item for which texture has to removed.
   289 void CGlxFullScreenViewImp::DoMLViewActivateL(
   287 void CGlxFullScreenViewImp::DoMLViewActivateL(
   290 		const TVwsViewId & /* aPrevViewId */, TUid /* aCustomMessageId */,
   288 		const TVwsViewId & /* aPrevViewId */, TUid /* aCustomMessageId */,
   291 		const TDesC8 & /* aCustomMessage */)
   289 		const TDesC8 & /* aCustomMessage */)
   292 	{
   290 	{
   293     TRACER("CGlxFullScreenViewImp::DoMLViewActivateL");
   291     TRACER("CGlxFullScreenViewImp::DoMLViewActivateL");
       
   292     // hide the toolbar
       
   293     CAknToolbar* toolbar = Toolbar();
       
   294     if(toolbar)
       
   295         {
       
   296         toolbar->SetToolbarVisibility(EFalse); 
       
   297         }
   294     	//Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   298     	//Fix For EPKA-7U5DT7-slideshow launched from FullScreen and connect USB in mass storage mode results in Photos crash
   295 	if(!iMediaList->Count())
   299 	if(!iMediaList->Count())
   296 		{
   300 		{
   297 	  	CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
   301 	  	CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
   298 	  	CleanupClosePushL( *navigationalState );
   302 	  	CleanupClosePushL( *navigationalState );
   315             TBool adimension  = item.GetDimensions(orignalSize);
   319             TBool adimension  = item.GetDimensions(orignalSize);
   316             iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
   320             iHdmiController->SetImageL(item.Uri(), orignalSize, frameCount);
   317             }    
   321             }    
   318 	    }
   322 	    }
   319     iScreenFurniture->SetActiveView(iViewUid);
   323     iScreenFurniture->SetActiveView(iViewUid);
       
   324 
       
   325     // create the screen furniture for touch devices
       
   326     CreateScreenFurnitureL();
   320     
   327     
   321     //set the ui state to off,when the Fullscreen launches
   328     //set the ui state to off,when the Fullscreen launches
   322     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   329     SetUiSate(NGlxNFullScreenUIState::EUiOff);
   323    
   330    
   324    	GlxSetAppState::SetState(EGlxInFullScreenView);
   331    	GlxSetAppState::SetState(EGlxInFullScreenView);
   325    	 
   332    	 
   326     // create the coverflow
   333     // create the coverflow
   327     CreateCoverflowWidgetL();
   334     CreateCoverflowWidgetL();
   328     
   335     
   329     // create the screen furniture for touch devices
       
   330     CreateScreenFurnitureL();
       
   331     
   336     
   332     CreateSliderWidgetL();
   337     CreateSliderWidgetL();
   333     
   338     
   334 //    iMediaKeyUtility = CGlxMediaKeyUtility::NewL();
   339 //    iMediaKeyUtility = CGlxMediaKeyUtility::NewL();
   335     
   340     
   389     iCoverFlowWidget = widgetFactory.createWidget<IMulCoverFlowWidget> (
   394     iCoverFlowWidget = widgetFactory.createWidget<IMulCoverFlowWidget> (
   390             KWidgetName, KCoverflowWidget, *iViewWidget, NULL);			
   395             KWidgetName, KCoverflowWidget, *iViewWidget, NULL);			
   391     iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap);
   396     iCoverFlowWidget->SetFlags(IMulMultiItemWidget::EMulWidgetDoubleTap);
   392 
   397 
   393     // Widget takes the ownership
   398     // Widget takes the ownership
   394         iCoverFlowWidget->AddEventHandler (*this);
   399     iCoverFlowWidget->AddEventHandler (*this);
   395     
   400 
   396         // hide appui's status pane  
   401     // hide appui's status pane  
   397         GetAppViewUi()->StatusPane()->MakeVisible(EFalse);
   402     GetAppViewUi()->StatusPane()->MakeVisible(EFalse);
   398     
   403 
   399         // hide appui's softkeys
   404     // hide appui's softkeys
   400         GetAppViewUi()->Cba()->MakeVisible(EFalse);
   405     GetAppViewUi()->Cba()->MakeVisible(EFalse);
   401     iCoverFlowWidget->ShowWidget(ETrue);
   406     iCoverFlowWidget->ShowWidget(ETrue);
   402     iCoverFlowWidget->control()->AcquireFocus();
   407     iCoverFlowWidget->control()->AcquireFocus();
   403 
   408 
   404         iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL (*iEnv,
   409         iMediaListMulModelProvider = CGlxMediaListMulModelProvider::NewL (*iEnv,
   405                 *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet,
   410                 *iCoverFlowWidget, *iMediaList, iFullScreenBindingSet,
   553     TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL");
   558     TRACER("CGlxFullScreenViewImp::CreateScreenFurnitureL");
   554     // create the softkeys
   559     // create the softkeys
   555     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
   560     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
   556     CleanupStack::PushL( cba );
   561     CleanupStack::PushL( cba );
   557     cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS);
   562     cba->SetCommandSetL(R_GLX_FULLSCREEN_SOFTKEYS);
       
   563     // hide the softkeys
       
   564     cba->MakeVisible( EFalse );
       
   565     cba->DrawNow();
   558     CleanupStack::Pop(cba);
   566     CleanupStack::Pop(cba);
   559     }
   567     }
   560 
   568 
   561 // ---------------------------------------------------------------------------
   569 // ---------------------------------------------------------------------------
   562 // SetUiSate
   570 // SetUiSate
   663         if(EMPXImage == item.Category())
   671         if(EMPXImage == item.Category())
   664             {
   672             {
   665             if(iZoomControl && !iZoomControl->Activated())
   673             if(iZoomControl && !iZoomControl->Activated())
   666                 {
   674                 {
   667                 iHdmiController->ActivateZoom();
   675                 iHdmiController->ActivateZoom();
   668                 iZoomControl->ActivateL(GetIntialZoomLevel(),aStartMode, focus, item, apZoomFocus);
   676                 iZoomControl->ActivateL(GetInitialZoomLevel(),aStartMode, focus, item, apZoomFocus);
   669                 
   677 
   670                 //==Removing all textures other than the focussed one===============
   678                 // Now to remove all textures other than the one we are focussing on.  
   671                 TInt count = iMediaList->Count();
   679                 TInt count = iMediaList->Count();
   672                 
       
   673                 while (count > 0)
   680                 while (count > 0)
   674                     {
   681                     {
   675                     TGlxMedia mediaItem = iMediaList->Item(count-1);	
   682                     TGlxMedia mediaItem = iMediaList->Item(count-1);	
   676                     if (mediaItem.Id() != item.Id() )
   683                     if (mediaItem.Id() != item.Id() )
   677                         {
   684                         {
   678                         iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse);
   685                         iUiUtility->GlxTextureManager().RemoveTexture(mediaItem.Id(),EFalse);
   679                         }
   686                         }
   680                     count--;
   687                     count--;
   681                     }
   688                     }
   682                 //==\Removing all textures==============
       
   683                 }
   689                 }
   684             else
   690             else
   685                 {
   691                 {
   686                 return;
   692                 return;
   687                 }
   693                 }
   753 //
   759 //
   754 void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground)
   760 void CGlxFullScreenViewImp::HandleForegroundEventL(TBool aForeground)
   755     {
   761     {
   756     TRACER("CGlxFullScreenViewImp::HandleForegroundEventL");
   762     TRACER("CGlxFullScreenViewImp::HandleForegroundEventL");
   757     CAknView::HandleForegroundEventL(aForeground);
   763     CAknView::HandleForegroundEventL(aForeground);
       
   764     
   758 	
   765 	
   759 	if(!aForeground)
   766     if(iZoomControl && iZoomControl->Activated())
   760 	    {
   767         {
   761 	    if(iZoomControl && iZoomControl->Activated())
   768         iZoomControl->HandleZoomForegroundEvent(aForeground);
   762 	        {
   769         }
   763 			iZoomControl->HandleZoomForegroundEvent(aForeground);
   770 
   764 			}
   771     if (!aForeground)
   765 		}
   772         {
       
   773         iUiUtility->GlxTextureManager().FlushTextures();
       
   774         }
       
   775     else
       
   776         {
       
   777         if (iMediaList && iMediaList->Count() && iMediaListMulModelProvider)
       
   778             {
       
   779             TInt focusIndex = iMediaList->FocusIndex();
       
   780             iMediaListMulModelProvider->UpdateItems(focusIndex, 1);
       
   781             }
       
   782         }
   766     }
   783     }
   767 
   784 
   768 
   785 
   769 // ---------------------------------------------------------------------------
   786 // ---------------------------------------------------------------------------
   770 // From IAlfWidgetEventHandler..
   787 // From IAlfWidgetEventHandler..
  1051 	 TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl");
  1068 	 TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl");
  1052 	 //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel
  1069 	 //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel
  1053 	 // and activates the fullscreenview
  1070 	 // and activates the fullscreenview
  1054 	 if((aControl == iZoomControl)&& (aCommandId == KGlxZoomOutCommand))
  1071 	 if((aControl == iZoomControl)&& (aCommandId == KGlxZoomOutCommand))
  1055 	     {
  1072 	     {
  1056 	     	SetSliderLevel();
  1073 	     SetSliderLevel();
  1057         DeactivateZoomControlL();
  1074 	     DeactivateZoomControlL();
  1058         }
  1075 	     }
  1059     /*else if(aControl == iSingleLineMetaPane)
  1076 	 } 
  1060         {
       
  1061         ProcessCommandL(aCommandId);
       
  1062         }*/
       
  1063     } 
       
  1064 
  1077 
  1065 // ---------------------------------------------------------------------------
  1078 // ---------------------------------------------------------------------------
  1066 // From HandleResourceChangeL..
  1079 // From HandleResourceChangeL..
  1067 // ---------------------------------------------------------------------------
  1080 // ---------------------------------------------------------------------------
  1068 //
  1081 //
  1080             }
  1093             }
  1081         }       
  1094         }       
  1082     }   
  1095     }   
  1083 
  1096 
  1084 //----------------------------------------------------------------------------------
  1097 //----------------------------------------------------------------------------------
  1085 // IntialZoomLevel:Calculate the initial Zoom Level for the Image
  1098 // InitialZoomLevel:Calculate the initial Zoom Level for the Image
  1086 //----------------------------------------------------------------------------------
  1099 //----------------------------------------------------------------------------------
  1087 //
  1100 //
  1088 TInt CGlxFullScreenViewImp::GetIntialZoomLevel()
  1101 TInt CGlxFullScreenViewImp::GetInitialZoomLevel()
  1089     {
  1102     {
  1090     TRACER("CGlxFullScreenViewImp::IntialZoomLevel");
  1103     TRACER("CGlxFullScreenViewImp::InitialZoomLevel");
  1091     TInt focus     = iMediaList->FocusIndex();
  1104     TInt focus     = iMediaList->FocusIndex();
  1092     TGlxMedia item = iMediaList->Item( focus );
  1105     TGlxMedia item = iMediaList->Item( focus );
  1093     TSize size;
  1106     TSize size;
  1094     TUint8 initialZoomLevel;
  1107     TUint8 initialZoomLevel;
  1095     item.GetDimensions( size );
  1108     item.GetDimensions( size );
  1118 //
  1131 //
  1119 void CGlxFullScreenViewImp::SetSliderLevel()
  1132 void CGlxFullScreenViewImp::SetSliderLevel()
  1120     {
  1133     {
  1121     TRACER("CGlxFullScreenViewImp::SetSliderLevel");
  1134     TRACER("CGlxFullScreenViewImp::SetSliderLevel");
  1122 
  1135 
  1123     TInt value = GetIntialZoomLevel();
  1136     TInt value = GetInitialZoomLevel();
  1124     if(iSliderModel)
  1137     if(iSliderModel)
  1125         {
  1138         {
  1126         iSliderModel->SetMinRange(value);
  1139         iSliderModel->SetMinRange(value);
  1127         (value==KGlxMaxBigImageZoomLevel)?(iSliderModel->SetMaxRange(KGlxMaxSmallImageZoomLevel))
  1140         (value==KGlxMaxBigImageZoomLevel)?(iSliderModel->SetMaxRange(KGlxMaxSmallImageZoomLevel))
  1128             :(iSliderModel->SetMaxRange(KGlxMaxBigImageZoomLevel));
  1141             :(iSliderModel->SetMaxRange(KGlxMaxBigImageZoomLevel));
  1306 void CGlxFullScreenViewImp::RemoveTexture()
  1319 void CGlxFullScreenViewImp::RemoveTexture()
  1307     {
  1320     {
  1308     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1321     TRACER("CGlxFullScreenViewImp::RemoveTexture");
  1309     
  1322     
  1310     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1323     const TGlxMedia& item = iMediaList->Item(GetIndexToBeRemoved());
  1311      iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1324     iUiUtility->GlxTextureManager().RemoveTexture(item.Id(),EFalse);
  1312     }
  1325     }