diff options
author | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2018-11-30 15:33:40 +0900 |
---|---|---|
committer | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2018-11-30 15:33:40 +0900 |
commit | 79e9e0509b2b78e7175eb03121221ccb37689305 (patch) | |
tree | b4e9bb0dfa3932b05b5a355046dae8712e456336 | |
parent | e221104d1e51d84212d3ec131473113c8762d3e7 (diff) |
disable fullscreen button if not navigation
-rw-r--r-- | homescreen/qml/main.qml | 12 | ||||
-rw-r--r-- | homescreen/src/homescreenhandler.cpp | 12 | ||||
-rw-r--r-- | homescreen/src/homescreenhandler.h | 3 | ||||
-rw-r--r-- | homescreen/src/main.cpp | 11 |
4 files changed, 17 insertions, 21 deletions
diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index f70325f..6dace77 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -141,24 +141,26 @@ Window { container.state = 'fullscreen' touchArea.switchArea(1) homescreenHandler.tapShortcut(appName, true) + container.opacity = 0.0 } else { image.source = './images/normal.png' container.state = 'normal' touchArea.switchArea(0) homescreenHandler.tapShortcut(appName, false) + container.opacity = 1.0 } } } } } - function changeSwitchState(is_split) { + function changeSwitchState(is_navigation) { if(container.state === 'normal') { - if(is_split) { - switchBtn.enableSwitchBtn = false - image.source = './images/normal_disable.png' - } else { + if(is_navigation) { switchBtn.enableSwitchBtn = true image.source = './images/normal.png' + } else { + switchBtn.enableSwitchBtn = false + image.source = './images/normal_disable.png' } } } diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp index d931ba8..c1cff26 100644 --- a/homescreen/src/homescreenhandler.cpp +++ b/homescreen/src/homescreenhandler.cpp @@ -23,7 +23,6 @@ void* HomescreenHandler::myThis = 0; HomescreenHandler::HomescreenHandler(QObject *parent) : QObject(parent), mp_hs(NULL), - previous_application("launcher"), current_applciation("launcher") { @@ -68,20 +67,9 @@ void HomescreenHandler::tapShortcut(QString application_name, bool is_full) mp_hs->showWindow(application_name.toStdString().c_str(), j_json); } -bool HomescreenHandler::isSplit() -{ - if(current_applciation == "video") { - if(previous_application == "navigation") { - return true; - } - } - return false; -} - void HomescreenHandler::setCurrentApplication(QString application_name) { HMI_DEBUG("HomeScreen","setCurrentApplication %s", application_name.toStdString().c_str()); - previous_application = current_applciation; current_applciation = application_name; } diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h index 9def3e8..539d380 100644 --- a/homescreen/src/homescreenhandler.h +++ b/homescreen/src/homescreenhandler.h @@ -35,7 +35,6 @@ public: Q_INVOKABLE void tapShortcut(QString application_name, bool is_full); Q_INVOKABLE QString getCurrentApplication(); void setCurrentApplication(QString application_name); - bool isSplit(); void onRep(struct json_object* reply_contents); void onEv(const string& event, struct json_object* event_contents); @@ -50,7 +49,7 @@ signals: private: LibHomeScreen *mp_hs; - QString previous_application, current_applciation; + QString current_applciation; }; #endif // HOMESCREENHANDLER_H diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 9b83edc..6e9dd1c 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -136,15 +136,22 @@ int main(int argc, char *argv[]) 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++) { - QString label = QString(json_object_get_string( json_object_array_get_idx(jarray, 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)); - QMetaObject::invokeMethod(root, "changeSwitchState", Q_ARG(QVariant, homescreenHandler->isSplit())); } + 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); |