ftuapplication/src/main.cpp
changeset 0 c464cd7e2753
child 9 aa22d2c19e57
equal deleted inserted replaced
-1:000000000000 0:c464cd7e2753
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  First Time Use application main implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ftufirsttimeuse.h"
       
    20 #include "ftutest_global.h"
       
    21 
       
    22 #include <QtGui>
       
    23 #include <hbapplication.h>
       
    24 #include <QTranslator>
       
    25 #include <QLocale>
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // main
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 int main(int argc, char *argv[])
       
    32 {
       
    33     FTUTEST_FUNC_ENTRY("FTU::FtuFirstTimeUse::main");
       
    34     
       
    35     HbApplication app(argc, argv);    
       
    36 
       
    37     QTranslator translator;
       
    38     
       
    39     QString translation = "ftu_";
       
    40     if(argc > 1){
       
    41         translation.append(argv[1]);
       
    42     }
       
    43     else{
       
    44         // another option to load locale could be QLocale::system().language())
       
    45         translation.append(QLocale::system().name()); // this seems to be ftu_en_US in Windows and ftu_en_GB in WINSCW emulator and hardware
       
    46     }
       
    47     translator.load(translation, ":/translations" );
       
    48     app.installTranslator(&translator);
       
    49 
       
    50     QString exampleWizardsTranslation = "ftuexamplewizards_";
       
    51     if(argc > 1){
       
    52         exampleWizardsTranslation.append(argv[1]);
       
    53     }
       
    54     else{
       
    55         exampleWizardsTranslation.append(QLocale::system().name());
       
    56     }
       
    57     QTranslator exampleWizardsTranslator;
       
    58 
       
    59     exampleWizardsTranslator.load(exampleWizardsTranslation, ":/translations" );
       
    60     app.installTranslator(&exampleWizardsTranslator);
       
    61 
       
    62     FtuFirstTimeUse ftuFirstTimeUse;
       
    63 #ifdef ROM
       
    64     QDir::setCurrent("Z:/");    
       
    65 #else
       
    66     QDir::setCurrent("C:/");
       
    67     FTUDEBUG("main() - FtuApplication's current dir set to C:/");
       
    68 #endif //ROM
       
    69     QObject::connect(&app,SIGNAL(aboutToQuit()),&ftuFirstTimeUse,SLOT(stop()));
       
    70     QObject::connect(&ftuFirstTimeUse, SIGNAL(exit()), &app, SLOT(quit()),Qt::QueuedConnection);    
       
    71     ftuFirstTimeUse.start();
       
    72     int ret = app.exec();
       
    73     FTUTEST_FUNC_EXIT("FTU::FtuFirstTimeUse::main");
       
    74     return ret;       
       
    75 }