X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fmain.cpp;h=47d4f1617c8067d49fbf5cd24d68bb41b7fae917;hb=09f2f0036f122e49aa49e6c446d723850192a725;hp=a896c2e6e6c860fd2c69fa5ba0a88ec814bddab1;hpb=83cfbb9fe4bcc17f6b00c8a25aa3eb8c2c850ac0;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index a896c2e..47d4f16 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH + * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,49 +14,67 @@ * limitations under the License. */ -#include "mainwindow.h" -#include -#include -//#include +#include +#include +#include +#include +#include +#include -int main(int argc, char *argv[]) +#include "layouthandler.h" +#include "homescreencontrolinterface.h" +#include "applicationlauncher.h" +#include "statusbarmodel.h" +#include "applicationmodel.h" + +void noOutput(QtMsgType, const QMessageLogContext &, const QString &) { - // allow only one instance of this application - /*QSharedMemory appInstance; - appInstance.setKey("HomeScreen"); - if (!appInstance.create(1)) - { - qDebug("Only one instance of the Home Screen App allowed!"); - exit(-1); - }*/ +} - QApplication a(argc, argv); +int main(int argc, char *argv[]) +{ + QGuiApplication a(argc, argv); - // used for application settings (QSettings) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); - QCoreApplication::setApplicationVersion("0.6.0"); + QCoreApplication::setApplicationVersion("0.7.0"); - qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); + QCommandLineParser parser; + parser.setApplicationDescription("AGL HomeScreen - see wwww... for more details"); + parser.addHelpOption(); + parser.addVersionOption(); + QCommandLineOption quietOption(QStringList() << "q" << "quiet", + QCoreApplication::translate("main", "Be quiet. No outputs.")); + parser.addOption(quietOption); + parser.process(a); + + if (parser.isSet(quietOption)) + { + qInstallMessageHandler(noOutput); + } qDBusRegisterMetaType(); qDBusRegisterMetaType >(); - MainWindow w; - w.show(); -#ifdef HAVE_IVI_LAYERMANAGEMENT_API - // the WindowManager positions the surface correctly -#else - w.move(0, 0); -#endif - -#ifdef __arm__ - qDebug("Running on ARM architecture"); -#endif -#ifdef __i386__ - qDebug("Running on x86 architecture"); -#endif + qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); + qmlRegisterType("Home", 1, 0, "ApplicationModel"); + qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); + + QQmlApplicationEngine engine; + + LayoutHandler* layoutHandler = new LayoutHandler(); + + HomeScreenControlInterface* hsci = new HomeScreenControlInterface(); + QObject::connect(hsci, SIGNAL(newRequestGetSurfaceStatus(int)), layoutHandler, SLOT(requestGetSurfaceStatus(int))); + QObject::connect(hsci, SIGNAL(newRequestsToBeVisibleApp(int)), layoutHandler, SLOT(makeMeVisible(int))); + QObject::connect(hsci, SIGNAL(newRequestRenderSurfaceToArea(int, int)), layoutHandler, SLOT(requestRenderSurfaceToArea(int,int))); + QObject::connect(hsci, SIGNAL(newRequestRenderSurfaceToAreaAllowed(int, int)), layoutHandler, SLOT(requestRenderSurfaceToAreaAllowed(int,int))); + QObject::connect(hsci, SIGNAL(newRequestSurfaceIdToFullScreen(int)), layoutHandler, SLOT(requestSurfaceIdToFullScreen(int))); + + engine.rootContext()->setContextProperty("layoutHandler", layoutHandler); + + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return a.exec(); }