-
Notifications
You must be signed in to change notification settings - Fork 28
/
main.cpp
53 lines (43 loc) · 1.49 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
#include <iostream>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QRunnable>
#include <QThreadPool>
#include <QIcon>
#include <QApplication>
#include "SMU.h"
#include "utils/fileio.h"
#include "config.h"
int main(int argc, char *argv[])
{
// Prevent config being written to ~/.config/Unknown Organization/pixelpulse2.conf
QCoreApplication::setOrganizationName("ADI");
QCoreApplication::setApplicationName("Pixelpulse2");
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
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")));
}
app.setWindowIcon(QIcon(":/icons/pp2.ico"));
QApplication::setWindowIcon(QIcon(":/icons/pp2.ico"));
int r = app.exec();
smu_session.closeAllDevices();
return r;
}