Alive on Symbian.
[dorian] / main.cpp
1 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
2 #include <unistd.h>
3 #endif
4
5 #include <QtGui/QApplication>
6
7 #include "mainwindow.h"
8 #include "trace.h"
9 #include "settings.h"
10
11 static const char *DORIAN_VERSION =
12 #include "pkg/version.txt"
13 ;
14
15 static const QtMsgType DORIAN_DEFAULT_TRACE_LEVEL =
16 #ifdef Q_OS_SYMBIAN
17         QtDebugMsg
18 #else
19         QtWarningMsg
20 #endif
21         ;
22
23 int main(int argc, char *argv[])
24 {
25     QApplication a(argc, argv);
26
27     Trace::level = (QtMsgType)Settings::instance()->
28         value("tracelevel", (int)DORIAN_DEFAULT_TRACE_LEVEL).toInt();
29     qInstallMsgHandler(Trace::messageHandler);
30
31     a.setApplicationName("Dorian");
32     a.setApplicationVersion(DORIAN_VERSION);
33     a.setOrganizationDomain("pipacs.com");
34     a.setOrganizationName("Pipacs");
35
36     MainWindow w;
37     w.show();
38
39 #if 0 // FIXME #ifdef Q_OS_SYMBIAN
40     // Remove context menu from all widgets
41     foreach (QWidget *w, QApplication::allWidgets()) {
42         w->setContextMenuPolicy(Qt::NoContextMenu);
43     }
44 #endif // Q_OS_SYMBIAN
45
46     int ret = a.exec();
47     if (ret == 1000) {
48 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
49         extern char **environ;
50         execve(argv[0], argv, environ);
51 #endif
52     }
53     return ret;
54 }