Nothing, really.
[dorian] / main.cpp
1 #include <QtGui/QApplication>
2
3 #include "mainwindow.h"
4 #include "trace.h"
5 #include "settings.h"
6 #include "library.h"
7 #include "settings.h"
8 #include "bookdb.h"
9 #include "search.h"
10 #include "platform.h"
11
12 #ifdef Q_OS_SYMBIAN
13 #   include "mediakeysobserver.h"
14 #endif
15
16 static const char *DORIAN_VERSION =
17 #include "pkg/version.txt"
18 ;
19
20 static const QtMsgType DORIAN_DEFAULT_TRACE_LEVEL =
21 #ifdef Q_OS_SYMBIAN
22         QtDebugMsg
23 #else
24         QtWarningMsg
25 #endif
26         ;
27
28 int main(int argc, char *argv[])
29 {
30     QApplication a(argc, argv);
31     int ret;
32
33     a.setApplicationName("Dorian");
34     a.setApplicationVersion(DORIAN_VERSION);
35     a.setOrganizationDomain("pipacs.com");
36     a.setOrganizationName("Pipacs");
37
38     Trace::level = (QtMsgType)Settings::instance()->
39         value("tracelevel", (int)DORIAN_DEFAULT_TRACE_LEVEL).toInt();
40     qInstallMsgHandler(Trace::messageHandler);
41
42     {
43         MainWindow w;
44         ret = a.exec();
45     }
46
47     // Release singletons
48     Library::close();
49     BookDb::close();
50     Settings::close();
51     Search::close();
52 #ifdef Q_OS_SYMBIAN
53     MediaKeysObserver::close();
54 #endif
55
56     // Re-start application if event loop exit code was 1000
57     if (ret == 1000) {
58         Platform::restart(argv);
59     }
60     return ret;
61 }