photosgallery/viewframework/uiutilities/src/glxuiutility.cpp
branchRCL_3
changeset 14 2dac0fdba72b
parent 13 bcb43dc84c44
child 17 a60acebbbd9d
equal deleted inserted replaced
13:bcb43dc84c44 14:2dac0fdba72b
   237 	{
   237 	{
   238 	TRACER("CGlxUiUtility::ShowAlfDisplayL()");
   238 	TRACER("CGlxUiUtility::ShowAlfDisplayL()");
   239 	// make it visible as well
   239 	// make it visible as well
   240 	CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   240 	CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   241 
   241 
   242 	CCoeControl* contl = (CCoeControl*)uiUtility->Display()->ObjectProvider();
   242     CCoeControl* contl =
   243 	contl->MakeVisible (ETrue);
   243             (CCoeControl*) uiUtility->Display()->ObjectProvider();
       
   244     contl->MakeVisible(ETrue);
   244 
   245 
   245 	uiUtility->Close();
   246 	uiUtility->Close();
   246 	// no need to do anything else, the coecontrol handles the visibility
   247 	// no need to do anything else, the coecontrol handles the visibility
   247 	}
   248 	}
   248 
   249 
   253 	{
   254 	{
   254 	TRACER("CGlxUiUtility::HideAlfDisplayL()");
   255 	TRACER("CGlxUiUtility::HideAlfDisplayL()");
   255 	// make it invisible as well (this might be all that is needed)
   256 	// make it invisible as well (this might be all that is needed)
   256 	CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   257 	CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL();
   257 	
   258 	
   258 	CCoeControl* contl = (CCoeControl*)uiUtility->Display()->ObjectProvider();
   259     CCoeControl* contl =
       
   260             (CCoeControl*) uiUtility->Display()->ObjectProvider();
   259 	contl->MakeVisible (EFalse);
   261 	contl->MakeVisible (EFalse);
   260 	
   262 	
   261 	uiUtility->Close();
   263 	uiUtility->Close();
   262 	// no need to do anything else, the coecontrol handles the visibility
   264 	// no need to do anything else, the coecontrol handles the visibility
   263 	}
   265 	}
   264 	
   266 
   265 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   266 // GlxTextureManager
   268 // GlxTextureManager
   267 // -----------------------------------------------------------------------------
   269 // -----------------------------------------------------------------------------
   268 //
   270 //
   269 EXPORT_C CGlxTextureManager& CGlxUiUtility::GlxTextureManager()
   271 EXPORT_C CGlxTextureManager& CGlxUiUtility::GlxTextureManager()
   280 EXPORT_C TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection()
   282 EXPORT_C TGlxNavigationDirection CGlxUiUtility::ViewNavigationDirection()
   281     {
   283     {
   282     TRACER("CGlxUiUtility::ViewNavigationDirection()");
   284     TRACER("CGlxUiUtility::ViewNavigationDirection()");
   283     return iNavigationDirection;
   285     return iNavigationDirection;
   284     }
   286     }
   285     
       
   286 
   287 
   287 // -----------------------------------------------------------------------------
   288 // -----------------------------------------------------------------------------
   288 // SetViewNavigationDirection
   289 // SetViewNavigationDirection
   289 // -----------------------------------------------------------------------------
   290 // -----------------------------------------------------------------------------
   290 //
   291 //
   291 EXPORT_C void CGlxUiUtility::SetViewNavigationDirection(TGlxNavigationDirection aDirection)
   292 EXPORT_C void CGlxUiUtility::SetViewNavigationDirection(
       
   293         TGlxNavigationDirection aDirection)
   292     {
   294     {
   293     TRACER("CGlxUiUtility::SetViewNavigationDirection()");
   295     TRACER("CGlxUiUtility::SetViewNavigationDirection()");
   294     iNavigationDirection = aDirection;
   296     iNavigationDirection = aDirection;
   295     }
   297     }
   296 
   298 
   456 //
   458 //
   457 EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType aChangeType )
   459 EXPORT_C void CGlxUiUtility::HandleTvStatusChangedL( TTvChangeType aChangeType )
   458     {
   460     {
   459     TRACER("CGlxUiUtility::HandleTvStatusChangedL()");
   461     TRACER("CGlxUiUtility::HandleTvStatusChangedL()");
   460 
   462 
   461     if ( aChangeType == ETvDisplayNotVisible )         // Visibility event
   463     if (aChangeType == ETvDisplayNotVisible) // Visibility event
   462         {
   464         {
   463         iEnv->Release();
   465         iEnv->Release();
   464         return; // don't redraw the display
   466         return; // don't redraw the display
   465         }
   467         }
   466     else if ( aChangeType == ETvDisplayIsVisible )     // Visibility event
   468     else if (aChangeType == ETvDisplayIsVisible) // Visibility event
   467         {
   469         {
   468         iEnv->RestoreL();
   470         iEnv->RestoreL();
   469         }
   471         }
   470      else                                              // TV Connection event
   472     else // TV Connection event
   471         {
   473         {
   472         GLX_ASSERT_DEBUG( (aChangeType == ETvConnectionChanged), 
   474         GLX_ASSERT_DEBUG( (aChangeType == ETvConnectionChanged),
   473                             Panic( EGlxPanicLogicError ), 
   475                 Panic( EGlxPanicLogicError ),
   474                             "Expected TV Connection Changed" );
   476                 "Expected TV Connection Changed" );
   475 
   477 
   476         if ( iGlxTvOut->IsConnected() )
   478         if ( iGlxTvOut->IsConnected() )
   477             {
   479             {
   478             // Remove the TV Diplay - a ETvConnectionChanged may result from
   480             // Remove the TV Diplay - a ETvConnectionChanged may result from
   479             // the user changing the central repository TV values.
   481             // the user changing the central repository TV values.
   521     	// check if tv-out is connected
   523     	// check if tv-out is connected
   522         if ( iGlxTvOut->IsConnected() )
   524         if ( iGlxTvOut->IsConnected() )
   523             {
   525             {
   524         	// The primary (phone) display has changed orientation
   526         	// The primary (phone) display has changed orientation
   525         	DestroyTvOutDisplay();
   527         	DestroyTvOutDisplay();
   526                 CreateTvOutDisplayL(); //@ will generate false positive in codescanner
   528             CreateTvOutDisplayL(); //@ will generate false positive in codescanner
   527             }
   529             }
   528         else
   530         else
   529             {
   531             {
   530             // reset the screen size in case the orientation changed for example
   532             // reset the screen size in case the orientation changed for example
   531             iGlxResolutionManager->SetScreenSizeL( DisplaySize() );
   533             iGlxResolutionManager->SetScreenSizeL( DisplaySize() );
   546         iTvDisplay = NULL; 
   548         iTvDisplay = NULL; 
   547 
   549 
   548         iEnv->PauseRefresh();
   550         iEnv->PauseRefresh();
   549 
   551 
   550         // Disable Primary Window Visibility events
   552         // Disable Primary Window Visibility events
   551         CCoeControl* contl = (CCoeControl*)iEnv->PrimaryDisplay().ObjectProvider();
   553         CCoeControl* contl =
       
   554                 (CCoeControl*) iEnv->PrimaryDisplay().ObjectProvider();
   552         contl->DrawableWindow()->DisableVisibilityChangeEvents();
   555         contl->DrawableWindow()->DisableVisibilityChangeEvents();
   553         }
   556         }
   554     }
   557     }
   555        
   558        
   556         
   559         
   582 
   585 
   583 // -----------------------------------------------------------------------------
   586 // -----------------------------------------------------------------------------
   584 // AddSkinChangeObserverL
   587 // AddSkinChangeObserverL
   585 // -----------------------------------------------------------------------------
   588 // -----------------------------------------------------------------------------
   586 //
   589 //
   587 EXPORT_C void CGlxUiUtility::AddSkinChangeObserverL(MGlxSkinChangeObserver& aObserver)
   590 EXPORT_C void CGlxUiUtility::AddSkinChangeObserverL(
       
   591         MGlxSkinChangeObserver& aObserver)
   588     {
   592     {
   589     TRACER("CGlxUiUtility::AddSkinChangeObserverL()");
   593     TRACER("CGlxUiUtility::AddSkinChangeObserverL()");
   590     iGlxSkinChangeMonitor->AddSkinChangeObserverL( aObserver );
   594     iGlxSkinChangeMonitor->AddSkinChangeObserverL( aObserver );
   591     }
   595     }
   592     
   596 
   593 // -----------------------------------------------------------------------------
   597 // -----------------------------------------------------------------------------
   594 // RemoveSkinChangeObserver
   598 // RemoveSkinChangeObserver
   595 // -----------------------------------------------------------------------------
   599 // -----------------------------------------------------------------------------
   596 //    
   600 //    
   597 EXPORT_C void CGlxUiUtility::RemoveSkinChangeObserver(MGlxSkinChangeObserver& aObserver)
   601 EXPORT_C void CGlxUiUtility::RemoveSkinChangeObserver(
   598     {      
   602         MGlxSkinChangeObserver& aObserver)
       
   603     {
   599     TRACER("CGlxUiUtility::RemoveSkinChangeObserver()");
   604     TRACER("CGlxUiUtility::RemoveSkinChangeObserver()");
   600     iGlxSkinChangeMonitor->RemoveSkinChangeObserver( aObserver );
   605     iGlxSkinChangeMonitor->RemoveSkinChangeObserver( aObserver );
   601     }
   606     }
   602 
   607 
   603 // -----------------------------------------------------------------------------
   608 // -----------------------------------------------------------------------------
   632 // -----------------------------------------------------------------------------
   637 // -----------------------------------------------------------------------------
   633 // GridIconSize
   638 // GridIconSize
   634 // -----------------------------------------------------------------------------
   639 // -----------------------------------------------------------------------------
   635 //	
   640 //	
   636 void CGlxUiUtility::GridIconSizeL()
   641 void CGlxUiUtility::GridIconSizeL()
   637 	{
   642     {
   638 	TRACER("CGlxUiUtility::GridIconSize()");
   643     TRACER("CGlxUiUtility::GridIconSize()");
   639 	// Sets up TLS, must be done before FeatureManager is used.
   644     // Sets up TLS, must be done before FeatureManager is used.
   640 	    FeatureManager::InitializeLibL();
   645     FeatureManager::InitializeLibL();
   641 	    
   646 
   642 	  if(FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch ))
   647     if (FeatureManager::FeatureSupported(KFeatureIdLayout640_360_Touch)
   643 	      {
   648             || FeatureManager::FeatureSupported(KFeatureIdLayout360_640_Touch))
   644 	      iGridIconSize = TSize(111,83);
   649         {
   645 	      }
   650         iGridIconSize = TSize(111, 83);
   646 	  else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || 
   651         }
   647 	          FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || FeatureManager::FeatureSupported(KFeatureIdLayout480_640))
   652     else if (FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch)
   648 	      {
   653             || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch)
   649 	      iGridIconSize = TSize(146,110);
   654             || FeatureManager::FeatureSupported(KFeatureIdLayout640_480)
   650 	      }
   655             || FeatureManager::FeatureSupported(KFeatureIdLayout480_640))
   651 	  else
   656         {
   652 	      {
   657         iGridIconSize = TSize(146, 110);
   653 	      iGridIconSize = TSize(146,110);
   658         }
   654 	      }
   659     else
   655 	// Frees the TLS. Must be done after FeatureManager is used.
   660         {
   656 	    FeatureManager::UnInitializeLib(); 
   661         iGridIconSize = TSize(146, 110);
   657 	}
   662         }
       
   663     // Frees the TLS. Must be done after FeatureManager is used.
       
   664     FeatureManager::UnInitializeLib();
       
   665     }
   658 
   666 
   659 
   667 
   660  
   668  
   661 EXPORT_C TBool CGlxUiUtility::IsExitingState()
   669 EXPORT_C TBool CGlxUiUtility::IsExitingState()
   662     {
   670     {
   676 // -----------------------------------------------------------------------------
   684 // -----------------------------------------------------------------------------
   677 //
   685 //
   678 EXPORT_C TInt CGlxUiUtility::VisibleItemsInPageGranularityL()
   686 EXPORT_C TInt CGlxUiUtility::VisibleItemsInPageGranularityL()
   679     {
   687     {
   680     TRACER("CGlxUiUtility::VisibleItemsInPageGranularityL");
   688     TRACER("CGlxUiUtility::VisibleItemsInPageGranularityL");
   681     
   689 
   682     //TBD: In MCL 9.1/Corolla env currently the feature flags 
   690     //TBD: In MCL 9.1/Corolla env currently the feature flags 
   683     //KFeatureIdLayout640_480 and KFeatureIdLayout480_640 are not defined.
   691     //KFeatureIdLayout640_480 and KFeatureIdLayout480_640 are not defined.
   684     //so making the default granularity as 21 instead of 15.
   692     //so making the default granularity as 21 instead of 15.
   685     //Need to replace with KGlxDefaultVisibleItemsGranularity after
   693     //Need to replace with KGlxDefaultVisibleItemsGranularity after
   686     //getting the feature flag.
   694     //getting the feature flag.
   687     TInt ret = KGlxVGAVisibleItemsGranularity;
   695     TInt ret = KGlxVGAVisibleItemsGranularity;
   688     FeatureManager::InitializeLibL();
   696     FeatureManager::InitializeLibL();
   689     
   697 
   690     if (FeatureManager::FeatureSupported( KFeatureIdLayout640_360_Touch ) || 
   698     if (FeatureManager::FeatureSupported(KFeatureIdLayout640_360_Touch)
   691         FeatureManager::FeatureSupported( KFeatureIdLayout360_640_Touch ))
   699             || FeatureManager::FeatureSupported(KFeatureIdLayout360_640_Touch))
   692       {
   700         {
   693       ret = KGlxQHDVisibleItemsGranularity;
   701         ret = KGlxQHDVisibleItemsGranularity;
   694       }
   702         }
   695     else if(FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch) || 
   703     else if (FeatureManager::FeatureSupported(KFeatureIdLayout640_480_Touch)
   696           FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch) || 
   704             || FeatureManager::FeatureSupported(KFeatureIdLayout480_640_Touch)
   697           FeatureManager::FeatureSupported(KFeatureIdLayout640_480) || 
   705             || FeatureManager::FeatureSupported(KFeatureIdLayout640_480)
   698           FeatureManager::FeatureSupported(KFeatureIdLayout480_640))
   706             || FeatureManager::FeatureSupported(KFeatureIdLayout480_640))
   699       {
   707         {
   700       ret = KGlxVGAVisibleItemsGranularity;
   708         ret = KGlxVGAVisibleItemsGranularity;
   701       }
   709         }
   702     FeatureManager::UnInitializeLib(); 
   710     FeatureManager::UnInitializeLib();
   703     return ret;
   711     return ret;
   704     }
   712     }
   705 
   713 
   706 // -----------------------------------------------------------------------------
   714 // -----------------------------------------------------------------------------
   707 // StartTNMDaemonL
   715 // StartTNMDaemon
   708 // -----------------------------------------------------------------------------
   716 // -----------------------------------------------------------------------------
   709 //
   717 //
   710 EXPORT_C void CGlxUiUtility::StartTNMDaemonL()
   718 EXPORT_C TInt CGlxUiUtility::StartTNMDaemon()
   711     {
   719     {
   712     TRACER("CGlxUiUtility::StartTNMDaemonL");
   720     TRACER("CGlxUiUtility::StartTNMDaemon");
   713     TInt err = RProperty::Set(KTAGDPSNotification, KForceBackgroundGeneration, ETrue);
   721     return RProperty::Set(KTAGDPSNotification, KForceBackgroundGeneration,
   714     if(err != KErrNone)
   722             ETrue);
   715         {
   723     }
   716         GLX_LOG_INFO1("GetItemsLeftCountL: RProperty::Set errorcode %d",err);
   724 
   717         //need to check what to do in fail cases
   725 // -----------------------------------------------------------------------------
   718         User::Leave(err);
   726 // StopTNMDaemon
   719         }
   727 // -----------------------------------------------------------------------------
   720     }
   728 //
   721 	
   729 EXPORT_C TInt CGlxUiUtility::StopTNMDaemon()
   722 // -----------------------------------------------------------------------------
   730     {
   723 // StopTNMDaemonL
   731     TRACER("CGlxUiUtility:: StopTNMDaemon");
   724 // -----------------------------------------------------------------------------
   732     return RProperty::Set(KTAGDPSNotification, KForceBackgroundGeneration,
   725 //
   733             EFalse);
   726 EXPORT_C void CGlxUiUtility::StopTNMDaemonL()
   734     }
   727     {
   735 
   728     TRACER("CGlxUiUtility:: StopTNMDaemonL ");
   736 // -----------------------------------------------------------------------------
   729     TInt err = RProperty::Set(KTAGDPSNotification, KForceBackgroundGeneration, EFalse);
   737 // GetItemsLeftCount
   730     GLX_LOG_INFO1("CGlxUiUtility::StopTNMDaemonL err = %d",err);
   738 // -----------------------------------------------------------------------------
   731     if(err != KErrNone)
   739 //
   732         {
   740 EXPORT_C TInt CGlxUiUtility::GetItemsLeftCount()
   733         GLX_LOG_INFO1("StopTNMDaemonL: RProperty::Set errorcode %d",err);
   741     {
   734         //need to check what to do in fail cases
   742     TRACER("CGlxUiUtility::GetItemsLeftCount");
   735         User::Leave(err);
       
   736         }
       
   737     }
       
   738 
       
   739 // -----------------------------------------------------------------------------
       
   740 // GetItemsLeftCountL
       
   741 // -----------------------------------------------------------------------------
       
   742 //
       
   743 EXPORT_C TInt CGlxUiUtility::GetItemsLeftCountL()
       
   744     {
       
   745     TRACER("CGlxUiUtility::GetItemsLeftCountL");
       
   746     TInt leftVariable = 0;
   743     TInt leftVariable = 0;
   747     TInt err = RProperty::Get(KTAGDPSNotification, KItemsleft, leftVariable);
   744     TInt err = RProperty::Get(KTAGDPSNotification, KItemsleft, leftVariable);
   748     GLX_LOG_INFO1("GetItemsLeftCountL: GetItemsLeftCountL %d",leftVariable);
   745     GLX_LOG_INFO1("GetItemsLeftCount: GetItemsLeftCount %d", leftVariable);
   749     if(err != KErrNone)
   746     if (err != KErrNone)
   750         {
   747         {
   751         GLX_LOG_INFO1("GetItemsLeftCountL: RProperty::Get errorcode %d",err);
   748         GLX_LOG_INFO1("GetItemsLeftCount: RProperty::Get errorcode %d", err);
   752         User::Leave(err);
   749         leftVariable = 0;
   753         }
   750         }
   754     return leftVariable;	
   751     return leftVariable;
   755     }
   752     }
   756 // End of file
   753 // End of file