vtuis/lcvtapp/main.cpp
branchGCC_SURGE
changeset 29 c9ec3f2fcd87
parent 27 dcbddbbaf8fd
equal deleted inserted replaced
23:c378a0498b84 29:c9ec3f2fcd87
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15 *
       
    16 */
       
    17 //SYSTEM
       
    18 #include <lcviewmanager.h>
       
    19 #include <QLocale>
       
    20 #include <QTranslator>
       
    21 #include <eikenv.h>
       
    22 #include <apgwgnam.h>
       
    23 
       
    24 //USER
       
    25 #include "cvtlogger.h"
       
    26 #include "lcapplication.h"
       
    27 
       
    28 
       
    29 int main(int argc, char *argv[])
       
    30 {
       
    31     LcHbApplication app(argc, argv);    
       
    32     CVtLogger::Initialize(); // Cannot do before app creation as activescheduler is installed at that stage
       
    33     __VTPRINT2(CVtLogger::ELogToFile, "videotelui.exe::main entered: argc=%d ",argc);
       
    34     if (argc > 0)
       
    35     {
       
    36         QString arg1Str(QString::fromUtf8(argv[0]));
       
    37         TPtrC arg1(arg1Str.utf16());
       
    38         CVtLogger::Print(CVtLogger::ELogToFile,arg1);
       
    39     }  
       
    40        
       
    41     //Load application-specific translator
       
    42     QString lang = QLocale::system().name();
       
    43     QString path = "z:/resource/qt/translations/";
       
    44     QTranslator translator;
       
    45     if ( translator.load( path + "video_telephone_" + lang + ".qm") ){
       
    46         app.installTranslator(&translator);
       
    47     } else {
       
    48         __VTPRINT( DEBUG_GEN, "videotelui.exe::main, couldn't load translation" );
       
    49     }
       
    50     
       
    51     // Temporarily set VT as system app as otherwise GOOM memory releasing will shut
       
    52     // down the process when running low on graphics mem.
       
    53     CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(CEikonEnv::Static()->WsSession());
       
    54     wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down
       
    55     wgName->SetCaptionL(_L("Videotelephony"));
       
    56     wgName->SetAppUid(TUid::Uid(0x101F8681));
       
    57     wgName->SetWindowGroupName(CEikonEnv::Static()->RootWin());
       
    58     CleanupStack::PopAndDestroy();
       
    59     
       
    60     QString engineName("Videotelephony");
       
    61     QString applicationName("Video Telephone");
       
    62     
       
    63     LcViewManager viewManager(engineName,applicationName);
       
    64  
       
    65     QObject::connect( &app, SIGNAL( handleQuit() ), 
       
    66              &viewManager, SLOT( terminateSession() ),
       
    67              Qt::QueuedConnection );
       
    68 
       
    69     int err = app.exec();
       
    70     __VTPRINT2(CVtLogger::ELogToFile, "videotelui.exe::main returns %d ",err);
       
    71     CVtLogger::Uninitialize();
       
    72     return err;
       
    73 }