|
1 #include <hbinstance.h> |
|
2 #include <hbapplication.h> |
|
3 |
|
4 #include "contentwidget.h" |
|
5 |
|
6 //#define DEBUG_TO_FILE |
|
7 |
|
8 #ifdef DEBUG_TO_FILE |
|
9 #include <stdio.h> |
|
10 #include <QMutex> |
|
11 |
|
12 const int maxPathIndex = 1; |
|
13 const char *paths[/*maxPathIndex*/] = {"f:\\SecUiTestQt-log.txt"}; |
|
14 |
|
15 FILE* file = 0; |
|
16 |
|
17 void myMessageOutput(QtMsgType type, const char *msg) { |
|
18 switch (type) { |
|
19 case QtDebugMsg: { |
|
20 fprintf(file, "Debug: %s\n", msg); |
|
21 } |
|
22 break; |
|
23 case QtWarningMsg: { |
|
24 //fprintf(file, "Warning: %s\n", msg); |
|
25 } |
|
26 break; |
|
27 case QtCriticalMsg: { |
|
28 fprintf(file, "Critical: %s\n", msg); |
|
29 } |
|
30 break; |
|
31 case QtFatalMsg: { |
|
32 fprintf(file, "Fatal: %s\n", msg); |
|
33 abort(); |
|
34 } |
|
35 } |
|
36 } |
|
37 #endif |
|
38 |
|
39 |
|
40 int main(int argc, char *argv[]) |
|
41 { |
|
42 #ifdef DEBUG_TO_FILE |
|
43 int pathIndex = 0; |
|
44 while (!file && pathIndex < maxPathIndex) { |
|
45 file = fopen(paths[pathIndex], "a"); |
|
46 if (!file) ++pathIndex; |
|
47 } |
|
48 if (file) qInstallMsgHandler(myMessageOutput); |
|
49 qDebug("============================================================" |
|
50 "==========================================================="); |
|
51 qDebug("============================================================" |
|
52 "==========================================================="); |
|
53 #endif |
|
54 HbApplication app(argc, argv); |
|
55 app.setApplicationName( "SecUiTestQt" ); |
|
56 |
|
57 QString appDir = app.applicationDirPath(); |
|
58 |
|
59 HbMainWindow* window = new HbMainWindow(); |
|
60 |
|
61 ContentWidget *view = new ContentWidget(appDir, window); |
|
62 window->addView(view); |
|
63 |
|
64 window->show(); |
|
65 int closeCode = app.exec(); |
|
66 window->deleteLater(); |
|
67 |
|
68 #ifdef DEBUG_TO_FILE |
|
69 if (file) { |
|
70 fclose(file); |
|
71 } |
|
72 #endif |
|
73 return closeCode; |
|
74 } |