-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
55 lines (39 loc) · 1.54 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
#include "BuildConfig.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QScreen>
#include <QZXing.h>
#include "Config.h"
#include "MatchData.h"
#include "PlatformHelper.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QZXing::registerQMLTypes();
app.setOrganizationName(BuildConfig.ORG_NAME);
app.setApplicationName(BuildConfig.APP_NAME);
app.setApplicationVersion(BuildConfig.versionString());
QQuickStyle::setStyle("Universal");
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
QZXing::registerQMLImageProvider(engine);
ScouterConfig *config = new ScouterConfig(&app);
engine.rootContext()->setContextProperty("config", config);
engine.rootContext()->setContextProperty("teleModel", config->teleModel());
engine.rootContext()->setContextProperty("autoModel", config->autoModel());
engine.rootContext()->setContextProperty("endModel", config->endModel());
engine.rootContext()->setContextProperty("scalesModel", config->scalesModel());
MatchData *match = new MatchData(&app);
engine.rootContext()->setContextProperty("matchData", match);
PlatformHelper *platform = new PlatformHelper(&app);
engine.rootContext()->setContextProperty("platform", platform);
engine.loadFromModule("QFRCScouter", "Main");
return app.exec();
}