#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "qmlhandler.h" using namespace std; int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // This has to be here to fix warnings QCoreApplication::setOrganizationName("CCats"); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; QMLHandler qmlHandler; // Set the context for the window, so that the qml files can be connected to // the qmlHandler engine.rootContext()->setContextProperty("_qmlHandler", &qmlHandler); // Load the main window QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/main.qml"))); QObject *object = component.create(); // Run the main window and save the return of the application in an integer // ret This is blocking, which means it will block the main program until the // window is closed int ret = app.exec(); // If we land here, the window has been closed. Properly disconnect from the // server now qmlHandler.onExit(); if (_RESTART) { // DO SHIT pid_t pid = 0; pid = fork(); if (pid == 0) { execl("./CCats-GUI", "CCats-GUI", (char *)NULL); exit(1); } } return ret; }