photosgallery/viewframework/views/fullscreenview/src/glxfullscreenviewimp.cpp
branchRCL_3
changeset 47 f9e827349359
parent 35 420f6808bf21
child 56 b023a8d2866a
equal deleted inserted replaced
35:420f6808bf21 47:f9e827349359
    94 /**
    94 /**
    95  * Interval delay for the periodic timer, in microseconds
    95  * Interval delay for the periodic timer, in microseconds
    96  */
    96  */
    97 const TInt KPeriodicIntervalDelay = 500000; 
    97 const TInt KPeriodicIntervalDelay = 500000; 
    98 
    98 
    99 //This constant is used to calculate the index of the item for which texture has to removed.
    99 /** 
   100 //6 = 5(iterator value in forward or backward direction for fullscreen) + 1(focus index)
   100  * Fullscreen texture offset 
   101 const TInt KFullScreenIterator = 3; 
   101  */ 
   102 //Constant which says maximum number of fullscreen textures that we have have at a time.
   102 const TInt KTextureOffset = 2; 
   103 //11 = (5(5 fullscreen texture backwards)+1(fucus index texture)+5(5 fullscreen texture forwards))
   103 
   104 const TInt KFullScreenTextureOffset = 5;
   104 // This constant is used to calculate the index of the item 
       
   105 // for which texture has to removed.
       
   106 const TInt KFullScreenIterator = KTextureOffset + 1; 
       
   107 
       
   108 // This constant is used to calculate the maximum number of fullscreen textures 
       
   109 // needs to be updated during foreground event.
       
   110 const TInt KFullScreenTextureOffset = KFullScreenIterator + KTextureOffset;
       
   111 
   105 const TInt KGlxDecodingThreshold = 3000000; // pixels
   112 const TInt KGlxDecodingThreshold = 3000000; // pixels
   106 
   113 
   107 _LIT( KTfxResourceActivateFullScreen, "z:\\resource\\effects\\photos_fullscreen_open.fxml" );
   114 _LIT( KTfxResourceActivateFullScreen, "z:\\resource\\effects\\photos_fullscreen_open.fxml" );
   108 _LIT( KTfxResourceNoEffect, "");
   115 _LIT( KTfxResourceNoEffect, "");
   109 
   116 
   352     iHdmiWidth = (iScrnSize.iWidth > iScrnSize.iHeight ?iScrnSize.iWidth :iScrnSize.iHeight);
   359     iHdmiWidth = (iScrnSize.iWidth > iScrnSize.iHeight ?iScrnSize.iWidth :iScrnSize.iHeight);
   353     iHdmiHeight = (iScrnSize.iWidth < iScrnSize.iHeight ?iScrnSize.iWidth :iScrnSize.iHeight);
   360     iHdmiHeight = (iScrnSize.iWidth < iScrnSize.iHeight ?iScrnSize.iWidth :iScrnSize.iHeight);
   354 
   361 
   355     //Create hdmicontroller when it is only launched from fullscreen.  
   362     //Create hdmicontroller when it is only launched from fullscreen.  
   356     //From filemanager show only clone mode.
   363     //From filemanager show only clone mode.
       
   364     iHdmiController = CGlxHdmiController::NewL(*this); 
       
   365     
   357     if( !iImgViewerMode )    
   366     if( !iImgViewerMode )    
   358         {
   367         {
   359         iHdmiController = CGlxHdmiController::NewL(*this);    
       
   360         SetItemToHDMIL();
   368         SetItemToHDMIL();
   361         }
   369         }
   362     iScreenFurniture->SetActiveView(iViewUid);
   370     iScreenFurniture->SetActiveView(iViewUid);
   363     
   371     
   364     //set the ui state to off,when the Fullscreen launches
   372     //set the ui state to off,when the Fullscreen launches
   697     TRACER("CGlxFullScreenViewImp::ActivateZoomControlL");
   705     TRACER("CGlxFullScreenViewImp::ActivateZoomControlL");
   698     /*
   706     /*
   699      * We will not do any zoom while HDMI is connected.
   707      * We will not do any zoom while HDMI is connected.
   700      * This is as part of HDMI improvements.
   708      * This is as part of HDMI improvements.
   701      */
   709      */
   702     if (!iImgViewerMode && iHdmiController 
   710     if (iHdmiController && iHdmiController->IsHDMIConnected())
   703 				&& iHdmiController->IsHDMIConnected())
       
   704         {
   711         {
   705         // Hide zoom slider in HDMI mode as Zoom is disable.
   712         // Hide zoom slider in HDMI mode as Zoom is disable.
   706         // Let the other screen furnitures intact.
   713         // Let the other screen furnitures intact.
   707         iSliderWidget->ShowWidget( EFalse);
   714         iSliderWidget->ShowWidget( EFalse);
   708         return;
   715         return;
   791 //
   798 //
   792 void CGlxFullScreenViewImp::DeactivateZoomControlL()
   799 void CGlxFullScreenViewImp::DeactivateZoomControlL()
   793     {
   800     {
   794     TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL");
   801     TRACER("CGlxFullScreenViewImp::DeactivateZoomControlL");
   795     ActivateFullScreenL();
   802     ActivateFullScreenL();
       
   803     UpdateItems();
   796     //Deactivate HDMI controller for zoom out while pinch zooming.
   804     //Deactivate HDMI controller for zoom out while pinch zooming.
   797     if(iHdmiController)
   805     if(iHdmiController)
   798         {
   806         {
   799         iHdmiController->DeactivateZoom();
   807         iHdmiController->DeactivateZoom();
   800         }
   808         }
   948 				navigationalState ->ActivatePreviousViewL();
   956 				navigationalState ->ActivatePreviousViewL();
   949 				CleanupStack::PopAndDestroy(navigationalState);
   957 				CleanupStack::PopAndDestroy(navigationalState);
   950 				}
   958 				}
   951 			else if (iMediaListMulModelProvider)
   959 			else if (iMediaListMulModelProvider)
   952 				{
   960 				{
   953 				TInt focusIndex = iMediaList->FocusIndex();
   961 	            UpdateItems();
   954 				iMediaListMulModelProvider->UpdateItems(focusIndex, 1);
       
   955 
   962 
   956 				if (iHdmiController)
   963 				if (iHdmiController)
   957 					{
   964 					{
   958 					iHdmiController->ShiftToPostingMode();
   965 					iHdmiController->ShiftToPostingMode();
   959 					}
   966 					}
  1273 // From HandleCommandL..
  1280 // From HandleCommandL..
  1274 // ---------------------------------------------------------------------------
  1281 // ---------------------------------------------------------------------------
  1275 //
  1282 //
  1276  void CGlxFullScreenViewImp::HandleCommandL(TInt aCommandId, CAlfControl* aControl) 
  1283  void CGlxFullScreenViewImp::HandleCommandL(TInt aCommandId, CAlfControl* aControl) 
  1277 	 {
  1284 	 {
  1278 	 TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl");
  1285     TRACER("CGlxFullScreenViewImp::HandleCommandLCAlfControl");
  1279 	 //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel
  1286     //Gets a callback from zoomview if zoomlevel goes beyound the launch zoomlevel
  1280 	 // and activates the fullscreenview
  1287     // and activates the fullscreenview
  1281 	 if((aControl == iZoomControl)&& (aCommandId == KGlxZoomOutCommand))
  1288     if (aControl == iZoomControl)
  1282 	     {
  1289         {
  1283 	     SetSliderLevel();
  1290         if (aCommandId == KGlxZoomOutCommand)
  1284 	     DeactivateZoomControlL();
  1291             {
  1285 	     }
  1292             SetSliderLevel();
  1286 	 } 
  1293             DeactivateZoomControlL();
       
  1294             }
       
  1295         else if(aCommandId == KGlxZoomOrientationChange)
       
  1296             {
       
  1297             iViewWidget->setRect(TRect(TPoint(0,0),AlfUtil::ScreenSize()));
       
  1298             }
       
  1299         }
       
  1300 	} 
  1287 
  1301 
  1288 // ---------------------------------------------------------------------------
  1302 // ---------------------------------------------------------------------------
  1289 // From HandleResourceChangeL..
  1303 // From HandleResourceChangeL..
  1290 // ---------------------------------------------------------------------------
  1304 // ---------------------------------------------------------------------------
  1291 //
  1305 //
  1499             if (iPeriodic->IsActive())
  1513             if (iPeriodic->IsActive())
  1500                 {
  1514                 {
  1501                 iPeriodic->Cancel();
  1515                 iPeriodic->Cancel();
  1502                 }
  1516                 }
  1503 
  1517 
  1504             CGlxNavigationalState* navigationalState =
  1518             if (iImgViewerMode)
  1505                     CGlxNavigationalState::InstanceL();
  1519                 {
  1506             CleanupClosePushL(*navigationalState);
  1520                 GLX_LOG_INFO1("CGlxFullScreenViewImp::ShowDrmExpiryNoteL()"
  1507             CMPXCollectionPath* naviState = navigationalState->StateLC();
  1521                         "- ShowErrorNoteL(%d)", tnError);
  1508             if (naviState->Id() == TMPXItemId(
  1522                 if (tnError == KErrNoMemory || tnError == KErrNotSupported
  1509                     KGlxCollectionPluginImageViewerImplementationUid))
  1523                         || tnError == KErrInUse || tnError == KErrDiskFull
  1510                 {
  1524                         || tnError == KErrTimedOut || tnError
  1511                 GLX_LOG_INFO("CGlxFullScreenViewImp::ShowDrmExpiryNoteL()"
  1525                         == KErrPermissionDenied)
  1512                         "- ShowErrorNoteL()");
  1526                     {
  1513                 GlxGeneralUiUtilities::ShowErrorNoteL(tnError);
  1527                     GlxGeneralUiUtilities::ShowErrorNoteL(tnError);
  1514                 }
  1528                     }
  1515             CleanupStack::PopAndDestroy(naviState);
  1529                 else
  1516             CleanupStack::PopAndDestroy(navigationalState);
  1530                     {
       
  1531                     // Generic "Unable to open image" error note
       
  1532                     HBufC* str = StringLoader::LoadLC(
       
  1533                             R_GLX_ERR_FORMAT_UNKNOWN);
       
  1534                     CAknErrorNote* note = new (ELeave) CAknErrorNote(ETrue);
       
  1535                     note->ExecuteLD(*str); // ignore return value, not used
       
  1536                     CleanupStack::PopAndDestroy(str);
       
  1537                     }
       
  1538                 }
  1517             }
  1539             }
  1518         }
  1540         }
  1519     }
  1541     }
  1520 
  1542 
  1521 // ---------------------------------------------------------------------------
  1543 // ---------------------------------------------------------------------------
  1789 // 
  1811 // 
  1790 // ---------------------------------------------------------------------------
  1812 // ---------------------------------------------------------------------------
  1791 void CGlxFullScreenViewImp::NavigateToMainListL()
  1813 void CGlxFullScreenViewImp::NavigateToMainListL()
  1792     {
  1814     {
  1793     TRACER("CGlxFullScreenViewImp::NavigateToMainListL()");
  1815     TRACER("CGlxFullScreenViewImp::NavigateToMainListL()");
  1794     CGlxNavigationalState* navigationalState =  CGlxNavigationalState::InstanceL();
  1816     if (!iImgViewerMode)
  1795     CleanupClosePushL( *navigationalState );
  1817         {
  1796     CMPXCollectionPath* naviState = navigationalState->StateLC();
  1818         if (iZoomControl && iZoomControl->Activated())
  1797     if (naviState->Id() != TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
  1819             {
  1798         {
  1820             SetSliderLevel();
  1799         if(iZoomControl && iZoomControl->Activated())
  1821             DeactivateZoomControlL();
  1800         	{
  1822             }
  1801         	SetSliderLevel();
  1823         ProcessCommandL( EAknSoftkeyClose);
  1802 		    DeactivateZoomControlL();	
  1824         }
  1803         	}
       
  1804         ProcessCommandL(EAknSoftkeyClose);
       
  1805         }
       
  1806     CleanupStack::PopAndDestroy(naviState);
       
  1807     CleanupStack::PopAndDestroy(navigationalState);
       
  1808     }
  1825     }
  1809 	
  1826 	
  1810 // ---------------------------------------------------------------------------
  1827 // ---------------------------------------------------------------------------
  1811 // HandleMMCRemovalL
  1828 // HandleMMCRemovalL
  1812 // 
  1829 // 
  1946 void CGlxFullScreenViewImp::HandleHDMIDecodingEventL(
  1963 void CGlxFullScreenViewImp::HandleHDMIDecodingEventL(
  1947         THdmiDecodingStatus /*aStatus*/)
  1964         THdmiDecodingStatus /*aStatus*/)
  1948     {
  1965     {
  1949     TRACER("CGlxFullScreenViewImp::HandleHDMIDecodingEventL()");
  1966     TRACER("CGlxFullScreenViewImp::HandleHDMIDecodingEventL()");
  1950     }
  1967     }
       
  1968 
       
  1969 // ---------------------------------------------------------------------------
       
  1970 // UpdateItems
       
  1971 // ---------------------------------------------------------------------------
       
  1972 void CGlxFullScreenViewImp::UpdateItems()
       
  1973     {
       
  1974     TRACER("CGlxFullScreenViewImp::UpdateItems()");
       
  1975     TInt focusIndex = iMediaList->FocusIndex();
       
  1976     TInt count = iMediaList->Count();
       
  1977     GLX_LOG_INFO2("CGlxFullScreenViewImp::UpdateItems()"
       
  1978             " focusIndex(%d), count(%d)", focusIndex, count);
       
  1979     
       
  1980     if (focusIndex != KErrNotFound && count)
       
  1981         {        
       
  1982         // update the focus index first
       
  1983 		iMediaListMulModelProvider->UpdateItems(focusIndex, 1);
       
  1984 
       
  1985         TInt startIndex = focusIndex;
       
  1986         TInt iteratorCount = (KTextureOffset > count) ? 
       
  1987                                 count : KTextureOffset;
       
  1988         TInt textureCount = (KFullScreenTextureOffset > count)?
       
  1989                                 count : KFullScreenTextureOffset;
       
  1990 
       
  1991         startIndex = focusIndex - iteratorCount;
       
  1992         if (startIndex < 0)
       
  1993             {
       
  1994             startIndex = count + startIndex;
       
  1995             }
       
  1996 
       
  1997         TInt i = 0;
       
  1998         //Update all the textures in the window
       
  1999         while (i < textureCount)
       
  2000             {
       
  2001             if (startIndex != focusIndex)
       
  2002                 {
       
  2003                 GLX_LOG_INFO1("CGlxFullScreenViewImp::UpdateItems(%d)", startIndex);
       
  2004                 iMediaListMulModelProvider->UpdateItems(startIndex, 1);
       
  2005                 }
       
  2006             if (++startIndex == count)
       
  2007                 {
       
  2008                 startIndex = 0;
       
  2009                 }
       
  2010             i++;
       
  2011             }
       
  2012         
       
  2013         // When the focused index is first or last, 
       
  2014         // need to update the items adjacent to KFullScreenIterator also!
       
  2015         if (count > (KFullScreenTextureOffset))
       
  2016             {
       
  2017             TInt lastIndex = count - 1;
       
  2018             if (focusIndex == 0)
       
  2019                 {
       
  2020                 iMediaListMulModelProvider->UpdateItems(KFullScreenIterator,
       
  2021                         1);
       
  2022                 }
       
  2023             else if (focusIndex == lastIndex)
       
  2024                 {
       
  2025                 iMediaListMulModelProvider->UpdateItems(lastIndex
       
  2026                         - KFullScreenIterator, 1);
       
  2027                 }
       
  2028             }
       
  2029         }
       
  2030     }