-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
82 lines (62 loc) · 2.31 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
75
76
77
78
79
80
81
82
//#include <QApplication>
#include <QtGui>
#include <QQmlApplicationEngine>
#include <QApplication>
#include <QQmlContext>
#include <QQuickStyle>
#include "apptools/TreeModel.h"
#include "apptools/SystemTray.h"
#include "apptools/Popup.h"
#include "apptools/LogHandler.h"
#include "apptools/Clipboard.h"
#include "aims/AimBase.h"
#include "aims/UserSettings.h"
#include "aims/ScreenGlobal.h"
#include "aims/AimNotifications.h"
#include "aims/RunningAims.h"
#include "aims/UserToken.h"
#include "aims/DoneActsChart.h"
#include <QDebug>
#ifdef Q_OS_ANDROID
#include <QtAndroidExtras>
#include <QAndroidService>
#endif
using namespace aim;
using namespace apptools;
int main(int argc, char *argv[])
{
#ifdef Q_OS_ANDROID
QAndroidService service(argc, argv);
#endif
QApplication app(argc, argv);
ScreenGlobal screen;
LocalSqlBase localBase(&app);
localBase.createTablesIfNeeded();
UserSettings userSettings(&app);
QQuickStyle::setStyle("Material");
QQmlApplicationEngine engine;
QQmlContext *context = engine.rootContext();
context->setContextProperty("localBase",&localBase);
context->setContextProperty("userSettings",&userSettings);
context->setContextProperty("screenGlobal",&screen);
context->setContextProperty("treeModel",&localBase.aimsTree);
context->setContextProperty("tagTree",&localBase.tagsTree);
SystemTray tray(&app);
context->setContextProperty("systemTray",&tray);
PopUp popUp;
context->setContextProperty("popUpItem",&popUp);
AimNotifications notifications(localBase, popUp, &app);
notifications.startWatchDog(30);
engine.rootContext()->setContextProperty("androidNotify",¬ifications.androidNotification);
RunningAims runningAims(localBase, &app);
context->setContextProperty("runningAims",&runningAims);
LogHandler::getInst().setFilename("log.txt");
UserToken token;
engine.rootContext()->setContextProperty("userToken",&token);
Clipboard clip;
engine.rootContext()->setContextProperty("clipboard",&clip);
qmlRegisterType<ConsoleLogQML>("aim.tasks",1,0,"ConsoleLog");
qmlRegisterType<DoneActsChartQML>("aim.tasks",1,0,"DoneActsChart");
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
return app.exec();
}