diff options
author | 2018-11-22 14:48:25 +0900 | |
---|---|---|
committer | 2018-11-22 14:48:25 +0900 | |
commit | 94db06ff082d2b5e1ad99ed52c844dcec0d070ca (patch) | |
tree | aafd38d58cde9f24055df218b970e2bf493a042c /app/src | |
parent | 31e4ddecb2e704ab81303568102f786ea727d0cf (diff) |
change blank icons
Diffstat (limited to 'app/src')
-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 |
5 files changed, 36 insertions, 12 deletions
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); |