X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fmain.cpp;h=ef7a015db01acb920e0b08b26e14fe67ff7fe6dc;hb=0e3504774e4a889a3836c2eb2e02f4d38d3dc9b1;hp=4d626d976541f30653a1a95590ca9c772772f6d1;hpb=dd8c90f87463d370c3076e13b7c6cc0e27c0d2f5;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index 4d626d9..ef7a015 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -14,51 +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 "../src2/applicationlauncher.h" +#include "../src2/statusbarmodel.h" +#include "../src2/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.4.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 __arm__ - // the WindowManager positions the surface correctly -#endif -#ifdef __i386__ - w.move(0, 0); -#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); -#ifdef __arm__ - qDebug("Running on ARM architecture"); -#endif -#ifdef __i386__ - qDebug("Running on x86 architecture"); -#endif + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); return a.exec(); }