📄 oggsplashcontainer.cpp
字号:
/*
* ============================================================================
* Name : CSplashContainer from CSplashContainer.h
* Part of : Splash
* Created : 17/02/2003 by Eric@NewLC
* Implementation notes:
* Initial content was generated by Series 60 AppWizard.
* Version :
* Copyright:
* ============================================================================
*/
// Platform settings
#include <OggOs.h>
#include <eikdef.h>
#include <eikenv.h>
#include "OggSplashContainer.h"
#include "OggPlay.h"
#include "OggLog.h"
void CSplashContainer::ConstructL()
{
// Check if there is a splash mbm available
TFileName fileName(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName());
TParsePtr parse(fileName);
TInt err;
#if defined(SERIES60V3)
TFileName privatePath;
err = iCoeEnv->FsSession().PrivatePath(privatePath);
if (err != KErrNone)
{
TRACEF(COggLog::VA(_L("Error getting private path: %d"), err ));
User::Leave(err);
}
fileName.Copy(parse.Drive());
fileName.Append(privatePath);
fileName.Append(_L("import\\CustomSplash.mbm"));
#else
fileName.Copy(parse.DriveAndPath());
fileName.Append(_L("CustomSplash.mbm"));
#endif
iBitmap = new (ELeave) CFbsBitmap;
err = iBitmap->Load(fileName, 0, EFalse);
if (err == KErrNone)
{
// Custom splash successfully loaded
return;
}
else if ((err != KErrNotFound) && (err != KErrPathNotFound))
{
// Something went wrong loading it
TRACEF(COggLog::VA(_L("Error loading custom splash: %d"), err ));
User::Leave(err);
}
// There's no custom splash, so load the default
#if defined(SERIES60V3)
fileName.Copy(parse.Drive());
fileName.Append(privatePath);
fileName.Append(_L("OggSplash.mbm"));
#else
fileName.Copy(parse.DriveAndPath());
fileName.Append(_L("OggSplash.mbm"));
#endif
err = iBitmap->Load(fileName, 0, EFalse);
if (err != KErrNone)
{
TRACEF(COggLog::VA(_L("Error loading splash bitmap: %d"), err ));
User::Leave(err);
}
}
void CSplashContainer::ShowSplashL()
{
#if defined(SERIES90)
// For some reason on S90 the splash view gets activated twice,
// so we must avoid creating the window twice (otherwise we get a CONE 10 panic)
if (iDisplayTimer)
return;
#endif
// Create and activate the main window
CreateWindowL();
SetExtentToWholeScreen();
ActivateL();
// Show the splash screen for 1 second and then load the app.
iDisplayTimer = new (ELeave) COggTimer(TCallBack(TimerExpired, this));
iDisplayTimer->Wait(1000000);
}
CSplashContainer::~CSplashContainer()
{
delete iDisplayTimer;
delete iBitmap;
}
void CSplashContainer::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
TRect bitmapRect = TRect(iBitmap->SizeInPixels());
TRect screenRect = TRect(CCoeEnv::Static()->ScreenDevice()->SizeInPixels());
if (bitmapRect == screenRect)
gc.BitBlt(TPoint(0, 0), iBitmap);
else
gc.DrawBitmap(screenRect, iBitmap, bitmapRect);
}
TInt CSplashContainer::TimerExpired(TAny* /* aPtr */)
{
// Signal that the startup should continue
COggPlayAppUi* appUi = (COggPlayAppUi*) CEikonEnv::Static()->AppUi();
appUi->NextStartUpState(KErrNone);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -