logsui/logsapp/src/main.cpp
changeset 16 c5af8598d22c
parent 14 f27aebe284bb
child 17 90fe74753f71
equal deleted inserted replaced
14:f27aebe284bb 16:c5af8598d22c
    26 #include <QObject>
    26 #include <QObject>
    27 #include <hbmainwindow.h>
    27 #include <hbmainwindow.h>
    28 #include <hbapplication.h>
    28 #include <hbapplication.h>
    29 #include <hbstyleloader.h>
    29 #include <hbstyleloader.h>
    30 #include <hbtranslator.h>
    30 #include <hbtranslator.h>
       
    31 #include <QTranslator>
       
    32 
       
    33 // TODO: Use QTranslator for now as HbTranslator has some bugs regarding
       
    34 // language fallback handling, start using HbTranslator once those problems
       
    35 // are fixed 
       
    36 #define LOGS_USE_QTRANSLATOR
    31 
    37 
    32 int main(int argc, char *argv[])
    38 int main(int argc, char *argv[])
    33 {
    39 {
    34     LOGS_QDEBUG( "logs [UI] -> main()" )
    40     LOGS_QDEBUG( "logs [UI] -> main()" )
    35   
    41 
    36     HbApplication app(argc, argv);
    42     HbApplication app(argc, argv);
    37     LogsMainWindow window;
    43 
       
    44 #ifdef LOGS_USE_QTRANSLATOR
       
    45     QString lang = QLocale::system().name();
       
    46     QTranslator trans;
       
    47     QString path = "z:/resource/qt/translations/";
       
    48     if ( trans.load(path + "qt_" + lang) ){
       
    49         app.installTranslator(&trans);
       
    50     }
       
    51     QTranslator trans2;
       
    52     if ( trans2.load(path + "dialer_" + lang) ){
       
    53         app.installTranslator(&trans2);
       
    54     }
       
    55     QTranslator trans3;
       
    56     if ( trans3.load(path + "common_" + lang) ){
       
    57         app.installTranslator(&trans3);
       
    58     }
       
    59     
       
    60 #else
    38     HbTranslator translator("dialer");
    61     HbTranslator translator("dialer");
    39     translator.loadCommon();
    62     translator.loadCommon();
    40 
    63 #endif
       
    64     
       
    65     LogsMainWindow window;
    41     HbStyleLoader::registerFilePath(":/logslayouts");
    66     HbStyleLoader::registerFilePath(":/logslayouts");
    42     
    67     
    43     // Create service handler asap so that services are published fast.
    68     // Create service handler asap so that services are published fast.
    44     // Servicehandler cannot be created before HbApplication creation.
    69     // Servicehandler cannot be created before HbApplication creation.
    45     // This can cause problem of service request not coming through if
    70     // This can cause problem of service request not coming through if