startupservices/SplashScreen/src/SplashScreen.cpp
branchRCL_3
changeset 63 c2c61fdca848
parent 62 924385140d98
child 64 75184094ace1
child 70 739cef680932
equal deleted inserted replaced
62:924385140d98 63:c2c61fdca848
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2002-2008 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>
       
    22 #include <coedef.h>
    21 #include <coedef.h>
    23 #include <data_caging_path_literals.hrh>
    22 #include <data_caging_path_literals.hrh>
       
    23 #include <splashscreen.mbg>
       
    24 #include <AknIconSrvClient.h>
    24 #include <startupdomainpskeys.h>
    25 #include <startupdomainpskeys.h>
    25 #include <SVGEngineInterfaceImpl.h>
       
    26 #include <gdi.h>
       
    27 #include <coemain.h> 
       
    28 
    26 
    29 // USER INCLUDES
    27 // USER INCLUDES
    30 #include "SplashScreen.h"
    28 #include "SplashScreen.h"
    31 #include "SplashScreenDefines.h"
    29 #include "SplashScreenDefines.h"
    32 
    30 
   243     TRACES1("CWsClient::ConstructL() - enable screen change events: %d", error);
   241     TRACES1("CWsClient::ConstructL() - enable screen change events: %d", error);
   244 
   242 
   245 	// construct redrawer
   243 	// construct redrawer
   246 	iRedrawer=new (ELeave) CWsRedrawer;
   244 	iRedrawer=new (ELeave) CWsRedrawer;
   247 	iRedrawer->ConstructL(this);
   245 	iRedrawer->ConstructL(this);
       
   246     User::LeaveIfError( RAknIconSrvClient::Connect() );
   248 	// construct main window
   247 	// construct main window
   249 	ConstructMainWindowL();
   248 	ConstructMainWindowL();
   250 
   249 
   251     iWs.EventReady(&iStatus); // request an event
   250     iWs.EventReady(&iStatus); // request an event
   252 	SetActive(); // so we're now active
   251 	SetActive(); // so we're now active
   260 	}
   259 	}
   261 
   260 
   262 CWsClient::~CWsClient()
   261 CWsClient::~CWsClient()
   263 	{
   262 	{
   264     TRACES("CWsClient::~CWsClient(): Start");
   263     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 
   304 
   309 
   305 
   310 
   306 //////////////////////////////////////////////////////////////////////////////
   311 //////////////////////////////////////////////////////////////////////////////
   307 //				Implementation for derived window classes
   312 //				Implementation for derived window classes
   308 //////////////////////////////////////////////////////////////////////////////
   313 //////////////////////////////////////////////////////////////////////////////
   329     TRACES("CMainWindow::~CMainWindow(): Start");
   334     TRACES("CMainWindow::~CMainWindow(): Start");
   330     delete iBitmap;
   335     delete iBitmap;
   331     TRACES("CMainWindow::~CMainWindow(): End");
   336     TRACES("CMainWindow::~CMainWindow(): End");
   332 	}
   337 	}
   333 
   338 
   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 
       
   385 void CMainWindow::ConstructL (const TRect& aRect, CWindow* aParent)
   339 void CMainWindow::ConstructL (const TRect& aRect, CWindow* aParent)
   386 	{
   340 	{
   387     TRACES("CMainWindow::ConstructL(): Start");
   341     TRACES("CMainWindow::ConstructL(): Start");
   388 
   342 
   389     TInt err( KErrNone );
   343     TInt err( KErrNone );
   405     err = findFile.FindByPath( fp->FullName(), NULL );
   359     err = findFile.FindByPath( fp->FullName(), NULL );
   406     fs.Close();
   360     fs.Close();
   407     if ( !err )
   361     if ( !err )
   408         {
   362         {
   409         TRACES("CMainWindow::ConstructL(): Image found");
   363         TRACES("CMainWindow::ConstructL(): Image found");
   410 		iBitmap = ReadSVGL(fp->FullName());
   364         iBitmap = AknIconUtils::CreateIconL( fp->FullName(), EMbmSplashscreenQgn_startup_screen );
       
   365         AknIconUtils::ExcludeFromCache(iBitmap);
       
   366         AknIconUtils::SetSize( iBitmap, iRect.Size(), EAspectRatioPreservedAndUnusedSpaceRemoved );
   411         }
   367         }
   412     else
   368     else
   413         {
   369         {
   414         TRACES("CMainWindow::ConstructL(): Image not found");
   370         TRACES("CMainWindow::ConstructL(): Image not found");
   415         }
   371         }
   470 |	Output:		None
   426 |	Output:		None
   471 \****************************************************************************/
   427 \****************************************************************************/
   472 void CMainWindow::HandlePointerEvent (TPointerEvent& /*aPointerEvent*/)
   428 void CMainWindow::HandlePointerEvent (TPointerEvent& /*aPointerEvent*/)
   473     {
   429     {
   474     TRACES("CMainWindow::HandlePointerEvent(): Start");
   430     TRACES("CMainWindow::HandlePointerEvent(): Start");
   475 	
   431 //	TPoint point = aPointerEvent.iPosition;
       
   432 //	(void)point;
   476     TRACES("CMainWindow::HandlePointerEvent(): End");
   433     TRACES("CMainWindow::HandlePointerEvent(): End");
   477 	}
   434 	}
   478 
   435 
   479 //////////////////////////////////////////////////////////////////////////////
   436 //////////////////////////////////////////////////////////////////////////////
   480 //					 CSplashWsClient implementation						//
   437 //					 CSplashWsClient implementation						//