aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen/src
diff options
context:
space:
mode:
Diffstat (limited to 'homescreen/src')
-rw-r--r--homescreen/src/applicationlauncher.cpp1
-rw-r--r--homescreen/src/homescreenhandler.cpp109
-rw-r--r--homescreen/src/homescreenhandler.h15
-rw-r--r--homescreen/src/main.cpp64
-rw-r--r--homescreen/src/shortcutappmodel.cpp268
-rw-r--r--homescreen/src/shortcutappmodel.h62
-rw-r--r--homescreen/src/toucharea.cpp36
-rw-r--r--homescreen/src/toucharea.h30
8 files changed, 562 insertions, 23 deletions
diff --git a/homescreen/src/applicationlauncher.cpp b/homescreen/src/applicationlauncher.cpp
index 5a1e2d6..a72ea9f 100644
--- a/homescreen/src/applicationlauncher.cpp
+++ b/homescreen/src/applicationlauncher.cpp
@@ -81,5 +81,6 @@ void ApplicationLauncher::setCurrent(const QString &current)
{
if (m_current == current) return;
m_current = current;
+ qDebug() << "setCurrent" << m_current;
emit currentChanged(current);
}
diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp
index 865f6a5..a06fa7e 100644
--- a/homescreen/src/homescreenhandler.cpp
+++ b/homescreen/src/homescreenhandler.cpp
@@ -17,13 +17,18 @@
#include <QFileInfo>
#include "homescreenhandler.h"
#include <functional>
+#include <QProcess>
+#include <dirent.h>
+#include <stdio.h>
#include "hmi-debug.h"
+#define BUF_SIZE 1024
void* HomescreenHandler::myThis = 0;
HomescreenHandler::HomescreenHandler(QObject *parent) :
QObject(parent),
- mp_qhs(NULL)
+ mp_qhs(NULL),
+ current_application("launcher")
{
}
@@ -48,6 +53,7 @@ void HomescreenHandler::init(int port, const char *token, QLibWindowmanager *qwm
mp_qhs->set_event_handler(QLibHomeScreen::Event_ShowWindow,[this](json_object *object){
HMI_DEBUG("Launcher","Surface launcher got Event_ShowWindow\n");
mp_qwm->activateWindow(m_myname);
+ emit showWindow();
});
mp_qhs->set_event_handler(QLibHomeScreen::Event_OnScreenMessage, [this](json_object *object){
@@ -83,17 +89,112 @@ void HomescreenHandler::init(int port, const char *token, QLibWindowmanager *qwm
emit showInformation(QString(QLatin1String(info)));
});
+
+ mp_qhs->set_event_handler(QLibHomeScreen::Event_HideWindow, [this](json_object *object) {
+ emit hideWindow();
+ HMI_DEBUG("HomeScreen","set_event_handler Event_HideWindow");
+ });
+
+ mp_qhs->set_event_handler(QLibHomeScreen::Event_RegisterShortcut,[this](json_object *object){
+ HMI_DEBUG("HomeScreen","set_event_handler Event_RegisterShortcut");
+ json_object *p_obj = json_object_object_get(object, "parameter");
+ const char *shortcut_id = json_object_get_string(
+ json_object_object_get(p_obj, "shortcut_id"));
+ const char *shortcut_name = json_object_get_string(
+ json_object_object_get(p_obj, "shortcut_name"));
+ const char *position = json_object_get_string(
+ json_object_object_get(p_obj, "position"));
+ HMI_DEBUG("HomeScreen", "Event_RegisterShortcut id==%s, name==%s, position ==%s", shortcut_id, shortcut_name, position);
+ emit shortcutChanged(QString(QLatin1String(shortcut_id)), QString(QLatin1String(shortcut_name)), QString(QLatin1String(position)));
+ });
}
-void HomescreenHandler::tapShortcut(QString application_id)
+void HomescreenHandler::tapShortcut(QString application_id, bool is_full)
{
HMI_DEBUG("HomeScreen","tapShortcut %s", application_id.toStdString().c_str());
struct json_object* j_json = json_object_new_object();
struct json_object* value;
- value = json_object_new_string("normal.full");
+ if(is_full) {
+ value = json_object_new_string("fullscreen");
+ HMI_DEBUG("HomeScreen","fullscreen");
+ } else {
+ value = json_object_new_string("normal.full");
+ HMI_DEBUG("HomeScreen","normal");
+ }
json_object_object_add(j_json, "area", value);
+ mp_qhs->showWindow(application_id.section('@', 0, 0).toStdString().c_str(), j_json);
+}
+
+void HomescreenHandler::updateShortcut(QString id, struct json_object* object)
+{
+ mp_qhs->updateShortcut(id.toStdString().c_str(), object);
+}
+
+
+void HomescreenHandler::setCurrentApplication(QString application_name)
+{
+ HMI_DEBUG("HomeScreen","setCurrentApplication %s", application_name.toStdString().c_str());
+ current_application = application_name;
+}
+
+QString HomescreenHandler::getCurrentApplication()
+{
+ HMI_DEBUG("HomeScreen","getCurrentApplication %s", current_application.toStdString().c_str());
+ return current_application;
+}
+
+int HomescreenHandler::getPidOfApplication(QString application_name) {
+ DIR *dir = NULL;
+ struct dirent *dir_ent_ptr = NULL;
+ FILE *fp = NULL;
+ char file_path[50] = {0};
+ char cur_task_ame[50] = {0};
+ char buf[BUF_SIZE] = {0};
+ int pid = -1;
+
+ dir = opendir("/proc");
+ if (dir) {
+ while((dir_ent_ptr = readdir(dir)) != NULL) {
+ if ((strcmp(dir_ent_ptr->d_name, ".") == 0) || (strcmp(dir_ent_ptr->d_name, "..") == 0)
+ || (DT_DIR != dir_ent_ptr->d_type))
+ continue;
+ sprintf(file_path, "/proc/%s/status", dir_ent_ptr->d_name);
+ fp = fopen(file_path, "r");
+ if (fp) {
+ if (fgets(buf, BUF_SIZE - 1, fp) == NULL) {
+ fclose(fp);
+ continue;
+ }
+ sscanf(buf, "%*s %s", cur_task_ame);
+ if (0 == strcmp(application_name.toStdString().c_str(), cur_task_ame)) {
+ pid = atoi(dir_ent_ptr->d_name);
+ break;
+ }
+ }
+ }
+ }
- mp_qhs->showWindow(application_id.toStdString().c_str(), j_json);
+ return pid;
+}
+
+void HomescreenHandler::killRunningApplications()
+{
+ QProcess *proc = new QProcess;
+ QProcess *proc2 = new QProcess;
+// int num = getPidOfApplication("afbd-video@0.1");
+// QString procNum = QString::number(num);
+ QString command = "/usr/bin/pkill videoplayer";
+ QString command2 = "/usr/bin/pkill navigation";
+ proc->start(command);
+ proc2->start(command2);
+ HMI_DEBUG("homescreen", command.toStdString().c_str());
+ HMI_DEBUG("homescreen", command2.toStdString().c_str());
+}
+
+void HomescreenHandler::reboot()
+{
+ QProcess::execute("sync");
+ QProcess::execute("reboot -f");
}
void HomescreenHandler::onRep_static(struct json_object* reply_contents)
diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h
index d617737..4afbac4 100644
--- a/homescreen/src/homescreenhandler.h
+++ b/homescreen/src/homescreenhandler.h
@@ -34,7 +34,12 @@ public:
void init(int port, const char* token, QLibWindowmanager *qwm, QString myname);
- Q_INVOKABLE void tapShortcut(QString application_id);
+ Q_INVOKABLE void tapShortcut(QString application_name, bool is_full);
+ Q_INVOKABLE QString getCurrentApplication();
+ Q_INVOKABLE void killRunningApplications();
+ Q_INVOKABLE void reboot();
+ void setCurrentApplication(QString application_name);
+ int getPidOfApplication(QString application_name);
void onRep(struct json_object* reply_contents);
void onEv(const string& event, struct json_object* event_contents);
@@ -47,10 +52,18 @@ public:
signals:
void showNotification(QString application_id, QString icon_path, QString text);
void showInformation(QString info);
+ void shortcutChanged(QString shortcut_id, QString shortcut_name, QString position);
+ void showWindow();
+ void hideWindow();
+
+public slots:
+ void updateShortcut(QString id, struct json_object* object);
+
private:
QLibHomeScreen *mp_qhs;
QLibWindowmanager *mp_qwm;
QString m_myname;
+ QString current_application;
};
#endif // HOMESCREENHANDLER_H
diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp
index ec0a76b..0c477fd 100644
--- a/homescreen/src/main.cpp
+++ b/homescreen/src/main.cpp
@@ -22,6 +22,7 @@
#include <QtQml/QQmlContext>
#include <QtQml/qqml.h>
#include <QQuickWindow>
+#include <QThread>
#include <qlibwindowmanager.h>
#include <weather.h>
@@ -31,6 +32,8 @@
#include "afm_user_daemon_proxy.h"
#include "mastervolume.h"
#include "homescreenhandler.h"
+#include "toucharea.h"
+#include "shortcutappmodel.h"
#include "hmi-debug.h"
// XXX: We want this DBus connection to be shared across the different
@@ -91,9 +94,12 @@ int main(int argc, char *argv[])
// qmlRegisterType<ApplicationLauncher>("HomeScreen", 1, 0, "ApplicationLauncher");
qmlRegisterType<StatusBarModel>("HomeScreen", 1, 0, "StatusBarModel");
qmlRegisterType<MasterVolume>("MasterVolume", 1, 0, "MasterVolume");
+ qmlRegisterType<ShortcutAppModel>("ShortcutAppModel", 1, 0, "ShortcutAppModel");
ApplicationLauncher *launcher = new ApplicationLauncher();
QLibWindowmanager* layoutHandler = new QLibWindowmanager();
+ HomescreenHandler* homescreenHandler = new HomescreenHandler();
+ ShortcutAppModel* shortcutAppModel = new ShortcutAppModel();
if(layoutHandler->init(port,token) != 0){
exit(EXIT_FAILURE);
}
@@ -104,24 +110,6 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler, &graphic_role](json_object *object) {
- layoutHandler->endDraw(graphic_role);
- });
-
- layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) {
- json_object *jarray = json_object_object_get(object, "ids");
- int arrLen = json_object_array_length(jarray);
- for( int idx = 0; idx < arrLen; idx++)
- {
- QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) ));
- HMI_DEBUG("HomeScreen","Event_ScreenUpdated application: %s.", label.toStdString().c_str());
- QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label));
- }
- });
-
- HomescreenHandler* homescreenHandler = new HomescreenHandler();
- homescreenHandler->init(port, token.toStdString().c_str(), layoutHandler, graphic_role);
-
QUrl bindingAddress;
bindingAddress.setScheme(QStringLiteral("ws"));
bindingAddress.setHost(QStringLiteral("localhost"));
@@ -132,11 +120,16 @@ int main(int argc, char *argv[])
query.addQueryItem(QStringLiteral("token"), token);
bindingAddress.setQuery(query);
+ TouchArea* touchArea = new TouchArea();
+ homescreenHandler->init(port, token.toStdString().c_str(), layoutHandler, graphic_role);
+
// mail.qml loading
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("bindingAddress", bindingAddress);
engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler);
+ engine.rootContext()->setContextProperty("touchArea", touchArea);
+ engine.rootContext()->setContextProperty("shortcutAppModel", shortcutAppModel);
engine.rootContext()->setContextProperty("launcher", launcher);
engine.rootContext()->setContextProperty("weather", new Weather(bindingAddress));
engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddress, engine.rootContext()));
@@ -147,9 +140,44 @@ int main(int argc, char *argv[])
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
homescreenHandler->setQuickWindow(window);
+ layoutHandler->set_event_handler(QLibWindowmanager::Event_SyncDraw, [layoutHandler, &graphic_role](json_object *object) {
+ layoutHandler->endDraw(graphic_role);
+ });
+
+ layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher, homescreenHandler, root](json_object *object) {
+ json_object *jarray = json_object_object_get(object, "ids");
+ HMI_DEBUG("HomeScreen","ids=%s", json_object_to_json_string(object));
+ int arrLen = json_object_array_length(jarray);
+ QString label = QString("");
+ for( int idx = 0; idx < arrLen; idx++)
+ {
+ label = QString(json_object_get_string( json_object_array_get_idx(jarray, idx) ));
+ HMI_DEBUG("HomeScreen","Event_ScreenUpdated application11: %s.", label.toStdString().c_str());
+ homescreenHandler->setCurrentApplication(label);
+ QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label));
+ }
+ if((arrLen == 1) && (QString("navigation") == label)){
+ QMetaObject::invokeMethod(root, "changeSwitchState", Q_ARG(QVariant, true));
+ }else{
+ QMetaObject::invokeMethod(root, "changeSwitchState", Q_ARG(QVariant, false));
+ }
+ });
+
+ touchArea->setWindow(window);
+ QThread* thread = new QThread;
+ touchArea->moveToThread(thread);
+ QObject::connect(thread, &QThread::started, touchArea, &TouchArea::init);
+
+ thread->start();
+
QList<QObject *> sobjs = engine.rootObjects();
StatusBarModel *statusBar = sobjs.first()->findChild<StatusBarModel *>("statusBar");
statusBar->init(bindingAddress, engine.rootContext());
+ QObject::connect(homescreenHandler, SIGNAL(shortcutChanged(QString, QString, QString)), shortcutAppModel, SLOT(changeShortcut(QString, QString, QString)));
+ QObject::connect(shortcutAppModel, SIGNAL(shortcutUpdated(QString, struct json_object*)), homescreenHandler, SLOT(updateShortcut(QString, struct json_object*)));
+
+ shortcutAppModel->screenUpdated();
+
return a.exec();
}
diff --git a/homescreen/src/shortcutappmodel.cpp b/homescreen/src/shortcutappmodel.cpp
new file mode 100644
index 0000000..76078da
--- /dev/null
+++ b/homescreen/src/shortcutappmodel.cpp
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "shortcutappmodel.h"
+#include "hmi-debug.h"
+#include <unistd.h>
+#define SHORTCUTKEY_PATH "/var/local/lib/afm/applications/homescreen/0.1/etc/registeredApp.json"
+
+class ShortcutAppModel::Private
+{
+public:
+ Private();
+
+ QList<RegisterApp> data;
+};
+
+ShortcutAppModel::Private::Private()
+{
+}
+
+
+ShortcutAppModel::ShortcutAppModel(QObject *parent)
+ : QAbstractListModel(parent)
+ , d(new Private())
+{
+ getAppQueue();
+}
+
+ShortcutAppModel::~ShortcutAppModel()
+{
+ delete this->d;
+}
+
+int ShortcutAppModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+
+ return this->d->data.count();
+}
+
+QVariant ShortcutAppModel::data(const QModelIndex &index, int role) const
+{
+ QVariant ret;
+ if (!index.isValid())
+ return ret;
+
+ switch (role) {
+ case Qt::DecorationRole:
+ ret = this->d->data[index.row()].icon;
+ break;
+ case Qt::DisplayRole:
+ ret = this->d->data[index.row()].name;
+ break;
+ case Qt::UserRole:
+ ret = this->d->data[index.row()].id;
+ break;
+ default:
+ break;
+ }
+
+ return ret;
+}
+
+QHash<int, QByteArray> ShortcutAppModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[Qt::DecorationRole] = "icon";
+ roles[Qt::DisplayRole] = "name";
+ roles[Qt::UserRole] = "id";
+ return roles;
+}
+
+void ShortcutAppModel::changeShortcut(QString id, QString name, QString position)
+{
+ for(int i = 1; i < d->data.size(); i++) {
+ if(id == d->data.at(i).id) {
+ return;
+ }
+ }
+ d->data.removeAt(position.toInt() + 1);
+
+ RegisterApp temp;
+ temp.id = id;
+ temp.name = name;
+ temp.icon = temp.icon = getIconPath(temp.id);
+ if (temp.icon == "") {
+ temp.isBlank = true;
+ } else {
+ temp.isBlank = false;
+ }
+
+ d->data.insert(position.toInt() + 1, temp);
+ setAppQueue();
+ emit updateShortcut();
+ struct json_object* obj = makeAppListJson();
+ emit shortcutUpdated(QString("launcher"), obj);
+}
+
+struct json_object* ShortcutAppModel::makeAppListJson()
+{
+ struct json_object* obj = json_object_new_object();
+ struct json_object* obj_array = json_object_new_array();
+ for(int i = 1; i < d->data.size(); i++)
+ {
+ struct json_object* obj_shortcut = json_object_new_object();
+ json_object_object_add(obj_shortcut, "shortcut_id", json_object_new_string(d->data.at(i).id.toStdString().c_str()));
+ json_object_object_add(obj_shortcut, "shortcut_name", json_object_new_string(d->data.at(i).name.toStdString().c_str()));
+ json_object_array_add(obj_array, obj_shortcut);
+ }
+ json_object_object_add(obj, "shortcut", obj_array);
+ HMI_DEBUG("Homescreen", "makeAppListJson id1=%s",json_object_new_string(d->data.at(1).name.toStdString().c_str()));
+ return obj;
+}
+
+QString ShortcutAppModel::getId(int index) const
+{
+ return d->data.at(index).id;
+}
+
+QString ShortcutAppModel::getName(int index) const
+{
+ return d->data.at(index).name;
+}
+
+QString ShortcutAppModel::getIcon(int index) const
+{
+ return d->data.at(index).icon;
+}
+
+bool ShortcutAppModel::isBlank(int index) const
+{
+ return d->data.at(index).isBlank;
+}
+
+QString ShortcutAppModel::getIconPath(QString id)
+{
+ QString name = id.section('@', 0, 0);
+ QString version = id.section('@', 1, 1);
+ QString boardIconPath = "/var/local/lib/afm/applications/" + name + "/" + version + "/icon.svg";
+ QString appIconPath = ":/images/Shortcut/" + name + ".svg";
+ if (QFile::exists(boardIconPath)) {
+ return "file://" + boardIconPath;
+ } else if (QFile::exists(appIconPath)) {
+ return appIconPath.section('/', 1, -1);
+ }
+ return "";
+}
+
+void ShortcutAppModel::getAppQueue()
+{
+ QProcess *process = new QProcess(this);
+ if(checkAppFile()) {
+ process->start("cp /var/local/lib/afm/applications/homescreen/0.1/etc/registeredApp.aaa.json /var/local/lib/afm/applications/homescreen/0.1/etc/registeredApp.json");
+ } else {
+ process->start("cp /var/local/lib/afm/applications/homescreen/0.1/etc/registeredApp.json /var/local/lib/afm/applications/homescreen/0.1/etc/registeredApp.aaa.json");
+ }
+ QThread::msleep(300);
+
+ QFile file(SHORTCUTKEY_PATH);
+ if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QByteArray allData = file.readAll();
+ QString str(allData);
+ if(str == "") {
+ file.close();
+
+ }
+ QJsonParseError json_error;
+ QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &json_error));
+
+ if(json_error.error != QJsonParseError::NoError)
+ {
+ HMI_ERROR("HomeScreen", "registeredApp.json error");
+ return;
+ }
+
+ QJsonObject rootObj = jsonDoc.object();
+
+ QJsonObject subObj = rootObj.value("1st shortcut key").toObject();
+ setAppQueuePoint(subObj["id"].toString(), subObj["name"].toString());
+ subObj = rootObj.value("2nd shortcut key").toObject();
+ setAppQueuePoint(subObj["id"].toString(), subObj["name"].toString());
+ subObj = rootObj.value("3rd shortcut key").toObject();
+ setAppQueuePoint(subObj["id"].toString(), subObj["name"].toString());
+ subObj = rootObj.value("4th shortcut key").toObject();
+ setAppQueuePoint(subObj["id"].toString(), subObj["name"].toString());
+ }
+ file.close();
+}
+
+void ShortcutAppModel::setAppQueuePoint(QString id, QString name)
+{
+ app.id = id;
+ app.icon = getIconPath(app.id);
+ if (app.icon == "") {
+ app.isBlank = true;
+ } else {
+ app.isBlank = false;
+ }
+ app.name = name;
+ d->data.append(app);
+}
+
+void ShortcutAppModel::screenUpdated()
+{
+ struct json_object* obj = makeAppListJson();
+ emit shortcutUpdated(QString("launcher"), obj);
+}
+
+void ShortcutAppModel::setAppQueue()
+{
+ QFile file(SHORTCUTKEY_PATH);
+ if(file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ QJsonObject rootObj, subObj1, subObj2, subObj3, subObj4;
+ subObj1.insert("id", d->data.at(0).id);
+ subObj1.insert("name", d->data.at(0).name);
+ subObj2.insert("id", d->data.at(1).id);
+ subObj2.insert("name", d->data.at(1).name);
+ subObj3.insert("id", d->data.at(2).id);
+ subObj3.insert("name", d->data.at(2).name);
+ subObj4.insert("id", d->data.at(3).id);
+ subObj4.insert("name", d->data.at(3).name);
+ rootObj.insert("1st shortcut key", subObj1);
+ rootObj.insert("2nd shortcut key", subObj2);
+ rootObj.insert("3rd shortcut key", subObj3);
+ rootObj.insert("4th shortcut key", subObj4);
+
+ QJsonDocument jsonDoc;
+ jsonDoc.setObject(rootObj);
+
+ file.write(jsonDoc.toJson());
+ } else {
+ HMI_ERROR("HomeScreen", "write to registeredApp.json file failed");
+ }
+ file.flush();
+ fsync(file.handle());
+ file.close();
+}
+
+bool ShortcutAppModel::checkAppFile()
+{
+ bool fileError = false;
+ QFile file(SHORTCUTKEY_PATH);
+ if(file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QByteArray line = file.readLine();
+ if(line == "\n" || line.isEmpty()) {
+ fileError = true;
+ }
+ } else {
+ fileError = true;
+ HMI_ERROR("HomeScreen", "registeredApp.json file open failed");
+ }
+ file.close();
+ return fileError;
+}
diff --git a/homescreen/src/shortcutappmodel.h b/homescreen/src/shortcutappmodel.h
new file mode 100644
index 0000000..f177a95
--- /dev/null
+++ b/homescreen/src/shortcutappmodel.h
@@ -0,0 +1,62 @@
+#ifndef SHORTCUTAPPMODEL_H
+#define SHORTCUTAPPMODEL_H
+
+#include <QtCore/QAbstractListModel>
+#include <QXmlStreamReader>
+#include <QXmlStreamWriter>
+#include <QFile>
+#include <QProcess>
+#include <QThread>
+#include <QJsonDocument>
+#include <QJsonParseError>
+#include <QJsonObject>
+#include <json_object.h>
+
+struct RegisterApp {
+ QString id;
+ QString name;
+ QString icon;
+ bool isBlank;
+};
+
+class ShortcutAppModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit ShortcutAppModel(QObject *parent = nullptr);
+ ~ShortcutAppModel();
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QHash<int, QByteArray> roleNames() const override;
+
+ Q_INVOKABLE QString getId(int index) const;
+ Q_INVOKABLE QString getName(int index) const;
+ Q_INVOKABLE QString getIcon(int index) const;
+ Q_INVOKABLE bool isBlank(int index) const;
+
+ void screenUpdated();
+
+public slots:
+ void changeShortcut(QString id, QString name, QString position);
+
+signals:
+ void updateShortcut();
+ void shortcutUpdated(QString id, struct json_object* object);
+
+private:
+ void getAppQueue();
+ void setAppQueue();
+ bool checkAppFile();
+ void setAppQueuePoint(QString id, QString name);
+ QString getIconPath(QString id);
+ struct json_object* makeAppListJson();
+
+ class Private;
+ Private *d;
+ RegisterApp app;
+
+};
+
+#endif // SHORTCUTAPPMODEL_H
diff --git a/homescreen/src/toucharea.cpp b/homescreen/src/toucharea.cpp
new file mode 100644
index 0000000..1cf4384
--- /dev/null
+++ b/homescreen/src/toucharea.cpp
@@ -0,0 +1,36 @@
+#include "toucharea.h"
+#include "hmi-debug.h"
+
+TouchArea::TouchArea()
+{
+}
+
+TouchArea::~TouchArea()
+{
+
+}
+
+void TouchArea::setWindow(QQuickWindow *window)
+{
+ myWindow = window;
+}
+
+void TouchArea::init()
+{
+ bitmapNormal = QPixmap(":/images/AGL_HMI_Normal_Background.png").createHeuristicMask();
+ bitmapFullscreen = QPixmap(":/images/AGL_HMI_Full_Background.png").createHeuristicMask();
+ myWindow->setMask(QRegion(bitmapNormal));
+}
+
+void TouchArea::switchArea(int areaType)
+{
+ if(areaType == NORMAL) {
+ myWindow->setMask(QRegion(bitmapNormal));
+ HMI_DEBUG("HomeScreen","TouchArea switchArea: %d.", areaType);
+ } else if (areaType == FULLSCREEN) {
+ HMI_DEBUG("HomeScreen","TouchArea switchArea: %d.", areaType);
+ myWindow->setMask(QRegion(bitmapFullscreen));
+ }
+}
+
+
diff --git a/homescreen/src/toucharea.h b/homescreen/src/toucharea.h
new file mode 100644
index 0000000..69c6872
--- /dev/null
+++ b/homescreen/src/toucharea.h
@@ -0,0 +1,30 @@
+#ifndef TOUCHAREA_H
+#define TOUCHAREA_H
+
+#include <QBitmap>
+#include <QQuickWindow>
+
+enum {
+ NORMAL=0,
+ FULLSCREEN
+};
+
+class TouchArea : public QObject
+{
+ Q_OBJECT
+public:
+ explicit TouchArea();
+ ~TouchArea();
+
+ Q_INVOKABLE void switchArea(int areaType);
+ void setWindow(QQuickWindow* window);
+
+public slots:
+ void init();
+
+private:
+ QBitmap bitmapNormal, bitmapFullscreen;
+ QQuickWindow* myWindow;
+};
+
+#endif // TOUCHAREA_H