idlehomescreen/xmluirendering/uiengine/src/xnbackgroundmanager.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 12 9674c1a575e9
child 18 d05a55b217df
equal deleted inserted replaced
12:9674c1a575e9 17:b8fae6b8a148
    25 #include "hspssapi.h"
    25 #include "hspssapi.h"
    26 #include "xnappuiadapter.h"
    26 #include "xnappuiadapter.h"
    27 #include "xnwallpaperview.h"
    27 #include "xnwallpaperview.h"
    28 #include "xnrootdata.h"
    28 #include "xnrootdata.h"
    29 #include "xnuiengine.h"
    29 #include "xnuiengine.h"
       
    30 #include "xnoomsyshandler.h"
    30 #include "xneffectmanager.h"
    31 #include "xneffectmanager.h"
    31 
    32 
    32 // SYSTEM INCLUDE FILES
    33 // SYSTEM INCLUDE FILES
    33 #include <gfxtranseffect/gfxtranseffect.h>
    34 #include <gfxtranseffect/gfxtranseffect.h>
    34 #include <akntransitionutils.h>
    35 #include <akntransitionutils.h>
    43 #include <AknsUtils.h>
    44 #include <AknsUtils.h>
    44 #include <AknsDrawUtils.h>
    45 #include <AknsDrawUtils.h>
    45 #include <AknsControlContext.h>
    46 #include <AknsControlContext.h>
    46 #include <AknsLayeredBackgroundControlContext.h>
    47 #include <AknsLayeredBackgroundControlContext.h>
    47 #include <driveinfo.h>
    48 #include <driveinfo.h>
       
    49 #include <layoutmetadata.cdl.h>
    48 
    50 
    49 using namespace hspswrapper;
    51 using namespace hspswrapper;
    50 
    52 
    51 // Constants
    53 // Constants
    52 _LIT8( KSingle, "single" );
    54 _LIT8( KSingle, "single" );
    99     
   101     
   100     // Reads from cenrep wheteher page specific wallpaper is enabled or not
   102     // Reads from cenrep wheteher page specific wallpaper is enabled or not
   101     CheckFeatureTypeL();   
   103     CheckFeatureTypeL();   
   102 
   104 
   103     iTimer = CPeriodic::NewL( CActive::EPriorityIdle );
   105     iTimer = CPeriodic::NewL( CActive::EPriorityIdle );
   104     
   106 
   105     GfxTransEffect::Register( this, KGfxContextBgAppear );    
   107     GfxTransEffect::Register( this, KGfxContextBgAppear );    
       
   108 
       
   109     iOomSysHandler = CXnOomSysHandler::NewL();
   106     }
   110     }
   107 
   111 
   108 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   109 // Two-phased constructor.
   113 // Two-phased constructor.
   110 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   134     delete iDiskNotifier;
   138     delete iDiskNotifier;
   135     iFsSession.Close();
   139     iFsSession.Close();
   136     delete iBgContext;
   140     delete iBgContext;
   137     delete iBgImage;
   141     delete iBgImage;
   138     delete iBgImagePath;
   142     delete iBgImagePath;
       
   143     delete iOomSysHandler;
   139     }
   144     }
   140 
   145 
   141 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
   142 // CXnBackgroundManager::Draw
   147 // CXnBackgroundManager::Draw
   143 // -----------------------------------------------------------------------------
   148 // -----------------------------------------------------------------------------
   175             }
   180             }
   176         else
   181         else
   177             {
   182             {
   178             SystemGc().DrawBitmap( iRect, wallpaper );
   183             SystemGc().DrawBitmap( iRect, wallpaper );
   179             }
   184             }
       
   185 	        DrawStatusPaneMask();		
   180         }
   186         }
   181     
   187     
   182     // Skin bg is used by default
   188     // Skin bg is used by default
   183     else
   189     else
   184         {  
   190         {  
   351 //
   357 //
   352 CXnBackgroundManager::WppType CXnBackgroundManager::WallpaperType()
   358 CXnBackgroundManager::WppType CXnBackgroundManager::WallpaperType()
   353     {
   359     {
   354     return iType;
   360     return iType;
   355     }
   361     }
   356     
   362 
   357 // -----------------------------------------------------------------------------
   363 // -----------------------------------------------------------------------------
   358 // CXnBackgroundManager::WallpaperChanged
   364 // CXnBackgroundManager::WallpaperChanged
   359 // -----------------------------------------------------------------------------
   365 // -----------------------------------------------------------------------------
   360 //
   366 //
   361 void CXnBackgroundManager::WallpaperChanged( const CXnViewData& aOldView, 
   367 void CXnBackgroundManager::WallpaperChanged( const CXnViewData& aOldView, 
   503             {
   509             {
   504             AddWallpaperL( KNullDesC );
   510             AddWallpaperL( KNullDesC );
   505             }
   511             }
   506         else if ( selectedIndex == 1 )
   512         else if ( selectedIndex == 1 )
   507             {
   513             {
       
   514             if ( CXnOomSysHandler::HeapAvailable( CXnOomSysHandler::EMem2MB ) )
       
   515                 {
   508             CXnAppUiAdapter& appui( iViewManager.AppUiAdapter() );
   516             CXnAppUiAdapter& appui( iViewManager.AppUiAdapter() );
   509             
   517             
   510             appui.EffectManager()->BeginFullscreenEffectL(
   518             appui.EffectManager()->BeginFullscreenEffectL(
   511                 KGfxContextOpenWallpaperView, iViewManager.ActiveViewData() );        
   519                 KGfxContextOpenWallpaperView, iViewManager.ActiveViewData() );        
   512             
   520             
   513             appui.ActivateLocalViewL( KWallpaperViewUid, KDummyUid, KSingle );                                 
   521             appui.ActivateLocalViewL( KWallpaperViewUid, KDummyUid, KSingle );                                 
       
   522                 }
       
   523             else
       
   524             	{
       
   525             	OomSysHandler().HandlePotentialOomL();
       
   526             	}
   514             }
   527             }
   515         }
   528         }
   516     CleanupStack::Pop( query );
   529     CleanupStack::Pop( query );
   517     }
   530     }
   518     
   531     
   927         bgManager->iIntUpdate++;
   940         bgManager->iIntUpdate++;
   928         }   
   941         }   
   929     return EFalse;
   942     return EFalse;
   930     }
   943     }
   931 
   944 
       
   945 // -----------------------------------------------------------------------------
       
   946 // CXnBackgroundManager::DrawStatusPaneMask
       
   947 // -----------------------------------------------------------------------------
       
   948 //
       
   949 void CXnBackgroundManager::DrawStatusPaneMask() const
       
   950     {
       
   951     TRect spRect;
       
   952     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, spRect );
       
   953     
       
   954     CFbsBitmap* maskBmp( NULL );
       
   955     TInt err( KErrNone );
       
   956     
       
   957     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   958         {
       
   959         TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   960                 KAknsIIDQgnGrafBgLscTopMaskIcon ) );
       
   961         }
       
   962     else
       
   963         {
       
   964         TRAP( err, maskBmp = AknsUtils::CreateBitmapL( AknsUtils::SkinInstance(),
       
   965                 KAknsIIDQgnGrafBgPrtTopMaskIcon ) );        
       
   966         }
       
   967     
       
   968     if( err )
       
   969         {
       
   970         return;
       
   971         }
       
   972     
       
   973     // draw mask
       
   974     if( maskBmp )
       
   975         {
       
   976         AknIconUtils::SetSize( maskBmp, spRect.Size(), EAspectRatioNotPreserved );
       
   977         SystemGc().DrawBitmap( spRect, maskBmp );
       
   978         delete maskBmp;        
       
   979         }
       
   980     }
       
   981 
       
   982 // -----------------------------------------------------------------------------
       
   983 // CXnBackgroundManager::OOMSysHandler
       
   984 // -----------------------------------------------------------------------------
       
   985 //
       
   986 CXnOomSysHandler& CXnBackgroundManager::OomSysHandler() const
       
   987     {
       
   988     __ASSERT_DEBUG( iOomSysHandler , User::Panic( _L("xnbackgroundmanager"), 0 ) );
       
   989 
       
   990     return *iOomSysHandler;
       
   991     }
   932 
   992 
   933 //  End of File
   993 //  End of File