|
@@ -1,6 +1,8 @@
|
|
|
#include <QGuiApplication>
|
|
|
#include <QObject>
|
|
|
#include <QQmlApplicationEngine>
|
|
|
+#include <QQmlComponent>
|
|
|
+#include <QQmlContext>
|
|
|
#include <csignal>
|
|
|
#include <cstdio>
|
|
|
#include <cstdlib>
|
|
@@ -18,6 +20,8 @@ int outpipefd[2];
|
|
|
char buf[1024];
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
+ qInfo() << "Program Start";
|
|
|
+
|
|
|
pid_t pid = 0;
|
|
|
char msg[256];
|
|
|
int status;
|
|
@@ -45,29 +49,24 @@ int main(int argc, char *argv[]) {
|
|
|
close(outpipefd[0]);
|
|
|
close(inpipefd[1]);
|
|
|
|
|
|
- // ########## GUI CODE ##########
|
|
|
+ // ########## Load GUI ##########
|
|
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
|
|
+ // This has to be here to fix warnings
|
|
|
+ QCoreApplication::setOrganizationName("CCats");
|
|
|
+
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
|
QQmlApplicationEngine engine;
|
|
|
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
-
|
|
|
- if (engine.rootObjects().isEmpty())
|
|
|
- return -1;
|
|
|
|
|
|
QMLHandler qmlHandler;
|
|
|
|
|
|
- QObject *statusButton =
|
|
|
- engine.rootObjects().first()->findChild<QObject *>("getstatusbutton");
|
|
|
+ engine.rootContext()->setContextProperty("_qmlHandler", &qmlHandler);
|
|
|
|
|
|
- QObject::connect(statusButton, SIGNAL(clicked()), &qmlHandler,
|
|
|
- SLOT(onGetStatusClick()));
|
|
|
+ QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/main.qml")));
|
|
|
|
|
|
- QObject::connect(&qmlHandler, SIGNAL(setStatusMessage(QVariant)),
|
|
|
- engine.rootObjects().first(),
|
|
|
- SLOT(setStatusMessage(QVariant)));
|
|
|
+ QObject *object = component.create();
|
|
|
|
|
|
return app.exec();
|
|
|
}
|