diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/images/blank.svg | 133 | ||||
-rw-r--r-- | app/images/images.qrc | 1 | ||||
-rw-r--r-- | app/main.qml | 2 | ||||
-rw-r--r-- | app/pages/DetailPage.qml | 17 | ||||
-rw-r--r-- | app/pages/ListPage.qml | 92 | ||||
-rw-r--r-- | app/pages/ManagementPage.qml | 23 | ||||
-rw-r--r-- | app/src/appinfo.cpp | 16 | ||||
-rw-r--r-- | app/src/config.h | 8 | ||||
-rw-r--r-- | app/src/nativeappmodel.cpp | 7 | ||||
-rw-r--r-- | app/src/serverappmodel.cpp | 13 | ||||
-rw-r--r-- | app/src/serverappmodel.h | 4 |
11 files changed, 283 insertions, 33 deletions
diff --git a/app/images/blank.svg b/app/images/blank.svg new file mode 100644 index 0000000..10c0a89 --- /dev/null +++ b/app/images/blank.svg @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> + +<svg + xmlns:i="&ns_ai;" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.1" + id="HVAC_Active" + x="0px" + y="0px" + viewBox="0 0 300 300" + style="enable-background:new 0 0 300 300;" + xml:space="preserve" + inkscape:version="0.91 r13725" + sodipodi:docname="blank_active.svg"><metadata + id="metadata3708"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs3706" /><sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1002" + inkscape:window-height="778" + id="namedview3704" + showgrid="false" + inkscape:zoom="0.78666667" + inkscape:cx="-90.254237" + inkscape:cy="150" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="0" + inkscape:current-layer="HVAC_Active" /><style + type="text/css" + id="style3659"> + .st0{fill:url(#SVGID_1_);} + .st1{opacity:0.4;fill:url(#SVGID_2_);} + .st2{fill:url(#SVGID_3_);} + </style><switch + id="switch3661" + transform="matrix(1.3314132,0,0,1.3314132,5.608242,5.2107165)"><g + i:extraneous="self" + id="g3663"><linearGradient + id="SVGID_1_" + gradientUnits="userSpaceOnUse" + x1="65.307999" + y1="229.46629" + x2="205.7616" + y2="-158.244"><stop + offset="0" + style="stop-color:#0DF9FF" + id="stop3666" /><stop + offset="9.208472e-02" + style="stop-color:#0DF9FF;stop-opacity:0.853" + id="stop3668" /><stop + offset="0.6264" + style="stop-color:#0DF9FF;stop-opacity:0" + id="stop3670" /></linearGradient><circle + class="st0" + cx="109.1" + cy="108.7" + r="101.9" + id="circle3672" + style="fill:url(#SVGID_1_)" /><linearGradient + id="SVGID_2_" + gradientUnits="userSpaceOnUse" + x1="-106.5709" + y1="410.58551" + x2="166.1564" + y2="28.7673"><stop + offset="0.2978" + style="stop-color:#FFFFFF;stop-opacity:0" + id="stop3675" /><stop + offset="0.3685" + style="stop-color:#FAFAFA;stop-opacity:0.1007" + id="stop3677" /><stop + offset="0.4554" + style="stop-color:#EBEBEB;stop-opacity:0.2245" + id="stop3679" /><stop + offset="0.5508" + style="stop-color:#D2D2D2;stop-opacity:0.3603" + id="stop3681" /><stop + offset="0.6523" + style="stop-color:#AFAFAF;stop-opacity:0.5048" + id="stop3683" /><stop + offset="0.7585" + style="stop-color:#828282;stop-opacity:0.6562" + id="stop3685" /><stop + offset="0.8689" + style="stop-color:#4B4B4B;stop-opacity:0.8133" + id="stop3687" /><stop + offset="0.9806" + style="stop-color:#0C0C0C;stop-opacity:0.9724" + id="stop3689" /><stop + offset="1" + style="stop-color:#000000" + id="stop3691" /></linearGradient><circle + class="st1" + cx="109.1" + cy="108.7" + r="101.9" + id="circle3693" + style="opacity:0.4;fill:url(#SVGID_2_)" /><g + id="g3695"><linearGradient + id="SVGID_3_" + gradientUnits="userSpaceOnUse" + x1="-47.346401" + y1="263.00369" + x2="269.0914" + y2="-40.3484" + gradientTransform="matrix(1,0.00546456,-0.00546456,1,-2.3177,-2.7461)"><stop + offset="0" + style="stop-color:#00ADDC" + id="stop3698" /><stop + offset="1" + style="stop-color:#6BFBFF" + id="stop3700" /></linearGradient><path + class="st2" + d="m 108.5,213.9 c -0.2,0 -0.4,0 -0.6,0 C 49.9,213.5 3,166.1 3.3,108.1 3.6,50.4 50.7,3.6 108.4,3.6 c 0.2,0 0.4,0 0.6,0 58,0.3 104.9,47.7 104.6,105.7 l 0,0 c -0.3,57.8 -47.4,104.6 -105.1,104.6 z M 108.4,7.2 C 52.7,7.2 7.3,52.4 7,108.2 c -0.3,55.9 45,101.7 100.9,102 0.2,0 0.4,0 0.6,0 C 164.2,210.2 209.7,165 210,109.3 210.3,53.4 165,7.6 109.1,7.3 108.8,7.2 108.6,7.2 108.4,7.2 Z" + id="path3702" + style="fill:url(#SVGID_3_)" + inkscape:connector-curvature="0" /></g></g></switch></svg>
\ No newline at end of file diff --git a/app/images/images.qrc b/app/images/images.qrc index 867a055..cc30231 100644 --- a/app/images/images.qrc +++ b/app/images/images.qrc @@ -3,5 +3,6 @@ <file>DividingLine.svg</file> <file>Back.svg</file> <file>Top.svg</file> + <file>blank.svg</file> </qresource> </RCC>
\ No newline at end of file diff --git a/app/main.qml b/app/main.qml index a481320..2ecc8ac 100644 --- a/app/main.qml +++ b/app/main.qml @@ -84,7 +84,7 @@ ApplicationWindow { height: parent.height } TabButton { - text: "Management" + text: "Installed Application" font.pixelSize: 20 height: parent.height } diff --git a/app/pages/DetailPage.qml b/app/pages/DetailPage.qml index 043714d..45e5202 100644 --- a/app/pages/DetailPage.qml +++ b/app/pages/DetailPage.qml @@ -56,9 +56,22 @@ import QtQuick.Controls 2.0 Item { Layout.preferredWidth: 200 Layout.preferredHeight: 200 - Image { + + Image { + id: imageicon anchors.fill: parent - source: model.icon + source: model.icon != ""?model.icon : 'qrc:/images/blank.svg' + property string initial: model.name.substring(0,1).toUpperCase() + + Label { + style: Text.Outline + styleColor: "#00ADDC" + color: 'transparent' + font.pixelSize: parent.height * 0.5 + anchors.centerIn: parent + text: parent.initial + visible: model.icon == "" + } } } diff --git a/app/pages/ListPage.qml b/app/pages/ListPage.qml index f4b78da..c9116d4 100644 --- a/app/pages/ListPage.qml +++ b/app/pages/ListPage.qml @@ -35,6 +35,14 @@ Page { implicitHeight: 60 running: false } + BusyIndicator { + id: nextBusyIndicator + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + implicitWidth: 60 + implicitHeight: 60 + running: false + } StackView { id: stack @@ -58,21 +66,35 @@ Page { anchors.fill: parent Item { - Layout.preferredWidth: 100 - Layout.preferredHeight: 100 + Layout.preferredWidth: 80 + Layout.preferredHeight: 80 MouseArea{ anchors.fill: parent z: 2 - onClicked: { - stack.push("qrc:/pages/DetailPage.qml", {stack: stack, model: model}, StackView.Immediate) + onClicked: { + stack.push("qrc:/pages/DetailPage.qml", {stack: stack, model: model}, StackView.Immediate) } } + Image { + id: imageicon anchors.fill: parent - source: model.icon + source: model.icon != ""?model.icon : 'qrc:/images/blank.svg' + property string initial: model.name.substring(0,1).toUpperCase() + + Label { + style: Text.Outline + styleColor: "#00ADDC" + color: 'transparent' + font.pixelSize: parent.height * 0.5 + anchors.centerIn: parent + text: parent.initial + visible: model.icon == "" + } } } + ColumnLayout { Label { Layout.fillWidth: true @@ -96,9 +118,10 @@ Page { ColumnLayout { spacing: 5 Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - + Button { - x: x - 6 + anchors.right: parent.right + anchors.rightMargin: 6 text: model.statetext onClicked: { if (model.statetext === 'Install' || model.statetext === 'Update') { @@ -113,11 +136,10 @@ Page { } implicitWidth: 140 implicitHeight: 40 - //Layout.rightMargin: 5 } } - } + DownloadBar { anchors.fill: parent progress: model.progress @@ -134,12 +156,19 @@ Page { states: [ State { - name: "prevPageState"; when: listView.contentY < -nPullHeight + name: "prevPageState"; when: (prevBusyIndicator.running == false) && listView.contentY < -nPullHeight StateChangeScript { name: "prevPageScript" script: getPrevPage() } - } + }, + State { + name: "nextPageState"; when: appSize > 8 && (nextBusyIndicator.running == false) && (listView.contentHeight > 0) && (listView.contentY > (listView.contentHeight - listView.height + nPullHeight)) + StateChangeScript { + name: "nextPageScript" + script: getNextPage() + } + } ] } @@ -147,10 +176,18 @@ Page { listView.y = nPullHeight; currentPageIndex = currentPageIndex > 0 ? currentPageIndex-1 : 0; - prevBusyIndicator.running = true + prevBusyIndicator.running = true; prevPageTimer.start(); } + function getNextPage() { + listView.y = nPullHeight; + + currentPageIndex++; + nextBusyIndicator.running = true; + nextPageTimer.start(); + } + Timer { id: prevPageTimer interval: 1000 @@ -162,6 +199,16 @@ Page { } } + Timer { + id: nextPageTimer + interval: 1000 + repeat: false + running: false + onTriggered: { + listView.model.getNextPage(currentPageIndex) + nextPageAnimation.start(); + } + } NumberAnimation { id: prevPageAnimation target: listView @@ -171,16 +218,33 @@ Page { to: 0 onStopped: { prevBusyIndicator.running = false - listView.y = 0; + //listView.y = 0; } } + NumberAnimation { + id: nextPageAnimation + target: listView + property: "y" + duration: 100 + from: nPullHeight + to: 0 + onStopped: { + nextBusyIndicator.running = false + //listView.y = 0; + } + } Connections { target: listView.model onRequestCompleted: { appSize = appsize pageSize = pagesize - console.log("request completed!", appSize, pageSize) + console.log("request completed!", appSize, pageSize, currentPageIndex) + if(appSize == 0 && currentPageIndex > 0) { + listView.model.getPrevPage(--currentPageIndex) + }else{ + listView.y = 0; + } } } } diff --git a/app/pages/ManagementPage.qml b/app/pages/ManagementPage.qml index 9a4cf31..e445c63 100644 --- a/app/pages/ManagementPage.qml +++ b/app/pages/ManagementPage.qml @@ -47,9 +47,22 @@ Page { Item { Layout.preferredWidth: 100 Layout.preferredHeight: 100 - Image { + + Image { + id: imageicon anchors.fill: parent - source: 'file://' + model.icon + source: model.icon != ""?'file://' + model.icon : 'qrc:/images/blank.svg' + property string initial: model.name.substring(0,1).toUpperCase() + + Label { + style: Text.Outline + styleColor: "#00ADDC" + color: 'transparent' + font.pixelSize: parent.height * 0.5 + anchors.centerIn: parent + text: parent.initial + visible: model.icon == "" + } } } ColumnLayout { @@ -77,7 +90,8 @@ Page { Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Button { - x: x - 6 + anchors.right: parent.right + anchors.rightMargin: 6 text: 'Launch' onClicked: { if (listView.model.launch(model.id) > 1) { @@ -90,7 +104,8 @@ Page { implicitHeight: 40 } Button { - x: x - 6 + anchors.right: parent.right + anchors.rightMargin: 6 visible: model.name.toUpperCase() != "HOMESCREEN" && model.name.toUpperCase() != "LAUNCHER" text: 'Uninstall' onClicked: { diff --git a/app/src/appinfo.cpp b/app/src/appinfo.cpp index b06dd2f..05daad4 100644 --- a/app/src/appinfo.cpp +++ b/app/src/appinfo.cpp @@ -16,7 +16,9 @@ * limitations under the License. */ +#include <QFileInfo> #include "appinfo.h" +#include "config.h" #include "hmi-debug.h" class AppInfo::Private : public QSharedData { @@ -176,6 +178,11 @@ void AppInfo::read(const QJsonObject& json) { d->shortname = json["shortname"].toString(); d->author = json["author"].toString(); d->iconPath = json["icon"].toString(); + QFileInfo fi(d->iconPath); + if(!fi.isFile()){ + d->iconPath = ""; + } + d->state = Launch; } @@ -193,8 +200,13 @@ void AppInfo::readFromServer(const QJsonObject& json) { d->deviceid = json["appDeviceTypeId"].toString(); d->devicename = json["appDeviceTypeName"].toString(); d->createdtime = json["updateDate"].toDouble(); - // d->iconPath = json["icon"].toString(); - d->iconPath = "file:///var/local/lib/afm/applications/launcher/0.1/icon.svg"; + d->iconPath = json["imagePath"].toString(); + + if(json["imagePath"].toString().isEmpty()){ + d->iconPath = ""; + } else { + d->iconPath = getIconUrl(json["imagePath"].toString()); + } d->state = Install; d->progress = 0.0; } diff --git a/app/src/config.h b/app/src/config.h index 0f2d5ed..e3aefc1 100644 --- a/app/src/config.h +++ b/app/src/config.h @@ -18,8 +18,12 @@ #define CONFIG_H // server url config +//#define SERVER_DOMAIN_IP "192.168.20.161" +#define SERVER_DOMAIN_IP "202.7.19.45" + //#define SERVER_DOMAIN "192.168.20.161/webservice" #define SERVER_DOMAIN "202.7.19.45/webservice" + //#define SERVER_DOMAIN "warehouse.tmc-tokai.jp/webservice" #define SERVER_BASE_URL "/api/v1/app" #define SERVER_API_LIST "/collection" @@ -38,6 +42,10 @@ QString("http://%1%2/file?filePath=%3") \ .arg(SERVER_DOMAIN, SERVER_BASE_URL, path) +#define getIconUrl(path) \ + QString("http://%1%2") \ + .arg(SERVER_DOMAIN_IP, path) + // server app page config #define PAGE_SIZE 20 diff --git a/app/src/nativeappmodel.cpp b/app/src/nativeappmodel.cpp index a5fa42d..fb48163 100644 --- a/app/src/nativeappmodel.cpp +++ b/app/src/nativeappmodel.cpp @@ -140,9 +140,12 @@ int NativeAppModel::launch(const QString& application) { void NativeAppModel::uninstall(int index) { const QString& id = this->d->data[index].id(); + + //afm_user_daemon_proxy->terminate(id); + QString result = afm_user_daemon_proxy->uninstall(id); - if (result == "null") { - beginRemoveRows(QModelIndex(), index, index); + if (result == "null") { + beginRemoveRows(QModelIndex(), index, index); this->d->data.removeAt(index); endRemoveRows(); } diff --git a/app/src/serverappmodel.cpp b/app/src/serverappmodel.cpp index ad79159..f1f1238 100644 --- a/app/src/serverappmodel.cpp +++ b/app/src/serverappmodel.cpp @@ -209,12 +209,12 @@ void ServerAppModel::install(int index) { }); } -void ServerAppModel::getPrevPage(int pageIndex) { - this->getAppPage(pageIndex, PAGE_SIZE, true); +void ServerAppModel::getPrevPage(int PageIndex) { + this->getAppPage(PageIndex, PAGE_SIZE, true); } -void ServerAppModel::getNextPage(int pageIndex) { - this->getAppPage(pageIndex, PAGE_SIZE); +void ServerAppModel::getNextPage(int PageIndex) { + this->getAppPage(PageIndex, PAGE_SIZE); } void ServerAppModel::setNativeApplist(const QList<AppInfo>& applist) { @@ -250,7 +250,7 @@ void ServerAppModel::getAppPage(int pageIndex, int pageSize, bool isPrev) { // .append(QString("&appDeviceTypeId=%1&appDeveloper=%2") // .arg(QString::number(0), "zhang_xu")); QString url = - getUrlWithPage(SERVER_API_LIST, pageIndex, pageSize) + getUrlWithPage(SERVER_API_LIST, pageIndex * pageSize, pageSize) .append(QString("&appDeviceTypeId=%1").arg(QString::number(0))); HttpClient client(url); @@ -273,7 +273,7 @@ void ServerAppModel::getAppPage(int pageIndex, int pageSize, bool isPrev) { if (isPrev || jappList.size() >= PAGE_SIZE) { applist.clear(); } - applist += newList; + applist += newList; endResetModel(); checkAppState(); @@ -283,4 +283,5 @@ void ServerAppModel::getAppPage(int pageIndex, int pageSize, bool isPrev) { [=](const QString& msg) { HMI_ERROR("response", "response error: %s", msg.toStdString().c_str()); }); + } diff --git a/app/src/serverappmodel.h b/app/src/serverappmodel.h index ea3608f..9d7f352 100644 --- a/app/src/serverappmodel.h +++ b/app/src/serverappmodel.h @@ -56,8 +56,8 @@ class ServerAppModel : public QAbstractListModel { Q_INVOKABLE void install(int index); Q_INVOKABLE int launch(const QString& application); - Q_INVOKABLE void getPrevPage(int pageIndex); - Q_INVOKABLE void getNextPage(int pageIndex); + Q_INVOKABLE void getPrevPage(int PageIndex); + Q_INVOKABLE void getNextPage(int PageIndex); Q_INVOKABLE void setNativeApplist(const QList<AppInfo>& applist); |