From 87094d6f30dbba6152ec45a1a3c0c82d89a6ffde Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Tue, 9 Jul 2019 10:41:34 +0900 Subject: change new design --- homescreen/qml/ShortcutIcon.qml | 28 ++-- homescreen/qml/TopArea.qml | 2 +- .../images/AGL_HMI_Blue_Background_NoCar-01.png | Bin 951359 -> 27317 bytes homescreen/qml/images/Shortcut/blank_active.svg | 153 ++++++++++----------- .../qml/images/TopSection_NoText_NoIcons-01.png | Bin 0 -> 16553 bytes .../qml/images/TopSection_NoText_NoIcons-01.svg | 55 -------- homescreen/qml/images/fullscreen.png | Bin 1633 -> 1098 bytes homescreen/qml/images/images.qrc | 2 +- homescreen/qml/images/normal.png | Bin 1626 -> 937 bytes homescreen/qml/images/normal_disable.png | Bin 1721 -> 911 bytes homescreen/src/homescreenconnect.cpp | 34 ++++- homescreen/src/homescreenconnect.h | 6 + 12 files changed, 126 insertions(+), 154 deletions(-) create mode 100644 homescreen/qml/images/TopSection_NoText_NoIcons-01.png delete mode 100644 homescreen/qml/images/TopSection_NoText_NoIcons-01.svg diff --git a/homescreen/qml/ShortcutIcon.qml b/homescreen/qml/ShortcutIcon.qml index e891c99..d5abb1e 100644 --- a/homescreen/qml/ShortcutIcon.qml +++ b/homescreen/qml/ShortcutIcon.qml @@ -67,6 +67,10 @@ MouseArea { } Image { id: sourceIcon + anchors.topMargin: 21 + anchors.bottomMargin: 41 + anchors.leftMargin: 30 + anchors.rightMargin: 30 anchors.fill: parent source: isBlank ? null : root.icon } @@ -79,18 +83,18 @@ MouseArea { } } - Label { - id: name - y: 160 - width: root.width - 10 - font.pixelSize: 15 - font.letterSpacing: 5 - // wrapMode: Text.WordWrap - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - color: "white" - text: qsTr((root.name === "launcher" ? "home" : root.name).toUpperCase()) - } +// Label { +// id: name +// y: 160 +// width: root.width - 10 +// font.pixelSize: 15 +// font.letterSpacing: 5 +// // wrapMode: Text.WordWrap +// anchors.horizontalCenter: parent.horizontalCenter +// horizontalAlignment: Text.AlignHCenter +// color: "white" +// text: qsTr((root.name === "launcher" ? "home" : root.name).toUpperCase()) +// } states: [ State { diff --git a/homescreen/qml/TopArea.qml b/homescreen/qml/TopArea.qml index 2a75cf8..9cff3ed 100644 --- a/homescreen/qml/TopArea.qml +++ b/homescreen/qml/TopArea.qml @@ -22,7 +22,7 @@ import QtQuick.Controls 2.0 Image { width: 1920 height: 218 - source: './images/TopSection_NoText_NoIcons-01.svg' + source: './images/TopSection_NoText_NoIcons-01.png' fillMode: Image.PreserveAspectCrop RowLayout { diff --git a/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png index a4e026c..e6cd3f2 100644 Binary files a/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png and b/homescreen/qml/images/AGL_HMI_Blue_Background_NoCar-01.png differ diff --git a/homescreen/qml/images/Shortcut/blank_active.svg b/homescreen/qml/images/Shortcut/blank_active.svg index 0b63bc9..9eb8a30 100644 --- a/homescreen/qml/images/Shortcut/blank_active.svg +++ b/homescreen/qml/images/Shortcut/blank_active.svg @@ -2,12 +2,12 @@ image/svg+xml - - - - - - - - - - - - - - \ No newline at end of file + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + sodipodi:docname="blank_active.svg">image/svg+xml \ No newline at end of file diff --git a/homescreen/qml/images/TopSection_NoText_NoIcons-01.png b/homescreen/qml/images/TopSection_NoText_NoIcons-01.png new file mode 100644 index 0000000..9b405fe Binary files /dev/null and b/homescreen/qml/images/TopSection_NoText_NoIcons-01.png differ diff --git a/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg b/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg deleted file mode 100644 index 6841001..0000000 --- a/homescreen/qml/images/TopSection_NoText_NoIcons-01.svg +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/homescreen/qml/images/fullscreen.png b/homescreen/qml/images/fullscreen.png index f56a13c..4c96652 100644 Binary files a/homescreen/qml/images/fullscreen.png and b/homescreen/qml/images/fullscreen.png differ diff --git a/homescreen/qml/images/images.qrc b/homescreen/qml/images/images.qrc index 2e09cc9..ccd87eb 100644 --- a/homescreen/qml/images/images.qrc +++ b/homescreen/qml/images/images.qrc @@ -1,6 +1,6 @@ - TopSection_NoText_NoIcons-01.svg + TopSection_NoText_NoIcons-01.png Utility_Logo_Background-01.svg Utility_Logo_Grey-01.svg Utility_Music_Background-01.png diff --git a/homescreen/qml/images/normal.png b/homescreen/qml/images/normal.png index 92dee7a..53295fc 100644 Binary files a/homescreen/qml/images/normal.png and b/homescreen/qml/images/normal.png differ diff --git a/homescreen/qml/images/normal_disable.png b/homescreen/qml/images/normal_disable.png index f191241..f1609e2 100644 Binary files a/homescreen/qml/images/normal_disable.png and b/homescreen/qml/images/normal_disable.png differ diff --git a/homescreen/src/homescreenconnect.cpp b/homescreen/src/homescreenconnect.cpp index 19ccc08..7279994 100644 --- a/homescreen/src/homescreenconnect.cpp +++ b/homescreen/src/homescreenconnect.cpp @@ -30,6 +30,7 @@ static const char API[] = "alexa-voiceagent"; static const char CARLACLIENTAPI[] = "carlaclient"; const string vshl_core_event = "{\"events\": []}"; const string vshl_core_refreshevent = "{\"refresh_token\": \"ws\"}"; +static const int RETRYCOUNT = 60; const std::vector HomescreenConnect::event_lists { std::string("alexa-voiceagent/voice_cbl_codepair_received_event"), @@ -64,6 +65,7 @@ HomescreenConnect::HomescreenConnect(QObject *parent) : QObject(parent) { timer = new QTimer(this); + retrytimer = new QTimer(this); } HomescreenConnect::~HomescreenConnect() @@ -84,6 +86,8 @@ int HomescreenConnect::init(int port, const string& token) connect(timer,SIGNAL(timeout()),this,SLOT(subscribe())); connect(this,SIGNAL(stopTimer()),this,SLOT(stopGetCode())); + connect(this,SIGNAL(retryStart()),this,SLOT(startTimer())); + connect(retrytimer,SIGNAL(timeout()),this,SLOT(resendCode())); if(port > 0 && token.size() > 0) { mport = port; @@ -229,8 +233,10 @@ void HomescreenConnect::on_event(void *closure, const char *event, struct afb_ws QString codestr = codestr2.left(6); emit showInformation(QString(QLatin1String(warnginfo))); std::string str = codestr.toStdString(); - if(send_code(str.c_str())){ - HMI_ERROR("HomescreenConnect", "send_code error."); + amazonCode = str.c_str(); + if(send_code(amazonCode)){ + emit retryStart(); + HMI_ERROR("HomescreenConnect", "send_code error."); } emit stopTimer(); } @@ -246,12 +252,34 @@ int HomescreenConnect::send_code(const char *str) int ret = afb_wsj1_call_j(sp_websock, CARLACLIENTAPI, "set_amazon_code", obj, _on_reply_static, this); if (ret < 0) { - HMI_ERROR("HomescreenConnect","Failed to call set_amazon_code verb"); + retrycount++; + HMI_ERROR("HomescreenConnect","Failed to call set_amazon_code verb"); + }else{ + retrycount = 0; } return ret; } +void HomescreenConnect::resendCode(void) +{ + HMI_DEBUG("HomescreenConnect"," resendCode,%s",amazonCode); + if(send_code(amazonCode)){ + if(retrycount >= RETRYCOUNT){ + retrycount = 0; + retrytimer->stop(); + HMI_ERROR("HomescreenConnect", "resend_code 60s timeout."); + } + }else{ + retrytimer->stop(); + } +} + +void HomescreenConnect::startTimer(void) +{ + retrytimer->start(1000); +} + void HomescreenConnect::stopGetCode(void) { timer->stop(); diff --git a/homescreen/src/homescreenconnect.h b/homescreen/src/homescreenconnect.h index badc86a..8504992 100644 --- a/homescreen/src/homescreenconnect.h +++ b/homescreen/src/homescreenconnect.h @@ -51,9 +51,12 @@ signals: void statusChanged(bool status); void showInformation(QString info); void stopTimer(void); + void retryStart(void); private slots: void subscribe(void); void stopGetCode(void); + void resendCode(void); + void startTimer(void); private: int initialize_websocket(void); @@ -65,7 +68,10 @@ private: std::string muri; int mport = 2000; std::string mtoken = "hs"; + const char *amazonCode; QTimer *timer; + QTimer *retrytimer; + int retrycount; }; #endif // HOMESCREENCONNECT_H -- cgit 1.2.3-korg