1 /* |
|
2 * Copyright (c) 2010 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: satapp main |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <QtGlobal> |
|
20 #include <QApplication> |
|
21 #include <QTranslator> |
|
22 #include <hbapplication.h> |
|
23 #include <hbmainwindow.h> |
|
24 #include "satappmainhandler.h" |
|
25 |
|
26 |
|
27 #ifdef SAT_DEBUG_TO_FILE |
|
28 // ------------------------------------------------------------ |
|
29 // this segment provides functionality that copies all QT debug |
|
30 // output to RFileLogger, and also the standard QT debug stream |
|
31 #include <flogger.h> |
|
32 #include <e32svr.h> |
|
33 _LIT(KTfLogFolder, "sat"); |
|
34 _LIT(KTfLogFile, "satui.txt"); |
|
35 // original message handler |
|
36 QtMsgHandler originalMsgHandler; |
|
37 // debug redirection function |
|
38 void qDebugToRFileLogger(QtMsgType type, const char *msg) |
|
39 { |
|
40 TPtrC8 symbian_msg((const TUint8*)msg); |
|
41 RFileLogger::Write(KTfLogFolder,KTfLogFile, |
|
42 EFileLoggingModeAppend,symbian_msg); |
|
43 if (originalMsgHandler) originalMsgHandler(type,msg); |
|
44 } |
|
45 // ------------------------------------------------------------ |
|
46 #endif |
|
47 |
|
48 |
|
49 |
|
50 int main(int argc, char *argv[]) |
|
51 { |
|
52 #ifdef SAT_DEBUG_TO_FILE |
|
53 originalMsgHandler = qInstallMsgHandler(qDebugToRFileLogger); |
|
54 #endif |
|
55 |
|
56 qDebug("SATAPP: main"); |
|
57 |
|
58 HbApplication app(argc, argv); |
|
59 qDebug("SATAPP: main app created"); |
|
60 |
|
61 QTranslator translator; |
|
62 bool ok = translator.load(":/translations/satapp"); |
|
63 qDebug("SATUI: main, translation %d (1=OK, 0=fail)", ok ); |
|
64 app.installTranslator(&translator); |
|
65 |
|
66 HbMainWindow window; |
|
67 qDebug("SATAPP: main window created"); |
|
68 |
|
69 SatAppMainHandler *mainHandler = new SatAppMainHandler(window); |
|
70 |
|
71 window.show(); |
|
72 qDebug("SATAPP: main view showed"); |
|
73 |
|
74 int result = app.exec(); |
|
75 qDebug("SATAPP: main exit %d", result); |
|
76 |
|
77 delete mainHandler; |
|
78 return result; |
|
79 } |
|
80 |
|
81 //End of file |
|