taskswitcherapp/tsapplication/src/main.cpp
changeset 35 f9ce957a272c
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     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:
       
    15 *
       
    16 */
       
    17 #include <QTranslator>
       
    18 #include <QLocale>
       
    19 
       
    20 #include <hbapplication.h>
       
    21 #include <hbmainwindow.h>
       
    22 
       
    23 #include "tstaskswitcher.h"
       
    24 
       
    25 int main(int argc, char *argv[])
       
    26 {
       
    27     HbApplication tsApp(argc, argv);
       
    28     tsApp.setApplicationName("Task Switcher");
       
    29 
       
    30     HbMainWindow mainWindow(NULL, Hb::WindowFlagTransparent);
       
    31     mainWindow.hideItems(Hb::AllItems);    
       
    32     
       
    33     QString locale = QLocale::system().name();
       
    34     QTranslator translator;
       
    35 
       
    36     QString path = "resource/qt/translations/";
       
    37     QString tsTrFile = QString("taskswitcher_") + locale;
       
    38 #ifdef Q_OS_SYMBIAN
       
    39     // TRAP is must here, otherwise it crashes
       
    40     TRAP_IGNORE(
       
    41         bool tsLoaded(false);
       
    42         tsLoaded = translator.load(tsTrFile, QString("z:/") + path);
       
    43         if (!tsLoaded)
       
    44         translator.load(tsTrFile, QString("c:/") + path);
       
    45     );
       
    46 #else
       
    47     translator.load(tsTrFile, QString(path));
       
    48 #endif //Q_OS_SYMBIAN  
       
    49     tsApp.installTranslator(&translator);
       
    50 
       
    51     TsTaskSwitcher ts;
       
    52     QObject::connect(&tsApp, SIGNAL(aboutToQuit()), &ts, SLOT(stop()));
       
    53     QObject::connect(&ts, SIGNAL(exit()), &tsApp, SLOT(quit()), Qt::QueuedConnection);
       
    54     ts.start();
       
    55 
       
    56     return tsApp.exec();
       
    57 }