startupservices/SplashScreen/src/SplashScreen.cpp
branchRCL_3
changeset 62 924385140d98
parent 0 2e3d3ce01487
child 63 c2c61fdca848
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // SYSTEM INCLUDES
    19 // SYSTEM INCLUDES
    20 #include <w32std.h>
    20 #include <w32std.h>
       
    21 #include <eikenv.h>
    21 #include <coedef.h>
    22 #include <coedef.h>
    22 #include <data_caging_path_literals.hrh>
    23 #include <data_caging_path_literals.hrh>
    23 #include <splashscreen.mbg>
       
    24 #include <AknIconSrvClient.h>
       
    25 #include <startupdomainpskeys.h>
    24 #include <startupdomainpskeys.h>
       
    25 #include <SVGEngineInterfaceImpl.h>
       
    26 #include <gdi.h>
       
    27 #include <coemain.h> 
    26 
    28 
    27 // USER INCLUDES
    29 // USER INCLUDES
    28 #include "SplashScreen.h"
    30 #include "SplashScreen.h"
    29 #include "SplashScreenDefines.h"
    31 #include "SplashScreenDefines.h"
    30 
    32 
   241     TRACES1("CWsClient::ConstructL() - enable screen change events: %d", error);
   243     TRACES1("CWsClient::ConstructL() - enable screen change events: %d", error);
   242 
   244 
   243 	// construct redrawer
   245 	// construct redrawer
   244 	iRedrawer=new (ELeave) CWsRedrawer;
   246 	iRedrawer=new (ELeave) CWsRedrawer;
   245 	iRedrawer->ConstructL(this);
   247 	iRedrawer->ConstructL(this);
   246     User::LeaveIfError( RAknIconSrvClient::Connect() );
       
   247 	// construct main window
   248 	// construct main window
   248 	ConstructMainWindowL();
   249 	ConstructMainWindowL();
   249 
   250 
   250     iWs.EventReady(&iStatus); // request an event
   251     iWs.EventReady(&iStatus); // request an event
   251 	SetActive(); // so we're now active
   252 	SetActive(); // so we're now active
   259 	}
   260 	}
   260 
   261 
   261 CWsClient::~CWsClient()
   262 CWsClient::~CWsClient()
   262 	{
   263 	{
   263     TRACES("CWsClient::~CWsClient(): Start");
   264     TRACES("CWsClient::~CWsClient(): Start");
   264     RAknIconSrvClient::Disconnect();
       
   265 	// neutralize us as an active object
   265 	// neutralize us as an active object
   266 	Deque(); // cancels and removes from scheduler
   266 	Deque(); // cancels and removes from scheduler
   267 	// get rid of scheduler and all attached objects
   267 	// get rid of scheduler and all attached objects
   268 	delete CActiveScheduler::Current(); // delete the scheduler
   268 	delete CActiveScheduler::Current(); // delete the scheduler
   269 	// get rid of everything we allocated
   269 	// get rid of everything we allocated
   299     TRACES("CWsClient::DoCancel(): Start");
   299     TRACES("CWsClient::DoCancel(): Start");
   300 	iWs.EventReadyCancel(); // cancel event request
   300 	iWs.EventReadyCancel(); // cancel event request
   301     TRACES("CWsClient::DoCancel(): End");
   301     TRACES("CWsClient::DoCancel(): End");
   302 	}
   302 	}
   303 
   303 
   304 void CWsClient::ConstructMainWindowL()
       
   305 	{
       
   306     TRACES("CWsClient::ConstructMainWindowL()");
       
   307 	}
       
   308 
       
   309 
   304 
   310 
   305 
   311 //////////////////////////////////////////////////////////////////////////////
   306 //////////////////////////////////////////////////////////////////////////////
   312 //				Implementation for derived window classes
   307 //				Implementation for derived window classes
   313 //////////////////////////////////////////////////////////////////////////////
   308 //////////////////////////////////////////////////////////////////////////////
   334     TRACES("CMainWindow::~CMainWindow(): Start");
   329     TRACES("CMainWindow::~CMainWindow(): Start");
   335     delete iBitmap;
   330     delete iBitmap;
   336     TRACES("CMainWindow::~CMainWindow(): End");
   331     TRACES("CMainWindow::~CMainWindow(): End");
   337 	}
   332 	}
   338 
   333 
       
   334 CFbsBitmap* CMainWindow::ReadSVGL (TFileName aFileName)
       
   335 	{
       
   336 	TRACES("CMainWindow::ReadSVGL(): Start");    
       
   337 	TFontSpec fontspec;
       
   338     TDisplayMode mode = EColor16MA;    
       
   339 	TSize size(SIZE_X, SIZE_Y);
       
   340 
       
   341 	//if ( mode >= (TDisplayMode)13 )  { mode = EColor16MA; }
       
   342 
       
   343 	CFbsBitmap* frameBuffer = new ( ELeave ) CFbsBitmap;
       
   344     CleanupStack::PushL( frameBuffer );
       
   345     frameBuffer->Create( size, mode );
       
   346 	
       
   347 	CSvgEngineInterfaceImpl* svgEngine = NULL;
       
   348 	svgEngine = CSvgEngineInterfaceImpl::NewL(frameBuffer, NULL, fontspec );    
       
   349 	
       
   350 	if (svgEngine == NULL)
       
   351 		{
       
   352 		TRACES("CMainWindow::ReadSVGL(): Splashscreen SVG engine creation failed");    
       
   353 		}
       
   354 	
       
   355 	CleanupStack::PushL( svgEngine );
       
   356 	TInt domHandle = 0;
       
   357     svgEngine->PrepareDom( aFileName, domHandle ) ;
       
   358 	if (domHandle == 0)
       
   359 		{
       
   360 		TRACES("CMainWindow::ReadSVGL(): Splashscreen DOM handle creation failed");    
       
   361 		}
       
   362 
       
   363 	CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;    
       
   364     CleanupStack::PushL( bitmap );
       
   365     User::LeaveIfError( bitmap->Create( size, EColor64K ) );
       
   366 
       
   367 	svgEngine->UseDom( domHandle, bitmap, NULL ) ;
       
   368 	
       
   369     MSvgError* err;
       
   370     svgEngine->Start( err );
       
   371 	if (err->HasError())
       
   372 		{
       
   373 		TRACES("CMainWindow::ReadSVGL(): Splashscreen SVG Engine Start failed");   
       
   374 		}
       
   375 
       
   376 	svgEngine->DeleteDom( domHandle );
       
   377     CleanupStack::Pop( bitmap );
       
   378     CleanupStack::PopAndDestroy( svgEngine );
       
   379     CleanupStack::PopAndDestroy( frameBuffer );
       
   380 	
       
   381     TRACES("CMainWindow::ReadSVGL(): End");
       
   382 	return bitmap;
       
   383 	}
       
   384 
   339 void CMainWindow::ConstructL (const TRect& aRect, CWindow* aParent)
   385 void CMainWindow::ConstructL (const TRect& aRect, CWindow* aParent)
   340 	{
   386 	{
   341     TRACES("CMainWindow::ConstructL(): Start");
   387     TRACES("CMainWindow::ConstructL(): Start");
   342 
   388 
   343     TInt err( KErrNone );
   389     TInt err( KErrNone );
   359     err = findFile.FindByPath( fp->FullName(), NULL );
   405     err = findFile.FindByPath( fp->FullName(), NULL );
   360     fs.Close();
   406     fs.Close();
   361     if ( !err )
   407     if ( !err )
   362         {
   408         {
   363         TRACES("CMainWindow::ConstructL(): Image found");
   409         TRACES("CMainWindow::ConstructL(): Image found");
   364         iBitmap = AknIconUtils::CreateIconL( fp->FullName(), EMbmSplashscreenQgn_startup_screen );
   410 		iBitmap = ReadSVGL(fp->FullName());
   365         AknIconUtils::ExcludeFromCache(iBitmap);
       
   366         AknIconUtils::SetSize( iBitmap, iRect.Size(), EAspectRatioPreservedAndUnusedSpaceRemoved );
       
   367         }
   411         }
   368     else
   412     else
   369         {
   413         {
   370         TRACES("CMainWindow::ConstructL(): Image not found");
   414         TRACES("CMainWindow::ConstructL(): Image not found");
   371         }
   415         }
   426 |	Output:		None
   470 |	Output:		None
   427 \****************************************************************************/
   471 \****************************************************************************/
   428 void CMainWindow::HandlePointerEvent (TPointerEvent& /*aPointerEvent*/)
   472 void CMainWindow::HandlePointerEvent (TPointerEvent& /*aPointerEvent*/)
   429     {
   473     {
   430     TRACES("CMainWindow::HandlePointerEvent(): Start");
   474     TRACES("CMainWindow::HandlePointerEvent(): Start");
   431 //	TPoint point = aPointerEvent.iPosition;
   475 	
   432 //	(void)point;
       
   433     TRACES("CMainWindow::HandlePointerEvent(): End");
   476     TRACES("CMainWindow::HandlePointerEvent(): End");
   434 	}
   477 	}
   435 
   478 
   436 //////////////////////////////////////////////////////////////////////////////
   479 //////////////////////////////////////////////////////////////////////////////
   437 //					 CSplashWsClient implementation						//
   480 //					 CSplashWsClient implementation						//