summaryrefslogtreecommitdiffstats
path: root/src/s60main
diff options
context:
space:
mode:
Diffstat (limited to 'src/s60main')
-rw-r--r--src/s60main/qts60main.cpp13
-rw-r--r--src/s60main/qts60main_mcrt0.cpp35
-rw-r--r--src/s60main/qts60mainapplication.cpp17
-rw-r--r--src/s60main/qts60mainapplication.h1
-rw-r--r--src/s60main/qts60mainappui.cpp43
-rw-r--r--src/s60main/qts60mainappui.h3
-rw-r--r--src/s60main/qts60maindocument.cpp43
-rw-r--r--src/s60main/qts60maindocument.h1
-rw-r--r--src/s60main/s60main.pro14
-rw-r--r--src/s60main/s60main.rss1
10 files changed, 80 insertions, 91 deletions
diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp
index d7daf4a..67c20b7 100644
--- a/src/s60main/qts60main.cpp
+++ b/src/s60main/qts60main.cpp
@@ -48,16 +48,15 @@
* factory function to create the QtS60Main application class
*/
LOCAL_C CApaApplication* NewApplication()
- {
- return new CQtS60MainApplication;
- }
+{
+ return new CQtS60MainApplication;
+}
/**
* A normal Symbian OS executable provides an E32Main() function which is
* called by the operating system to start the program.
*/
GLDEF_C TInt E32Main()
- {
- return EikStart::RunApplication( NewApplication );
- }
-
+{
+ return EikStart::RunApplication(NewApplication);
+}
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index 49a47bd..f591c89 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -51,13 +51,13 @@
#ifdef __ARMCC__
__asm int CallMain(int argc, char *argv[], char *envp[])
{
- import main
- code32
- b main
+ import main
+ code32
+ b main
}
#define CALLMAIN(argc, argv, envp) CallMain(argc, argv, envp)
#else
-extern "C" int main (int argc, char *argv[], char *envp[]);
+extern "C" int main(int argc, char *argv[], char *envp[]);
#define CALLMAIN(argc, argv, envp) main(argc, argv, envp)
#endif
@@ -67,28 +67,21 @@ extern "C" GLDEF_C int __GccGlueInit()
return 0;
}
-extern "C" IMPORT_C void exit (int ret);
+extern "C" IMPORT_C void exit(int ret);
GLDEF_C TInt QtMainWrapper()
{
- int argc=0;
- char **argv=0;
- char **envp=0;
+ int argc = 0;
+ char **argv = 0;
+ char **envp = 0;
// get args & environment
- __crt0(argc,argv,envp);
+ __crt0(argc, argv, envp);
CleanupArrayDelete<char*>::PushL(argv);
CleanupArrayDelete<char*>::PushL(envp);
//Call user(application)'s main
- int ret = 0;
- try
- {
- ret = CALLMAIN(argc, argv, envp);
- }
- catch (...)
- {
- User::Leave(KErrGeneral);
- }
- CleanupStack::PopAndDestroy(2,argv);
+ int ret = 0;
+ QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp););
+ CleanupStack::PopAndDestroy(2, argv);
return ret;
}
@@ -96,10 +89,10 @@ GLDEF_C TInt QtMainWrapper()
#ifdef __GCC32__
/* stub function inserted into main() by GCC */
-extern "C" void __gccmain (void) {}
+extern "C" void __gccmain(void) {}
/* Default GCC entrypoint */
-extern "C" TInt _mainCRTStartup (void)
+extern "C" TInt _mainCRTStartup(void)
{
extern TInt _E32Startup();
return _E32Startup();
diff --git a/src/s60main/qts60mainapplication.cpp b/src/s60main/qts60mainapplication.cpp
index 2fada3d..9ad7f68 100644
--- a/src/s60main/qts60mainapplication.cpp
+++ b/src/s60main/qts60mainapplication.cpp
@@ -49,7 +49,7 @@
// ============================ MEMBER FUNCTIONS ===============================
-_LIT( KQtWrapperResourceFile,"\\resource\\apps\\s60main.rsc" );
+_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc");
// -----------------------------------------------------------------------------
// CQtS60MainApplication::CreateDocumentL()
@@ -57,10 +57,10 @@ _LIT( KQtWrapperResourceFile,"\\resource\\apps\\s60main.rsc" );
// -----------------------------------------------------------------------------
//
CApaDocument* CQtS60MainApplication::CreateDocumentL()
- {
+{
// Create an QtS60Main document, and return a pointer to it
- return (static_cast<CApaDocument*>( CQtS60MainDocument::NewL( *this ) ) );
- }
+ return (static_cast<CApaDocument*>(CQtS60MainDocument::NewL(*this)));
+}
// -----------------------------------------------------------------------------
// CQtS60MainApplication::AppDllUid()
@@ -68,10 +68,10 @@ CApaDocument* CQtS60MainApplication::CreateDocumentL()
// -----------------------------------------------------------------------------
//
TUid CQtS60MainApplication::AppDllUid() const
- {
+{
// Return the UID for the QtS60Main application
return ProcessUid();
- }
+}
// -----------------------------------------------------------------------------
// CQtS60MainApplication::ResourceFileName()
@@ -79,14 +79,13 @@ TUid CQtS60MainApplication::AppDllUid() const
// -----------------------------------------------------------------------------
//
TFileName CQtS60MainApplication::ResourceFileName() const
- {
+{
TFindFile finder(iCoeEnv->FsSession());
TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC);
if (err == KErrNone)
return finder.File();
return KNullDesC();
- }
+}
// End of File
-
diff --git a/src/s60main/qts60mainapplication.h b/src/s60main/qts60mainapplication.h
index 70b6909..e178936 100644
--- a/src/s60main/qts60mainapplication.h
+++ b/src/s60main/qts60mainapplication.h
@@ -91,4 +91,3 @@ class CQtS60MainApplication : public CAknApplication
#endif // __QtS60MainAPPLICATION_H__
// End of File
-
diff --git a/src/s60main/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp
index 85badcc..ede96cb 100644
--- a/src/s60main/qts60mainappui.cpp
+++ b/src/s60main/qts60mainappui.cpp
@@ -63,6 +63,11 @@
//
void CQtS60MainAppUi::ConstructL()
{
+ // Cone's heap and handle checks on app destruction are not suitable for Qt apps, as many
+ // objects can still exist in static data at that point. Instead we will print relevant information
+ // so that comparative checks may be made for memory leaks, using ~SPrintExitInfo in corelib.
+ iEikonEnv->DisableExitChecks(ETrue);
+
// Initialise app UI with standard value.
// ENoAppResourceFile and ENonStandardResourceFile makes UI to work without
// resource files in most SDKs. S60 3rd FP1 public seems to require resource file
@@ -71,11 +76,11 @@ void CQtS60MainAppUi::ConstructL()
CEikButtonGroupContainer* nativeContainer = Cba();
nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
-
+
// Create async callback to call Qt main,
// this is required to give S60 app FW to finish starting correctly
- TCallBack callBack( OpenCMainStaticCallBack, this );
- iAsyncCallBack = new(ELeave) CAsyncCallBack( callBack, CActive::EPriorityIdle );
+ TCallBack callBack(OpenCMainStaticCallBack, this);
+ iAsyncCallBack = new(ELeave) CAsyncCallBack(callBack, CActive::EPriorityIdle);
iAsyncCallBack->Call();
}
@@ -104,7 +109,7 @@ CQtS60MainAppUi::~CQtS60MainAppUi()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
-void CQtS60MainAppUi::HandleCommandL( TInt aCommand )
+void CQtS60MainAppUi::HandleCommandL(TInt aCommand)
{
if (qApp)
qApp->symbianHandleCommand(aCommand);
@@ -118,7 +123,7 @@ void CQtS60MainAppUi::HandleCommandL( TInt aCommand )
void CQtS60MainAppUi::HandleResourceChangeL(TInt aType)
{
CAknAppUi::HandleResourceChangeL(aType);
-
+
if (qApp)
qApp->symbianResourceChange(aType);
}
@@ -127,7 +132,7 @@ void CQtS60MainAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl *contro
{
int result = 0;
if (qApp)
- QT_TRANSLATE_EXCEPTION_TO_SYMBIAN_LEAVE(
+ QT_TRYCATCH_LEAVING(
result = qApp->s60ProcessEvent(const_cast<TWsEvent*>(&aEvent))
);
@@ -152,9 +157,9 @@ void CQtS60MainAppUi::HandleStatusPaneSizeChange()
// Called asynchronously from ConstructL() - passes call to nan static method
// -----------------------------------------------------------------------------
//
-TInt CQtS60MainAppUi::OpenCMainStaticCallBack( TAny* aObject )
+TInt CQtS60MainAppUi::OpenCMainStaticCallBack(TAny* aObject)
{
- CQtS60MainAppUi* myObj = static_cast<CQtS60MainAppUi*>( aObject );
+ CQtS60MainAppUi* myObj = static_cast<CQtS60MainAppUi*>(aObject);
myObj->OpenCMainCallBack();
return 0;
}
@@ -181,30 +186,28 @@ void CQtS60MainAppUi::DynInitMenuBarL(TInt, CEikMenuBar *)
void CQtS60MainAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane)
{
- if (aResourceId == R_QT_WRAPPERAPP_MENU){
+ if (aResourceId == R_QT_WRAPPERAPP_MENU) {
if (aMenuPane->NumberOfItemsInPane() <= 1)
qt_symbian_show_toplevel(aMenuPane);
-
- }
- else if( aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT ){
+
+ } else if (aResourceId != R_AVKON_MENUPANE_FEP_DEFAULT && aResourceId != R_AVKON_MENUPANE_EDITTEXT_DEFAULT && aResourceId != R_AVKON_MENUPANE_LANGUAGE_DEFAULT) {
qt_symbian_show_submenu(aMenuPane, aResourceId);
}
}
-void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType)
+void CQtS60MainAppUi::RestoreMenuL(CCoeControl* aMenuWindow, TInt aMenuId, TMenuType aMenuType)
{
- if ((aMenuId==R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
+ if ((aMenuId == R_QT_WRAPPERAPP_MENUBAR) || (aMenuId == R_AVKON_MENUPANE_FEP_DEFAULT)) {
TResourceReader reader;
- iCoeEnv->CreateResourceReaderLC(reader,aMenuId);
+ iCoeEnv->CreateResourceReaderLC(reader, aMenuId);
aMenuWindow->ConstructFromResourceL(reader);
CleanupStack::PopAndDestroy();
}
- if (aMenuType==EMenuPane)
- DynInitMenuPaneL(aMenuId,(CEikMenuPane*)aMenuWindow);
+ if (aMenuType == EMenuPane)
+ DynInitMenuPaneL(aMenuId, (CEikMenuPane*)aMenuWindow);
else
- DynInitMenuBarL(aMenuId,(CEikMenuBar*)aMenuWindow);
- }
+ DynInitMenuBarL(aMenuId, (CEikMenuBar*)aMenuWindow);
+}
// End of File
-
diff --git a/src/s60main/qts60mainappui.h b/src/s60main/qts60mainappui.h
index 6bdeb2e..cec0d98 100644
--- a/src/s60main/qts60mainappui.h
+++ b/src/s60main/qts60mainappui.h
@@ -96,7 +96,7 @@ class CQtS60MainAppUi : public CAknAppUi
* @param aType event type.
*/
void HandleResourceChangeL(TInt aType);
-
+
/**
* HandleStatusPaneSizeChange.
* Called by the framework when the application status pane
@@ -133,4 +133,3 @@ class CQtS60MainAppUi : public CAknAppUi
#endif // __QtS60MainAPPUI_H__
// End of File
-
diff --git a/src/s60main/qts60maindocument.cpp b/src/s60main/qts60maindocument.cpp
index eb7ea42..77d5cc8 100644
--- a/src/s60main/qts60maindocument.cpp
+++ b/src/s60main/qts60maindocument.cpp
@@ -51,25 +51,25 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument* CQtS60MainDocument::NewL( CEikApplication& aApp )
- {
- CQtS60MainDocument* self = NewLC( aApp );
- CleanupStack::Pop( self );
+CQtS60MainDocument* CQtS60MainDocument::NewL(CEikApplication& aApp)
+{
+ CQtS60MainDocument* self = NewLC(aApp);
+ CleanupStack::Pop(self);
return self;
- }
+}
// -----------------------------------------------------------------------------
// CQtS60MainDocument::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument* CQtS60MainDocument::NewLC( CEikApplication& aApp )
- {
- CQtS60MainDocument* self = new ( ELeave ) CQtS60MainDocument( aApp );
- CleanupStack::PushL( self );
+CQtS60MainDocument* CQtS60MainDocument::NewLC(CEikApplication& aApp)
+{
+ CQtS60MainDocument* self = new(ELeave) CQtS60MainDocument(aApp);
+ CleanupStack::PushL(self);
self->ConstructL();
return self;
- }
+}
// -----------------------------------------------------------------------------
// CQtS60MainDocument::ConstructL()
@@ -77,20 +77,20 @@ CQtS60MainDocument* CQtS60MainDocument::NewLC( CEikApplication& aApp )
// -----------------------------------------------------------------------------
//
void CQtS60MainDocument::ConstructL()
- {
+{
// No implementation required
- }
+}
// -----------------------------------------------------------------------------
// CQtS60MainDocument::CQtS60MainDocument()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
-CQtS60MainDocument::CQtS60MainDocument( CEikApplication& aApp )
- : CAknDocument( aApp )
- {
+CQtS60MainDocument::CQtS60MainDocument(CEikApplication& aApp)
+ : CAknDocument(aApp)
+{
// No implementation required
- }
+}
// ---------------------------------------------------------------------------
// CQtS60MainDocument::~CQtS60MainDocument()
@@ -98,9 +98,9 @@ CQtS60MainDocument::CQtS60MainDocument( CEikApplication& aApp )
// ---------------------------------------------------------------------------
//
CQtS60MainDocument::~CQtS60MainDocument()
- {
+{
// No implementation required
- }
+}
// ---------------------------------------------------------------------------
// CQtS60MainDocument::CreateAppUiL()
@@ -108,11 +108,10 @@ CQtS60MainDocument::~CQtS60MainDocument()
// ---------------------------------------------------------------------------
//
CEikAppUi* CQtS60MainDocument::CreateAppUiL()
- {
+{
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
- return ( static_cast <CEikAppUi*> ( new ( ELeave )CQtS60MainAppUi ) );
- }
+ return (static_cast <CEikAppUi*>(new(ELeave)CQtS60MainAppUi));
+}
// End of File
-
diff --git a/src/s60main/qts60maindocument.h b/src/s60main/qts60maindocument.h
index a95e620..77c5aa7 100644
--- a/src/s60main/qts60maindocument.h
+++ b/src/s60main/qts60maindocument.h
@@ -120,4 +120,3 @@ class CQtS60MainDocument : public CAknDocument
#endif // __QTS60MAINDOCUMENT_H__
// End of File
-
diff --git a/src/s60main/s60main.pro b/src/s60main/s60main.pro
index f74943f..57c9949 100644
--- a/src/s60main/s60main.pro
+++ b/src/s60main/s60main.pro
@@ -9,7 +9,7 @@ CONFIG -= qt shared
symbian {
# Note: UID only needed for ensuring that no filename generation conflicts occur
- TARGET.UID3 = 0x2001E61F
+ TARGET.UID3 = 0x2001E61F
CONFIG += png zlib
CONFIG -= jpeg
INCLUDEPATH += tmp $$QMAKE_INCDIR_QT/QtCore $$MW_LAYER_SYSTEMINCLUDE
@@ -21,8 +21,8 @@ symbian {
HEADERS = qts60mainapplication.h \
qts60mainappui.h \
qts60maindocument.h
-
- # This block serves the minimalistic resource file for S60 3.1 platforms.
+
+ # This block serves the minimalistic resource file for S60 3.1 platforms.
# Note there is no way to ifdef S60 version in mmp file, that is why the resource
# file is always compiled for WINSCW
minimalAppResource31 = \
@@ -30,23 +30,23 @@ symbian {
"HEADER" \
"TARGETPATH resource\apps" \
"END"
- MMP_RULES += minimalAppResource31
+ MMP_RULES += minimalAppResource31
# s60main needs to be built in ARM mode for GCCE to work.
MMP_RULES+="ALWAYS_BUILD_AS_ARM"
# staticlib should not have any lib depencies in s60
# This seems not to work, some hard coded libs are still added as dependency
- LIBS =
+ LIBS =
} else {
error("$$_FILE_ is intended only for Symbian!")
}
symbian-abld: {
# abld build commands generated resources after the static library is built, and
- # we have dependency to resource from static lib -> resources need to be generated
+ # we have dependency to resource from static lib -> resources need to be generated
# explicitly before library
- rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1"
+ rsgFix2.commands = "-$(DEL_FILE) $(EPOCROOT)Epoc32\Data\z\resource\apps\s60main.rsc >NUL 2>&1"
rsgFix.commands = "-$(ABLD) resource $(PLATFORM) $(CFG) 2>NUL"
QMAKE_EXTRA_TARGETS += rsgFix rsgFix2
PRE_TARGETDEPS += rsgFix rsgFix2
diff --git a/src/s60main/s60main.rss b/src/s60main/s60main.rss
index 6e8004c..11c68a3 100644
--- a/src/s60main/s60main.rss
+++ b/src/s60main/s60main.rss
@@ -83,4 +83,3 @@ RESOURCE MENU_PANE r_qt_wrapperapp_menu
{
}
// End of File
-