X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fmain.cpp;h=7d9953704dbd125bd8d5b383b7c29de5d3aec21c;hb=c5f5ce84f3991b02bdd9472d63b56fdbaf1a6c65;hp=264468b12b708c4c2289c77c5d21c6792f6df845;hpb=cf8cd699e91df40c3f9070019f7c561432b4b4dd;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index 264468b..7d99537 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -16,49 +16,55 @@ #include "mainwindow.h" #include -#include -//#include -#include +#include +#include +#include +#include + +#include "../src2/applicationlauncher.h" +#include "../src2/statusbarmodel.h" +#include "layouthandler.h" +#include "../src2/applicationmodel.h" +#include "../src2/usermanagement.h" +#include "homescreencontrolinterface.h" int main(int argc, char *argv[]) { - // 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); // used for application settings (QSettings) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); - QCoreApplication::setApplicationVersion("0.3.0"); + QCoreApplication::setApplicationVersion("0.6.0"); + + qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); + + qDBusRegisterMetaType(); + qDBusRegisterMetaType >(); - QSurfaceFormat format; - format.setDepthBufferSize(16); - format.setStencilBufferSize(8); + qmlRegisterType("HomeScreen", 1, 0, "ApplicationLauncher"); + qmlRegisterType("Home", 1, 0, "ApplicationModel"); + qmlRegisterType("HomeScreen", 1, 0, "StatusBarModel"); - MainWindow w; - w.show(); -#ifdef __arm__ - // trigger wayland compositor to position the surface correctly -#endif -#ifdef __i386__ - w.move(0, 0); -#endif + QQmlApplicationEngine engine; + LayoutHandler* layoutHandler = new LayoutHandler(); + HomeScreenControlInterface* hsci = new HomeScreenControlInterface(); + QObject::connect(hsci, SIGNAL(newRequestGetAllSurfacesOfProcess(int)), layoutHandler, SLOT(requestGetAllSurfacesOfProcess(int))); + 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))); -#ifdef __arm__ - qDebug("Running on ARM architecture"); -#endif -#ifdef __i386__ - qDebug("Running on x86 architecture"); -#endif + engine.rootContext()->setContextProperty("layoutHandler", layoutHandler); + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + QObject *home = engine.rootObjects().first()->findChild("Home"); + QObject *shortcutArea = engine.rootObjects().first()->findChild("ShortcutArea"); + QObject *statusArea = engine.rootObjects().first()->findChild("StatusArea"); + UserManagement userManagement(home, shortcutArea, statusArea); + Q_UNUSED(userManagement); return a.exec(); }