X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=sample-qml%2Fmain.cpp;fp=sample-qml%2Fmain.cpp;h=9238a9bf09b584f2f0d4961cb8560401e0defd03;hb=f8ca548fa047968383e9275ead76eacce90fd0a8;hp=0000000000000000000000000000000000000000;hpb=75a4e94d7610db25c98f05cdda9491f4e7c0a4db;p=staging%2FHomeScreen.git diff --git a/sample-qml/main.cpp b/sample-qml/main.cpp new file mode 100644 index 0000000..9238a9b --- /dev/null +++ b/sample-qml/main.cpp @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include // use libhomescreen +#include "calledbyqml.h" + + +#define FULLSCREEN 1 // assume 1 is "fullscreen" + + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + /* use libhomescreen + To use libhomescreen, add library path in project file(.pro) + */ + LibHomeScreen *mp_libHomeScreen; + mp_libHomeScreen = new LibHomeScreen(); + + QQmlApplicationEngine engine; + CalledByQml call_hsa; + engine.rootContext()->setContextProperty("hsa",&call_hsa); + + int appcategory = 0 ; + + bool enabled = true; + enabled = mp_libHomeScreen->renderAppToAreaAllowed(appcategory, FULLSCREEN); + if(enabled) + { + QString target(getenv("AFM_APP_INSTALL_DIR")); + qDebug("AFM_APP_INSTALL_DIR is " + target.toLatin1()); + + if(NULL == target) + { + target = "."; + } + + QString load_path; + load_path = target + "/imports"; + engine.addImportPath(load_path); + load_path = target + "/dummyimports"; + engine.addImportPath(load_path); + load_path = target + "/main.qml"; + + engine.load(QUrl(load_path)); + + std::vector surfaceIdList; + int pid = getpid(); + //maybe we can't call this function... + //surfaceIdList = mp_libHomeScreen->getAllSurfacesOfProcess(pid); + if(surfaceIdList.empty()) + { + qDebug("surface list is empty"); + } + else + { + qDebug("surface list is contained"); + // it will be implemented as soon as possible + //mp_libHomeScreen->renderSurfaceToArea(surfaceIdList.at(0),FULLSCREEN); + } + } + else + { + qDebug("renderAppToAreaAllowed is denied"); + delete mp_libHomeScreen; + return 0; + } + + app.exec(); + delete mp_libHomeScreen; + return 0; +}