HomescreenHandler::HomescreenHandler(QObject *parent) :
QObject(parent),
- mp_hs(NULL), mp_wm(NULL), m_role()
+ mp_qhs(NULL), mp_wm(NULL), m_role()
{
}
HomescreenHandler::~HomescreenHandler()
{
- if (mp_hs != NULL) {
- delete mp_hs;
+ if (mp_qhs != NULL) {
+ delete mp_qhs;
}
if (mp_wm != NULL) {
delete mp_wm;
setenv("QT_IVI_SURFACE_ID", ivi_id.c_str(), true);
// LibHomeScreen initialize
- mp_hs = new LibHomeScreen();
- mp_hs->init(port, token);
+ mp_qhs = new QLibHomeScreen();
+ mp_qhs->init(port, token);
myThis = this;
- mp_hs->registerCallback(nullptr, HomescreenHandler::onRep_static);
+ mp_qhs->registerCallback(nullptr, HomescreenHandler::onRep_static);
- mp_hs->set_event_handler(LibHomeScreen::Event_OnScreenMessage, [this](json_object *object){
+ mp_qhs->set_event_handler(QLibHomeScreen::Event_ShowWindow,[this](json_object *object){
+ HMI_DEBUG("HomeScreen","Surface HomeScreen got Event_ShowWindow\n");
+ static bool first_start = true;
+ if (first_start) {
+ first_start = false;
+ this->mp_wm->activateWindow(this->m_role.c_str(), "fullscreen");
+ }
+ });
+
+ mp_qhs->set_event_handler(QLibHomeScreen::Event_OnScreenMessage, [this](json_object *object){
const char *display_message = json_object_get_string(
json_object_object_get(object, "display_message"));
HMI_DEBUG("HomeScreen","set_event_handler Event_OnScreenMessage display_message = %s", display_message);
void HomescreenHandler::attach(QQmlApplicationEngine* engine)
{
QQuickWindow *window = qobject_cast<QQuickWindow *>(engine->rootObjects().first());
- this->loading = QObject::connect(window, SIGNAL(frameSwapped()), this, SLOT(disconnect_frame_swapped()));
+// this->loading = QObject::connect(window, SIGNAL(frameSwapped()), this, SLOT(disconnect_frame_swapped()));
+ mp_qhs->setQuickWindow(window);
}
void HomescreenHandler::changeLayout(int pattern)
std::unordered_map<std::string, Rect> map_list;
switch(pattern) {
case P_LEFT_METER_RIGHT_MAP:
- map_list["split.main"] = Rect(0, 0, 1280, 720);
- map_list["split.sub"] = Rect(1280, 0, 640, 720);
+ map_list["split.main"] = Rect(0, 180, 1280, 720);
+ map_list["split.sub"] = Rect(1280, 180, 640, 720);
break;
case P_LEFT_MAP_RIGHT_METER:
- map_list["split.main"] = Rect(640, 0, 1280, 720);
- map_list["split.sub"] = Rect(0, 0, 640, 720);
+ map_list["split.main"] = Rect(640, 180, 1280, 720);
+ map_list["split.sub"] = Rect(0, 180, 640, 720);
break;
default:
break;
void HomescreenHandler::tapShortcut(QString application_name)
{
HMI_DEBUG("HomeScreen","tapShortcut %s", application_name.toStdString().c_str());
- mp_hs->tapShortcut(application_name.toStdString().c_str());
+ mp_qhs->tapShortcut(application_name.toStdString().c_str());
}
void HomescreenHandler::onRep_static(struct json_object* reply_contents)