summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-12-04 10:44:34 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-12-04 10:44:34 +0900
commit1d481d828e5c4df270f61554985c542b463294c6 (patch)
treef37ff0fade342b742dc982551eb7a2cb75b01aa2
parentae68306fd69e4360e2b96333d0ec34a08d50400d (diff)
change with wm event
-rw-r--r--app/main.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/app/main.cpp b/app/main.cpp
index aff9999..4faf42e 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -36,6 +36,8 @@ int main(int argc, char* argv[]) {
// return app.exec();
QString role = QString("Video");
+ bool isVisible = false;
+ bool isRestrict = false;
QGuiApplication app(argc, argv);
app.setApplicationName("VideoPlayer");
@@ -122,20 +124,40 @@ int main(int argc, char* argv[]) {
}
});
+ qwm->set_event_handler(
+ QLibWindowmanager::Event_Visible,
+ [&isVisible](json_object* object) {
+ qDebug() << "Surface Video got Event_Visible!";
+ isVisible = true;
+ });
+
+ qwm->set_event_handler(
+ QLibWindowmanager::Event_Invisible,
+ [&isVisible](json_object* object) {
+ qDebug() << "Surface Video got Event_Invisible!";
+ isVisible = true;
+ });
+
// Set the event handler for Event_Restriction which will allocate or
// release restriction area for homescreen
qwm->set_event_handler(
- QLibWindowmanager::Event_LightstatusBrakeOff,
- [hs, &area](json_object* object) {
- qDebug() << "Event_LightstatusBrakeOff!";
- hs->allocateRestriction(area.toStdString().c_str());
+ QLibWindowmanager::Event_CarRun,
+ [hs, &area, &isVisible, &isRestrict](json_object* object) {
+ qDebug() << "Surface Video got Event_CarRun!";
+ if(isVisible){
+ hs->allocateRestriction(area.toStdString().c_str());
+ isRestrict = true;
+ }
});
qwm->set_event_handler(
- QLibWindowmanager::Event_LightstatusBrakeOn,
- [hs, &area](json_object* object) {
- qDebug() << "Event_LightstatusBrakeOn!";
- hs->releaseRestriction(area.toStdString().c_str());
+ QLibWindowmanager::Event_CarStop,
+ [hs, &area, &isRestrict](json_object* object) {
+ qDebug() << "Surface Video got Event_CarStop!";
+ if(isRestrict){
+ hs->releaseRestriction(area.toStdString().c_str());
+ isRestrict = false;
+ }
});
QQuickWindow* window = qobject_cast<QQuickWindow*>(root);