Observe volume keys on Symbian. Add minimal documentation to headers.
[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         w.show();
45         ret = a.exec();
46     }
47
48     // Release singletons
49     Library::close();
50     BookDb::close();
51     Settings::close();
52     Search::close();
53 #ifdef Q_OS_SYMBIAN
54     MediaKeysObserver::close();
55 #endif
56
57     // Re-start application if event loop exit code was 1000
58     if (ret == 1000) {
59         Platform::restart(argv);
60     }
61     return ret;
62 }