Première tranche verticale : domaine circuit via DataProvider/API
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QCursor>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QtQml>
|
||||
|
||||
#include "mock/mock_bdd.h"
|
||||
#include "mock/mock_systeme.h"
|
||||
#include "mock/mock_tbmesures.h"
|
||||
#include "dataprovider.h"
|
||||
|
||||
// ============================================================================
|
||||
// main.cpp - shipheart_wasm
|
||||
// ----------------------------------------------------------------------------
|
||||
// Dérivé du main.cpp du POC (§19). Ajout : enregistrement de DataProvider,
|
||||
// qui vient s'ajouter aux mocks existants (toujours nécessaires pour
|
||||
// Shipheart_page.qml/main.qml, qui appellent encore bdd.*/systeme.* pour les
|
||||
// fonctions non liées aux circuits - synchro, veille, etc., cf §19.4).
|
||||
// ============================================================================
|
||||
|
||||
static QJSValue appVersionSingletonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine)
|
||||
|
||||
QJSValue appInfo = scriptEngine->newObject();
|
||||
appInfo.setProperty("adresse_shipbase", QString());
|
||||
appInfo.setProperty("etat_connexion_bdd", 1);
|
||||
appInfo.setProperty("version", QStringLiteral("3.0.0-wasm"));
|
||||
appInfo.setProperty("type_installation", QStringLiteral("0"));
|
||||
appInfo.setProperty("taille_ecran", QString());
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
app.setOverrideCursor(Qt::BlankCursor);
|
||||
|
||||
QGuiApplication::setApplicationName("ShipHeart_Wasm");
|
||||
QGuiApplication::setApplicationVersion("3.0.0-wasm");
|
||||
|
||||
qmlRegisterType<Bdd>("qt.koriolan.shipheart", 1, 0, "Bdd");
|
||||
qmlRegisterType<TbMesuresModel>("qt.koriolan.shipheart", 1, 0, "TbMesuresModel");
|
||||
qmlRegisterType<Systeme>("qt.koriolan.shipheart", 1, 0, "Systeme");
|
||||
qmlRegisterType<DataProvider>("qt.koriolan.shipheart", 1, 0, "DataProvider");
|
||||
qmlRegisterSingletonType("qt.koriolan.shipheart", 1, 0, "AppInfo", appVersionSingletonProvider);
|
||||
|
||||
auto engine = new QQmlApplicationEngine(&app);
|
||||
engine->setObjectName("currentEngine");
|
||||
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user