From 7ff5fd86376714aa4de5dae7e8ef7576d69b5feb Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Tue, 4 Aug 2009 12:47:00 +0300 Subject: Applied Qt coding conventions for s60main --- src/s60main/qts60main.cpp | 12 +++++------ src/s60main/qts60main_mcrt0.cpp | 28 ++++++++++++------------ src/s60main/qts60mainapplication.cpp | 16 +++++++------- src/s60main/qts60mainappui.cpp | 37 ++++++++++++++++--------------- src/s60main/qts60maindocument.cpp | 42 ++++++++++++++++++------------------ 5 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp index d7daf4a..c228c0d 100644 --- a/src/s60main/qts60main.cpp +++ b/src/s60main/qts60main.cpp @@ -48,16 +48,16 @@ * 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 8631989..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,21 +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::PushL(argv); CleanupArrayDelete::PushL(envp); //Call user(application)'s main - int ret = 0; - QT_TRYCATCH_LEAVING( ret = CALLMAIN(argc, argv, envp); ); - CleanupStack::PopAndDestroy(2,argv); + int ret = 0; + QT_TRYCATCH_LEAVING(ret = CALLMAIN(argc, argv, envp);); + CleanupStack::PopAndDestroy(2, argv); return ret; } @@ -89,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..ed7ae22 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( CQtS60MainDocument::NewL( *this ) ) ); - } + return (static_cast(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,13 +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/qts60mainappui.cpp b/src/s60main/qts60mainappui.cpp index ef54417..ea6c3d4 100644 --- a/src/s60main/qts60mainappui.cpp +++ b/src/s60main/qts60mainappui.cpp @@ -67,7 +67,7 @@ void CQtS60MainAppUi::ConstructL() // 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 @@ -76,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(); } @@ -109,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); @@ -123,7 +123,7 @@ void CQtS60MainAppUi::HandleCommandL( TInt aCommand ) void CQtS60MainAppUi::HandleResourceChangeL(TInt aType) { CAknAppUi::HandleResourceChangeL(aType); - + if (qApp) qApp->symbianResourceChange(aType); } @@ -157,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( aObject ); + CQtS60MainAppUi* myObj = static_cast(aObject); myObj->OpenCMainCallBack(); return 0; } @@ -186,30 +186,29 @@ 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/qts60maindocument.cpp b/src/s60main/qts60maindocument.cpp index eb7ea42..cdbb01d 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,11 @@ 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 ( new ( ELeave )CQtS60MainAppUi ) ); - } + return (static_cast (new(ELeave)CQtS60MainAppUi)); +} // End of File -- cgit v0.12