-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
55 lines (41 loc) · 2.11 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 <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtCharts/QChartView>
#include <QtCharts/QPieSeries>
#include <QtCharts/QPieSlice>
#include <QtWidgets> // Für Messagebox
#include "PowerNodeModel.h"
// globals ----------------------------------------
// global array for saving the XML content of SmartCharger app running on SmartCharger RasPi
QByteArray m_XMLfiledata;
// global array for saving the JSON content of mbmd app running on SmartCharger RasPi
QString m_JSONfiledata;
// global flag memory for error messages
// Flag: Bit 0 = 1 -> EDLD antwortet nicht korrekt
// Flag: Bit 1 = 1 -> MBMD antwortet nicht korrekt
quint8 m_messageFlag = 0;
// global value for changing the ChargeMode on SmartCharger RasPi
QString m_setChargeModeString; // Befehl für remote control des SmartCharger (off, quick, surplus, manual);
int m_ManualSetCurrent; // Befehl für remote control des SmartCharger (manual current 6, 12, 18 A)
QString m_EVChargingModeS; // Anzeige der manuell einzustellenden maximalen Ladeleistung
//int m_EVPercent; // Befehl für remote control des SmartCharger (0..50..100 % Ladung -> EV)
// globals ----------------------------------------
int main(int argc, char *argv[])
{
//#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
//#endif
// QGuiApplication app(argc, argv); // Für Messagebox muss QApplication verwendet werden
QApplication app(argc, argv);
PowerNodeModel powerNodeModel;
QQmlApplicationEngine engine;
qmlRegisterSingletonInstance<PowerNodeModel>("PowerNodeModel", 1, 0, "PowerNodeModel", &powerNodeModel);
const QUrl url(QStringLiteral("qrc:/main.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl)
{
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
engine.load(url);
return app.exec();
}