-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
74 lines (54 loc) · 1.7 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @file main.cpp
* @date 2012-07-28T01:11:23+0400
*
* @author Rabits <home.rabits@gmail.com>
* @copyright GNU General Public License, version 3 <http://www.gnu.org/licenses/>
*
* This file is a part of rTab project <https://github.com/rabits/rtab>
*
* @brief Main module
*
*/
#include <QtGui/QApplication>
#include <QtDeclarative>
#include "qmlapplicationviewer.h"
#include "src/common/common.h"
using namespace Common;
#include "src/ctab.h"
#include "src/graphics/graphics.h"
#include "src/song/song.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
log_notice("Init rTab v%1", PROJECT_VERSION);
QCoreApplication::setOrganizationName("Rabits");
QCoreApplication::setOrganizationDomain("rabits.ru");
QCoreApplication::setApplicationName("rtab");
QCoreApplication::setApplicationVersion(PROJECT_VERSION);
int return_code = 0;
try {
QScopedPointer<QApplication> app(createApplication(argc, argv));
Song::exportQML();
Graphics::exportQML();
QmlApplicationViewer viewer;
log_info("Creating context");
CTab::i()->initContext(viewer, &app);
log_info("Loading qml");
viewer.setSource(QUrl("qrc:/qml/main.qml"));
CTab::i()->initRoot(viewer);
log_notice("Init done, starting");
viewer.showExpanded();
return_code = app->exec();
CTab::destroyInstance();
return return_code;
}
catch( Common::CException const &e ) {
log_emerg("An unhandled exception has occured: %1", e.what());
}
catch(...) {
log_emerg("An unknown exception has occured!");
}
log_emerg("Abnormally exiting...");
CTab::destroyInstance();
return 1;
}