C

Event Sender: Sending Messages to Applications

// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial

// This file is part of the Qt Safe Renderer module

#include <QtSafeRenderer/qsafechecksum.h>
#include <QtSafeRenderer/qsafestring.h>
#include <QtSafeRenderer/qsafeevent.h>
#include <QtSafeEventSender/qsafeeventsender.h>
#include <QtSafePlatformAdaptation/eventhandler.h>
#include "tcpdatacontrol.h"
#include <QQuickView>
#include <QWindow>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQmlEngine>
#include <QGuiApplication>
#include <QProcess>

using namespace SafeRenderer;

int main(int argc, char **argv)
{
    QGuiApplication app(argc, argv);
    app.setWindowIcon(QIcon(":/Application_Logo.png"));
    DataControlInterface *dataInterface = new TCPDataControl();

    QQmlApplicationEngine view;
    const QUrl url(QStringLiteral("qrc:/Controller.qml"));
    view.rootContext()->setContextProperty("clusterDataControl", dataInterface);
    view.rootContext()->setContextProperty("hostName", qgetenv("QT_SAFERENDER_HOST"));
    QObject::connect(&view, &QQmlApplicationEngine::objectCreated, qApp,
        [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                qDebug() << "Failed to start the Controller.qml";
        }, Qt::QueuedConnection);
    view.addImportPath(":/imports");
    view.load(url);

    return app.exec();
}