|
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 #include <QFile> |
|
20 #include <hbapplication.h> |
|
21 #include <QDateTime> |
|
22 #include "flashmsgnotifier.h" |
|
23 |
|
24 #define LOC_TITLE hbTrId("") |
|
25 |
|
26 #include "debugtraces.h" |
|
27 |
|
28 const QString debugFileName("c:/flashmessage.txt"); |
|
29 |
|
30 #ifdef _DEBUG_TRACES_ |
|
31 void debugInit(QtMsgType type, const char *msg) |
|
32 { |
|
33 |
|
34 QFile ofile(debugFileName); |
|
35 if (!ofile.open(QIODevice::Append | QIODevice::Text)) { |
|
36 qFatal("error opening results file"); |
|
37 return; |
|
38 } |
|
39 QDateTime dt = QDateTime::currentDateTime(); |
|
40 |
|
41 QTextStream out(&ofile); |
|
42 switch (type) { |
|
43 case QtDebugMsg: |
|
44 out << "\n DEBUG:"; |
|
45 out << msg; |
|
46 break; |
|
47 case QtWarningMsg: |
|
48 out << "\n WARN:"; |
|
49 out << msg; |
|
50 break; |
|
51 case QtCriticalMsg: |
|
52 out << "\n "; |
|
53 out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap"); |
|
54 out << " CRITICAL:"; |
|
55 out << msg; |
|
56 break; |
|
57 case QtFatalMsg: |
|
58 out << "\n FATAL:"; |
|
59 out << msg; |
|
60 abort(); |
|
61 break; |
|
62 default: |
|
63 out << " No Log Selection Type:"; |
|
64 out << msg; |
|
65 break; |
|
66 |
|
67 } |
|
68 } |
|
69 #endif |
|
70 |
|
71 int main(int argc, char *argv[]) |
|
72 { |
|
73 HbApplication app(argc, argv); |
|
74 app.hideSplash(); |
|
75 QString locale = QLocale::system().name(); |
|
76 QString path = "z:/resource/qt/translations/"; |
|
77 QTranslator translator; |
|
78 QTranslator translator_comm; |
|
79 translator.load(path + QString("messaging_") + locale); |
|
80 translator_comm.load(path + QString("common_") + locale); |
|
81 //translator.load( "messaging_en_GB", ":/translations" ); |
|
82 app.installTranslator(&translator); |
|
83 app.installTranslator(&translator_comm); |
|
84 |
|
85 app.setApplicationName(LOC_TITLE); |
|
86 #ifdef _DEBUG_TRACES_ |
|
87 //Debug Logs |
|
88 QFile ofile; |
|
89 if (ofile.exists(debugFileName)) { |
|
90 ofile.remove(debugFileName); |
|
91 } |
|
92 qInstallMsgHandler(debugInit); |
|
93 #endif |
|
94 FlashMsgNotifier* w = new FlashMsgNotifier; |
|
95 int rv = app.exec(); |
|
96 |
|
97 delete w; |
|
98 return rv; |
|
99 } |