From b3476f1c2debc23411a66b1498065ab575879e22 Mon Sep 17 00:00:00 2001 From: wang_zhiqiang Date: Tue, 13 Nov 2018 15:54:13 +0800 Subject: [PATCH] add fullscreen¬ification&information function Change-Id: I33b355c78d5abe6bf4a8a60350cf6e7f4f78e0f7 --- homescreen/homescreen.pro | 6 +- homescreen/qml/ShortcutArea.qml | 3 +- homescreen/qml/StatusArea.qml | 17 +- homescreen/qml/images/AGL_HMI_Full_Background.png | Bin 0 -> 8306 bytes .../qml/images/AGL_HMI_Normal_Background.png | Bin 0 -> 10012 bytes homescreen/qml/images/fullscreen.png | Bin 0 -> 1633 bytes homescreen/qml/images/images.qrc | 4 + homescreen/qml/images/normal.png | Bin 0 -> 1626 bytes homescreen/qml/main.qml | 183 +++++++++++++++++++++ homescreen/src/homescreenhandler.cpp | 53 +++++- homescreen/src/homescreenhandler.h | 10 +- homescreen/src/main.cpp | 20 ++- homescreen/src/toucharea.cpp | 36 ++++ homescreen/src/toucharea.h | 30 ++++ 14 files changed, 345 insertions(+), 17 deletions(-) create mode 100644 homescreen/qml/images/AGL_HMI_Full_Background.png create mode 100644 homescreen/qml/images/AGL_HMI_Normal_Background.png create mode 100644 homescreen/qml/images/fullscreen.png create mode 100644 homescreen/qml/images/normal.png create mode 100644 homescreen/src/toucharea.cpp create mode 100644 homescreen/src/toucharea.h diff --git a/homescreen/homescreen.pro b/homescreen/homescreen.pro index 0e5bb58..9c36660 100644 --- a/homescreen/homescreen.pro +++ b/homescreen/homescreen.pro @@ -30,14 +30,16 @@ SOURCES += \ src/statusbarserver.cpp \ src/applicationlauncher.cpp \ src/mastervolume.cpp \ - src/homescreenhandler.cpp + src/homescreenhandler.cpp \ + src/toucharea.cpp HEADERS += \ src/statusbarmodel.h \ src/statusbarserver.h \ src/applicationlauncher.h \ src/mastervolume.h \ - src/homescreenhandler.h + src/homescreenhandler.h \ + src/toucharea.h OTHER_FILES += \ README.md diff --git a/homescreen/qml/ShortcutArea.qml b/homescreen/qml/ShortcutArea.qml index d7e97f0..1790e89 100644 --- a/homescreen/qml/ShortcutArea.qml +++ b/homescreen/qml/ShortcutArea.qml @@ -24,7 +24,6 @@ Item { width: 785 height: 218 - ListModel { id: applicationModel ListElement { @@ -70,7 +69,7 @@ Item { console.warn(model.application) console.warn("app cannot be launched!") } - homescreenHandler.tapShortcut(model.appid) + homescreenHandler.tapShortcut(model.appid, false) } } } diff --git a/homescreen/qml/StatusArea.qml b/homescreen/qml/StatusArea.qml index 3f2b280..1fb4601 100644 --- a/homescreen/qml/StatusArea.qml +++ b/homescreen/qml/StatusArea.qml @@ -117,11 +117,16 @@ Item { Layout.fillHeight: true Layout.preferredWidth: 76 spacing: -10 + Rectangle { + Layout.preferredWidth: 77 + Layout.preferredHeight: 55 + opacity: 0 + } Image { id: bt_icon Layout.preferredWidth: 77 - Layout.preferredHeight: 73 + Layout.preferredHeight: 55 source: connStatus ? './images/Status/HMI_Status_Bluetooth_On-01.png' : './images/Status/HMI_Status_Bluetooth_Inactive-01.png' fillMode: Image.PreserveAspectFit property string deviceName: "none" @@ -134,9 +139,9 @@ Item { onConnectionEvent: { // console.log("bluetooth connection is:", data.Status) // console.log("onConnectionEvent bt_icon.deviceName:",bt_icon.deviceName, "bt_icon.connStatus:", bt_icon.connStatus) - if (data.Status == "connected"){ + if (data.Status === "connected"){ bt_icon.connStatus = true - } else if (data.Status == "disconnected"){ + } else if (data.Status === "disconnected"){ bt_icon.connStatus = false } } @@ -144,11 +149,11 @@ Item { onDeviceUpdatedEvent: { // console.log("bluetooth onDeviceUpdatedEvent date is:", data.Name, "Paired: ", data.Paired, "Connected: ", data.Connected) // console.log("onDeviceUpdatedEvent bt_icon.deviceName:",bt_icon.deviceName, "bt_icon.connStatus:", bt_icon.connStatus) - if ( data.Paired == "True" && data.Connected == "True" ){ + if ( data.Paired === "True" && data.Connected === "True" ){ bt_icon.deviceName = data.Name bt_icon.connStatus = true } else { - if(bt_icon.deviceName == data.Name) + if(bt_icon.deviceName === data.Name) { bt_icon.connStatus = false } @@ -160,7 +165,7 @@ Item { model: StatusBarModel { objectName: "statusBar" } delegate: Image { Layout.preferredWidth: 77 - Layout.preferredHeight: 73 + Layout.preferredHeight: 55 source: model.modelData fillMode: Image.PreserveAspectFit } diff --git a/homescreen/qml/images/AGL_HMI_Full_Background.png b/homescreen/qml/images/AGL_HMI_Full_Background.png new file mode 100644 index 0000000000000000000000000000000000000000..8b11e20e44d9420add280d0410561cf4522d6683 GIT binary patch literal 8306 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 literal 0 HcmV?d00001 diff --git a/homescreen/qml/images/images.qrc b/homescreen/qml/images/images.qrc index 37ad676..87b4f1e 100644 --- a/homescreen/qml/images/images.qrc +++ b/homescreen/qml/images/images.qrc @@ -6,5 +6,9 @@ Utility_Music_Background-01.png Utility_Radio_Background-01.png AGL_HMI_Blue_Background_NoCar-01.png + AGL_HMI_Full_Background.png + AGL_HMI_Normal_Background.png + fullscreen.png + normal.png diff --git a/homescreen/qml/images/normal.png b/homescreen/qml/images/normal.png new file mode 100644 index 0000000000000000000000000000000000000000..92dee7a2a69a8d64550f2fea6b99bd7f8f36ef1f GIT binary patch literal 1626 zcmV-g2BrClP)R32;bRa{vGr5&!@f5&>tQ(oz5b02y>eSaefwW^{L9a%BKbX=8G4b8lvJAWvpy zX=7!7?KN=#00r7fL_t(|+U?yfbmBk|2XG`3c@l|4Rw9v=Cy~fXBq(HLB@&55B9TZW z5?P7lGQFg4n28s~Y-v(EFL=cGZ)v8XF# z>TT5#cv{TBHP2HMEVp8Tn)QxdARo2pBy!0!N5{^mKY4aqV3L9E{sjdaUMSC9i%L3= zJPR-Ed|DPSqy^=XtP?goQH#eiuuV0z#x9m)Md{ zeEvM0PUwNxl?1-q?Vi{ZfIH5|$;7_7He#_@P-sMw;2r7&yV4_oo^)vdHnvpgHt@^k zV%_82?|0u?EdYDvi+#J@tk*Ynjg}7G1P<7v(a8C^9qY9R>~~*m_~h9voz%0wYW-wK73}`q< z@OV6)$K&y{o}{qN29`6JA~+^=IYB-5`#lY8Xk4{{DT4O_jeH)#AG>Kv2|N@uDeNj% z3gCS}!_V*-@`)onY?ujv1>jV``-HCB?IM9~&Oj>QA)v|aXV<;CbnuYSRq$xoZEq|U zJO;E09tGRxO{Iaygf0VDtp>%my_`l8I0b0Wbi;NHcW?pF;jlS_3xN)c%@JG>ba-q| z;KHEeU~>Q$2ptcbIyiiJt_tO{%R>-4E;a@@0GQWdV-~dv2Jd47P82#mwhwrp&|Sd^ zL({h6#nvdcMzJ-Dtx;@^VrvvzlQwp0_a;vkyS$eO{7Y%R$}3A18yUKs zsDPK3G&8y+i8glAcv!K)V_v&168pD-&tidBq4nxgWN7%FG<-F;`hDrp;B`whvn8As zcH6jDbzhJV1>V$kGwagnVA~9E76be@P)6W1uw6#73khxu$pkz;c9$UwLx8&iG60W@ z?K2o@pWt2Lh=a$&_JMA~#u(poGMW6?y?T9pm9QTk2b(H11miAFM8U&jQ-&4}9u}Je zv|#XX*qoq+f``H82rUrY9oq$oJG3xxcWk(?r|tf%1ZYa&a6%|Jw#@+yNzfF);cwu* zqF}dyON5RIUf!&y>+sbm*mdBNp<{rXx8aJ8ZGxu&9TL2HzcmurFja5zE*Uxmc-@^8 z$zZ1j-8XpMEi5d$0f>=@QOzi5@qaHvNZzo@o(ztfT9?ZYONx2%8>sp}TvvwQ{ui zBV#?j9yp#f(e#>kb3YmlyRt4{7wZQtc$^KetZm(lhFyUl=XuL>Dxw(pxfHbp;Hi(- YKM{(kyd_0J-v9sr07*qoM6N<$f_xhMdjJ3c literal 0 HcmV?d00001 diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 96a1950..164cbf7 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -26,6 +26,7 @@ Window { width: container.width * container.scale height: container.height * container.scale title: 'HomeScreen' + color: "#00000000" Image { id: container @@ -60,5 +61,187 @@ Window { Layout.preferredHeight: 215 } } + + states: [ + State { + name: "normal" + PropertyChanges { + target: topArea + y: 0 + } + PropertyChanges { + target: applicationArea + y: 218 + } + PropertyChanges { + target: mediaArea + y: 1705 + } + }, + State { + name: "fullscreen" + PropertyChanges { + target: topArea + y: -220 + } + PropertyChanges { + target: applicationArea + y: -1490 + } + PropertyChanges { + target: mediaArea + y: 2135 + } + } + ] + transitions: Transition { + NumberAnimation { + target: topArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + NumberAnimation { + target: mediaArea + property: "y" + easing.type: "OutQuad" + duration: 250 + } + } + } + + Item { + id: switchBtn + anchors.right: parent.right + anchors.rightMargin: 20 + anchors.top: parent.top + anchors.topMargin: 25 + width: 35 + height: 35 + z: 1 + + MouseArea { + anchors.fill: parent + property string btnState: 'normal' + Image { + id: image + anchors.fill: parent + source: './images/normal.png' + } + onClicked: { + var appName = homescreenHandler.getCurrentApplication() + if (btnState === 'normal') { + image.source = './images/fullscreen.png' + btnState = 'fullscreen' + container.state = 'fullscreen' + touchArea.switchArea(1) + homescreenHandler.tapShortcut(appName, true) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 0.0 + } + } else { + image.source = './images/normal.png' + btnState = 'normal' + container.state = 'normal' + touchArea.switchArea(0) + homescreenHandler.tapShortcut(appName, false) + if (appName === 'navigation' || appName === 'browser') { + container.opacity = 1.0 + } + } + } + } + } + + Timer { + id:informationTimer + interval: 3000 + running: false + repeat: true + onTriggered: { + bottomInformation.visible = false + } + } + + Item { + id: bottomInformation + width: parent.width + height: 215 + anchors.bottom: parent.bottom + visible: false + Text { + id: bottomText + anchors.centerIn: parent + font.pixelSize: 25 + font.letterSpacing: 5 + horizontalAlignment: Text.AlignHCenter + color: "white" + text: "" + z:1 + } + } + + Connections { + target: homescreenHandler + onShowInformation: { + bottomText.text = info + bottomInformation.visible = true + informationTimer.restart() + } + } + + Timer { + id:notificationTimer + interval: 3000 + running: false + repeat: true + onTriggered: notificationItem.visible = false + } + + Item { + id: notificationItem + x: 0 + y: 0 + z: 1 + width: 1280 + height: 100 + opacity: 0.8 + visible: false + + Rectangle { + width: parent.width + height: parent.height + anchors.fill: parent + color: "gray" + Image { + id: notificationIcon + width: 70 + height: 70 + anchors.left: parent.left + anchors.leftMargin: 20 + anchors.verticalCenter: parent.verticalCenter + source: "" + } + + Text { + id: notificationtext + font.pixelSize: 25 + anchors.left: notificationIcon.right + anchors.leftMargin: 5 + anchors.verticalCenter: parent.verticalCenter + color: "white" + text: qsTr("") + } + } + } + + Connections { + target: homescreenHandler + onShowNotification: { + notificationIcon.source = icon_path + notificationtext.text = text + notificationItem.visible = true + notificationTimer.restart() + } } } diff --git a/homescreen/src/homescreenhandler.cpp b/homescreen/src/homescreenhandler.cpp index daf1b90..2d51099 100644 --- a/homescreen/src/homescreenhandler.cpp +++ b/homescreen/src/homescreenhandler.cpp @@ -49,12 +49,61 @@ void HomescreenHandler::init(int port, const char *token) HMI_DEBUG("HomeScreen","set_event_handler Event_OnScreenMessage display_message = %s", display_message); }); + mp_hs->set_event_handler(LibHomeScreen::Event_ShowNotification,[this](json_object *object){ + const char *application_id = json_object_get_string( + json_object_object_get(object, "application_id")); + + json_object *p_obj = json_object_object_get(object, "parameter"); + const char *icon = json_object_get_string( + json_object_object_get(p_obj, "icon")); + const char *text = json_object_get_string( + json_object_object_get(p_obj, "text")); + QFileInfo icon_file(icon); + QString icon_path; + if (icon_file.exists()) { + icon_path = QString(QLatin1String(icon)); + } else { + icon_path = "./images/Utility_Logo_Grey-01.svg"; + } + + emit showNotification(QString(QLatin1String(application_id)), icon_path, QString(QLatin1String(text))); + }); + + mp_hs->set_event_handler(LibHomeScreen::Event_ShowInformation,[this](json_object *object){ + json_object *p_obj = json_object_object_get(object, "parameter"); + const char *info = json_object_get_string( + json_object_object_get(p_obj, "info")); + + emit showInformation(QString(QLatin1String(info))); + }); } -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()); - mp_hs->tapShortcut(application_id.toStdString().c_str()); + struct json_object* j_json = json_object_new_object(); + struct json_object* value; + if(is_full) { + value = json_object_new_string("fullscreen"); + HMI_DEBUG("HomeScreen","tapShortcut fullscreen"); + } else { + value = json_object_new_string("normal"); + HMI_DEBUG("HomeScreen","tapShortcut normal"); + } + json_object_object_add(j_json, "area", value); + mp_hs->showWindow(application_id.toStdString().c_str(), j_json); +} + +void HomescreenHandler::setCurrentApplication(QString application_id) +{ + HMI_DEBUG("HomeScreen","setCurrentApplication %s", application_id.toStdString().c_str()); + current_applciation = application_id; +} + +QString HomescreenHandler::getCurrentApplication() +{ + HMI_DEBUG("HomeScreen","getCurrentApplication %s", current_applciation.toStdString().c_str()); + return current_applciation; } void HomescreenHandler::onRep_static(struct json_object* reply_contents) diff --git a/homescreen/src/homescreenhandler.h b/homescreen/src/homescreenhandler.h index 1a9a2b5..d31d6af 100644 --- a/homescreen/src/homescreenhandler.h +++ b/homescreen/src/homescreenhandler.h @@ -20,6 +20,7 @@ #include #include #include +#include using namespace std; @@ -32,7 +33,9 @@ public: void init(int port, const char* token); - Q_INVOKABLE void tapShortcut(QString application_id); + Q_INVOKABLE void tapShortcut(QString application_id, bool is_full); + Q_INVOKABLE QString getCurrentApplication(); + void setCurrentApplication(QString application_id); void onRep(struct json_object* reply_contents); void onEv(const string& event, struct json_object* event_contents); @@ -40,8 +43,13 @@ public: static void* myThis; static void onRep_static(struct json_object* reply_contents); static void onEv_static(const string& event, struct json_object* event_contents); + +signals: + void showNotification(QString application_id, QString icon_path, QString text); + void showInformation(QString info); private: LibHomeScreen *mp_hs; + QString current_applciation; }; #endif // HOMESCREENHANDLER_H diff --git a/homescreen/src/main.cpp b/homescreen/src/main.cpp index 620c869..7a7aa71 100644 --- a/homescreen/src/main.cpp +++ b/homescreen/src/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,7 @@ #include "mastervolume.h" #include "homescreenhandler.h" #include "hmi-debug.h" +#include "toucharea.h" // XXX: We want this DBus connection to be shared across the different // QML objects, is there another way to do this, a nice way, perhaps? @@ -93,6 +95,9 @@ int main(int argc, char *argv[]) ApplicationLauncher *launcher = new ApplicationLauncher(); QLibWindowmanager* layoutHandler = new QLibWindowmanager(); + TouchArea* touchArea = new TouchArea(); + HomescreenHandler* homescreenHandler = new HomescreenHandler(); + homescreenHandler->init(port, token.toStdString().c_str()); if(layoutHandler->init(port,token) != 0){ exit(EXIT_FAILURE); } @@ -107,20 +112,18 @@ int main(int argc, char *argv[]) layoutHandler->endDraw(QString("HomeScreen")); }); - layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher](json_object *object) { + layoutHandler->set_event_handler(QLibWindowmanager::Event_ScreenUpdated, [layoutHandler, launcher, homescreenHandler](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()); + homescreenHandler->setCurrentApplication(label); QMetaObject::invokeMethod(launcher, "setCurrent", Qt::QueuedConnection, Q_ARG(QString, label)); } }); - HomescreenHandler* homescreenHandler = new HomescreenHandler(); - homescreenHandler->init(port, token.toStdString().c_str()); - QUrl bindingAddress; bindingAddress.setScheme(QStringLiteral("ws")); bindingAddress.setHost(QStringLiteral("localhost")); @@ -139,10 +142,19 @@ int main(int argc, char *argv[]) engine.rootContext()->setContextProperty("weather", new Weather(bindingAddress)); engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddress)); engine.rootContext()->setContextProperty("screenInfo", &screenInfo); + engine.rootContext()->setContextProperty("touchArea", touchArea); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast(root); + + touchArea->setWindow(window); + QThread* thread = new QThread; + touchArea->moveToThread(thread); + QObject::connect(thread, &QThread::started, touchArea, &TouchArea::init); + + thread->start(); + QObject::connect(window, SIGNAL(frameSwapped()), layoutHandler, SLOT(slotActivateSurface())); QList sobjs = engine.rootObjects(); 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 +#include + +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 -- 2.16.6