forked from analogdevicesinc/Pixelpulse2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
51 lines (40 loc) · 1.4 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
#include <iostream>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QRunnable>
#include <QThreadPool>
#include "SMU.h"
#include "utils/backtracing.h"
#include "utils/fileio.h"
int main(int argc, char *argv[])
{
// Prevent config being written to ~/.config/Unknown Organization/pixelpulse2.conf
QCoreApplication::setOrganizationName("Pixelpulse2");
QCoreApplication::setApplicationName("Pixelpulse2");
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
init_signal_handlers(argv[0]);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
registerTypes();
FileIO fileIO;
SessionItem smu_session;
engine.rootContext()->setContextProperty("session", &smu_session);
QVariantMap versions;
versions.insert("build_date", BUILD_DATE);
versions.insert("git_version", GIT_VERSION);
engine.rootContext()->setContextProperty("versions", versions);
engine.rootContext()->setContextProperty("fileio", &fileIO);
if (argc > 1) {
if (strcmp(argv[1], "-v") || strcmp(argv[1], "--version")) {
std::cout << GIT_VERSION << ": Built on " << BUILD_DATE << std::endl;
return 0;
}
engine.load(argv[1]);
} else {
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
}
int r = app.exec();
smu_session.closeAllDevices();
return r;
}