diff options
Diffstat (limited to 'Application/main.cpp')
-rw-r--r-- | Application/main.cpp | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/Application/main.cpp b/Application/main.cpp index 3631708..51b0c39 100644 --- a/Application/main.cpp +++ b/Application/main.cpp @@ -14,37 +14,42 @@ * limitations under the License. */ -#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include <QSurfaceFormat>
-#include <QDir>
-#include <QQmlContext>
-#include <QDebug>
-
-
-int main(int argc, char *argv[])
-{
- QSurfaceFormat defaultFormat;
- defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer);
- defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES);
- defaultFormat.setProfile(QSurfaceFormat::NoProfile);
- defaultFormat.setVersion(2,0);
- defaultFormat.setSwapInterval(1);
- defaultFormat.setDepthBufferSize(8);
- defaultFormat.setAlphaBufferSize(8);
- QSurfaceFormat::setDefaultFormat(defaultFormat);
-
- QGuiApplication app(argc, argv);
-
- QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("CurDirPath", QString(QCoreApplication::applicationDirPath()));
- 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();
-}
+#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QSurfaceFormat> +#include <QDir> +#include <QQmlContext> +#include <QDebug> + +#include "cluster-service.hxx" + +int main(int argc, char *argv[]) +{ + QSurfaceFormat defaultFormat; + defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer); + defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES); + defaultFormat.setProfile(QSurfaceFormat::NoProfile); + defaultFormat.setVersion(2,0); + defaultFormat.setSwapInterval(1); + defaultFormat.setDepthBufferSize(8); + defaultFormat.setAlphaBufferSize(8); + QSurfaceFormat::setDefaultFormat(defaultFormat); + + QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + engine.rootContext()->setContextProperty("CurDirPath", QString(QCoreApplication::applicationDirPath())); + 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); + + QClusterService cluster_service; + cluster_service.start(); + engine.rootContext()->setContextProperty("cluster_service", &cluster_service); + + return app.exec(); +} |