2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "qlibwindowmanager.h"
20 int QLibWindowmanager::init(int port, const QString &token) {
21 std::string ctoken = token.toStdString();
22 return this->wm->init(port, ctoken.c_str());
25 int QLibWindowmanager::requestSurface(const char *label) {
27 json_object *obj = json_object_new_object();
28 json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(label));
29 return this->wm->requestSurface(obj);
32 int QLibWindowmanager::activateSurface(const char *label) {
33 json_object *obj = json_object_new_object();
34 json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(label));
35 json_object_object_add(obj, wm->kKeyDrawingArea, json_object_new_string("normal.full"));
36 return this->wm->activateSurface(obj);
39 int QLibWindowmanager::deactivateSurface(const char *label) {
40 json_object *obj = json_object_new_object();
41 json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(label));
42 return this->wm->deactivateSurface(obj);
45 int QLibWindowmanager::endDraw(const char *label) {
46 json_object *obj = json_object_new_object();
47 json_object_object_add(obj, wm->kKeyDrawingName, json_object_new_string(label));
48 return this->wm->endDraw(obj);
51 void QLibWindowmanager::set_event_handler(enum QEventType et,
53 LibWindowmanager::EventType wet = (LibWindowmanager::EventType)et;
54 return this->wm->set_event_handler(wet, std::move(f));
57 void QLibWindowmanager::slotActivateSurface(){
59 qDebug("Let's show %s", applabel.c_str());
61 this->activateSurface(applabel.c_str());
65 QLibWindowmanager::QLibWindowmanager(QObject *parent)
66 :QObject(parent), isActive(false)
68 wm = new LibWindowmanager();
71 QLibWindowmanager::~QLibWindowmanager() { }