X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=HomeScreen%2Fsrc%2Fmain.cpp;h=dcad4c6b22c670c9b9f1e72aa9556aad6332336b;hb=a4f5c7d97fcbb97ece05cfbca38fb1963ab11377;hp=a623fff56863b8877dcb0fb18efd62aed804d402;hpb=9ca0a50d021a8d6e12cfb8f04671ba3dd389f92d;p=staging%2FHomeScreen.git diff --git a/HomeScreen/src/main.cpp b/HomeScreen/src/main.cpp index a623fff..dcad4c6 100644 --- a/HomeScreen/src/main.cpp +++ b/HomeScreen/src/main.cpp @@ -14,48 +14,51 @@ * limitations under the License. */ -#include "mainwindow.h" -#include -#include -//#include +#include +#include +#include +#include +#include + +#include "layouthandler.h" +#include "homescreencontrolinterface.h" +#include "../src2/applicationlauncher.h" +#include "../src2/statusbarmodel.h" +#include "../src2/applicationmodel.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); + QGuiApplication a(argc, argv); // used for application settings (QSettings) QCoreApplication::setOrganizationDomain("LinuxFoundation"); QCoreApplication::setOrganizationName("AutomotiveGradeLinux"); QCoreApplication::setApplicationName("HomeScreen"); - QCoreApplication::setApplicationVersion("0.3.4"); + QCoreApplication::setApplicationVersion("0.7.0"); qDebug("%s, v%s", QCoreApplication::applicationName().toStdString().c_str(), QCoreApplication::applicationVersion().toStdString().c_str()); - MainWindow w; - w.show(); -#ifdef __arm__ - // the WindowManager positions the surface correctly -#endif -#ifdef __i386__ - w.move(0, 0); -#endif - - -#ifdef __arm__ - qDebug("Running on ARM architecture"); -#endif -#ifdef __i386__ - qDebug("Running on x86 architecture"); -#endif + qDBusRegisterMetaType(); + qDBusRegisterMetaType >(); + + 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(); }