summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2020-04-13 13:39:04 +0300
committerMarius Vlad <marius.vlad@collabora.com>2020-04-13 17:25:03 +0300
commit69ab2870ea1fbac6808dac791e141f3009e98724 (patch)
tree66977de488cdddaea73c0d39f127e142bafdc8be
parentbd47464dafd7110586163bbd6dc89a30fccd6a26 (diff)
onscreenapp: Initial clean-up in code
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--app/eventhandler.cpp27
-rw-r--r--app/eventhandler.h7
-rw-r--r--app/main.cpp9
3 files changed, 28 insertions, 15 deletions
diff --git a/app/eventhandler.cpp b/app/eventhandler.cpp
index ff8617d..9ffd6bb 100644
--- a/app/eventhandler.cpp
+++ b/app/eventhandler.cpp
@@ -39,24 +39,19 @@ void* EventHandler::myThis = 0;
EventHandler::EventHandler(QObject *parent) :
QObject(parent),
- mp_hs(nullptr),
- mp_wm(nullptr),
m_dsp_sts(false)
{
}
EventHandler::~EventHandler()
{
- if (mp_hs != nullptr) {
- delete mp_hs;
- }
- if (mp_wm != nullptr) {
- delete mp_wm;
- }
}
void EventHandler::init(int port, const char *token)
{
+ (void) port;
+ (void) token;
+#if 0
myThis = this;
mp_wm = new QLibWindowmanager();
mp_wm->init(port, token);
@@ -147,8 +142,10 @@ void EventHandler::init(int port, const char *token)
});
HMI_DEBUG(APP_ID, "LayoutHander::init() finished.");
+#endif
}
+#if 0
void EventHandler::onRep_static(struct json_object* reply_contents)
{
static_cast<EventHandler*>(EventHandler::myThis)->onRep(reply_contents);
@@ -159,15 +156,21 @@ void EventHandler::onRep(struct json_object* reply_contents)
const char* str = json_object_to_json_string(reply_contents);
HMI_DEBUG(APP_ID, "EventHandler::onReply %s", str);
}
+#endif
void EventHandler::activateWindow(const char *role, const char *area)
{
+#if 0
HMI_DEBUG(APP_ID, "EventHandler::activateWindow()");
mp_wm->activateWindow(role, area);
+#endif
+ fprintf(stdout, "EventHandler::activateWindow() role %s, area %s\n",
+ role, area);
}
void EventHandler::deactivateWindow()
{
+#if 0
HMI_DEBUG(APP_ID, "EventHandler::deactivateWindow()");
if(getDisplayStatus() == SWAPPING) {
setDisplayStatus(SHOWING);
@@ -179,10 +182,15 @@ void EventHandler::deactivateWindow()
this->setDisplayStatus(HIDING);
mp_wm->deactivateWindow(_myrole);
}
+#endif
+ int display_status = getDisplayStatus();
+ fprintf(stdout, "EventHandler::deactivateWindow(), "
+ "display_status %d\n", display_status);
}
void EventHandler::onScreenReply(const QString &ons_title, const QString &btn_name)
{
+#if 0
HMI_DEBUG(APP_ID, "ons_title=%s btn_name=%s", ons_title.toStdString().c_str(), btn_name.toStdString().c_str());
emit this->hideOnScreen();
@@ -190,4 +198,7 @@ void EventHandler::onScreenReply(const QString &ons_title, const QString &btn_na
json_object_object_add(j_param, _onscreen_title, json_object_new_string(ons_title.toStdString().c_str()));
json_object_object_add(j_param, _button_name, json_object_new_string(btn_name.toStdString().c_str()));
mp_hs->replyShowWindow(m_dsp.first.toStdString().c_str(), j_param);
+#endif
+ fprintf(stdout, "EventHandler::onScreenReply with ons_title %s, btn_name %s\n",
+ ons_title.toStdString().c_str(), btn_name.toStdString().c_str());
}
diff --git a/app/eventhandler.h b/app/eventhandler.h
index bb75d9b..1fe910b 100644
--- a/app/eventhandler.h
+++ b/app/eventhandler.h
@@ -21,8 +21,6 @@
#include <string>
#include <QVariant>
#include <QPair>
-#include <libhomescreen.hpp>
-#include <qlibwindowmanager.h>
#include "hmi-debug.h"
#define APP_ID "onscreenapp"
@@ -35,14 +33,13 @@ class EventHandler : public QObject
public:
explicit EventHandler(QObject *parent = 0);
~EventHandler();
+
EventHandler(const EventHandler&) = delete;
EventHandler& operator=(const EventHandler&) = delete;
void init(int port, const char* token);
- void onRep(struct json_object* reply_contents);
static void* myThis;
- static void onRep_static(struct json_object* reply_contents);
Q_INVOKABLE void deactivateWindow();
Q_INVOKABLE void onScreenReply(const QString &ons_title, const QString &btn_name);
@@ -63,8 +60,6 @@ private:
void setDisplayStatus(int sts) {m_dsp_sts = sts;}
void activateWindow(const char *role, const char *area = "normal.full");
- LibHomeScreen *mp_hs;
- QLibWindowmanager* mp_wm;
QPair<QString, QString> m_req, m_dsp;
int m_dsp_sts = HIDING;
};
diff --git a/app/main.cpp b/app/main.cpp
index 007711c..381b9a2 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -31,12 +31,18 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
+#if 0
QCoreApplication::setOrganizationDomain("LinuxFoundation");
QCoreApplication::setOrganizationName("AutomotiveGradeLinux");
QCoreApplication::setApplicationName("Onscreenapp");
QCoreApplication::setApplicationVersion("0.1.0");
+#endif
- QQuickStyle::setStyle("AGL");
+ // this is necessary to identify app, setApplicationName is only for the
+ // title
+ app.setDesktopFileName(APP_ID);
+
+ //QQuickStyle::setStyle("AGL");
QCommandLineParser parser;
parser.addPositionalArgument("port", app.translate("main", "port for binding"));
@@ -69,6 +75,7 @@ int main(int argc, char *argv[])
QObject *root = engine.rootObjects().first();
QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
+
QObject::connect(eventHandler, SIGNAL(updateModel(QVariant)), window, SLOT(setOnScreenModel(QVariant)));
QObject::connect(eventHandler, SIGNAL(showOnScreen()), window, SLOT(showOnScreen()));
QObject::connect(eventHandler, SIGNAL(hideOnScreen()), window, SLOT(hideOnScreen()));