X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=app%2Fmain.cpp;h=38ccfe129e08df40d42f2a315c5cf69a7217e3f4;hb=bba7642118e223492bf5a82eb3fed04a59e34c2c;hp=b2133f7200553d4187f012955b2fab4bd45c0128;hpb=560062626becb4d211a9948bf3008921129711cf;p=apps%2Fhvac.git diff --git a/app/main.cpp b/app/main.cpp index b2133f7..38ccfe1 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -14,33 +14,30 @@ * limitations under the License. */ -#include -#include +#include #include -#include +#include -#ifdef HAVE_LIBHOMESCREEN -#include -#endif +#include "translator.h" int main(int argc, char *argv[]) { -#ifdef HAVE_LIBHOMESCREEN - LibHomeScreen libHomeScreen; - - if (!libHomeScreen.renderAppToAreaAllowed(0, 1)) { - qWarning() << "renderAppToAreaAllowed is denied"; - return -1; + AGLApplication app(argc, argv); + app.setApplicationName("HVAC"); + app.setupApplicationRole("hvac"); + + QQmlApplicationEngine *engine = app.getQmlApplicationEngine(); + QQmlContext *context = engine->rootContext(); + QVariant v = context->contextProperty(QStringLiteral("bindingAddress")); + if(v.canConvert(QMetaType::QUrl)) { + QUrl bindingAddress = v.toUrl(); + context->setContextProperty("hvac", new HVAC(bindingAddress)); + } else { + qCritical("Cannot find bindingAddress property in context, SignalComposer unavailable"); } -#endif - - QGuiApplication app(argc, argv); - - QQuickStyle::setStyle("AGL"); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/HVAC.qml"))); + qmlRegisterType("Translator", 1, 0, "Translator"); + app.load(QUrl(QStringLiteral("qrc:/HVAC.qml"))); return app.exec(); }