diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2015-01-03 19:30:15 +0100 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2015-01-03 19:30:15 +0100 |
| commit | eac37967cc535a3ac43a712b52b4bf73b96ec19c (patch) | |
| tree | 8088389694620e8d8eba8e15bd9bfdd7de46e462 /daemon | |
| parent | 516dc948a8f180520352175e79f0139dde9b8d1f (diff) | |
Support for watch apps, not installed on phoneRELEASE_0.13.js1
Needed to show app name instead of "unknown app" on the
app management screen.
Diffstat (limited to 'daemon')
| -rw-r--r-- | daemon/appinfo.cpp | 12 | ||||
| -rw-r--r-- | daemon/appinfo.h | 4 | ||||
| -rw-r--r-- | daemon/appmanager.cpp | 17 | ||||
| -rw-r--r-- | daemon/appmanager.h | 2 | ||||
| -rw-r--r-- | daemon/bankmanager.cpp | 9 | ||||
| -rw-r--r-- | daemon/manager.cpp | 3 |
6 files changed, 41 insertions, 6 deletions
diff --git a/daemon/appinfo.cpp b/daemon/appinfo.cpp index 4397abc..587ed8b 100644 --- a/daemon/appinfo.cpp +++ b/daemon/appinfo.cpp @@ -3,6 +3,7 @@ #include "appinfo.h" struct AppInfoData : public QSharedData { + bool local; QUuid uuid; QString shortName; QString longName; @@ -20,6 +21,7 @@ struct AppInfoData : public QSharedData { AppInfo::AppInfo() : d(new AppInfoData) { + d->local = false; d->versionCode = 0; d->watchface = false; d->jskit = false; @@ -41,6 +43,16 @@ AppInfo::~AppInfo() { } +bool AppInfo::isLocal() const +{ + return d->local; +} + +void AppInfo::setLocal(const bool local) +{ + d->local = local; +} + QUuid AppInfo::uuid() const { return d->uuid; diff --git a/daemon/appinfo.h b/daemon/appinfo.h index 3d5c4b4..c0b5e72 100644 --- a/daemon/appinfo.h +++ b/daemon/appinfo.h @@ -19,6 +19,7 @@ public: }; Q_DECLARE_FLAGS(Capabilities, Capability) + Q_PROPERTY(bool local READ isLocal WRITE setLocal) Q_PROPERTY(QUuid uuid READ uuid WRITE setUuid) Q_PROPERTY(QString shortName READ shortName WRITE setShortName) Q_PROPERTY(QString longName READ longName WRITE setLongName) @@ -37,6 +38,9 @@ public: AppInfo &operator=(const AppInfo &); ~AppInfo(); + bool isLocal() const; + void setLocal(const bool local); + QUuid uuid() const; void setUuid(const QUuid &uuid); diff --git a/daemon/appmanager.cpp b/daemon/appmanager.cpp index 9896a70..24335bc 100644 --- a/daemon/appmanager.cpp +++ b/daemon/appmanager.cpp @@ -88,6 +88,16 @@ void AppManager::rescan() emit appsChanged(); } +void AppManager::insertAppInfo(const AppInfo &info) +{ + _apps.insert(info.uuid(), info); + _names.insert(info.shortName(), info.uuid()); + + const char *type = info.isWatchface() ? "watchface" : "app"; + const char *local = info.isLocal() ? "local" : "watch"; + qCDebug(l) << "found" << local << type << info.shortName() << info.versionCode() << "/" << info.versionLabel() << "with uuid" << info.uuid().toString(); +} + void AppManager::scanApp(const QString &path) { qCDebug(l) << "scanning app" << path; @@ -114,6 +124,7 @@ void AppManager::scanApp(const QString &path) const QJsonObject root = doc.object(); AppInfo info; + info.setLocal(true); info.setUuid(QUuid(root["uuid"].toString())); info.setShortName(root["shortName"].toString()); info.setLongName(root["longName"].toString()); @@ -183,11 +194,7 @@ void AppManager::scanApp(const QString &path) return; } - _apps.insert(info.uuid(), info); - _names.insert(info.shortName(), info.uuid()); - - const char *type = info.isWatchface() ? "watchface" : "app"; - qCDebug(l) << "found installed" << type << info.shortName() << info.versionLabel() << "with uuid" << info.uuid().toString(); + insertAppInfo(info); } QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_id) const diff --git a/daemon/appmanager.h b/daemon/appmanager.h index e96ffe5..cc98ef1 100644 --- a/daemon/appmanager.h +++ b/daemon/appmanager.h @@ -22,6 +22,8 @@ public: AppInfo info(const QUuid &uuid) const; AppInfo info(const QString &shortName) const; + void insertAppInfo(const AppInfo &info); + public slots: void rescan(); diff --git a/daemon/bankmanager.cpp b/daemon/bankmanager.cpp index f0aa68b..041f4c6 100644 --- a/daemon/bankmanager.cpp +++ b/daemon/bankmanager.cpp @@ -262,6 +262,15 @@ void BankManager::refresh() _slots[index].version = version; AppInfo info = apps->info(name); + if (info.shortName() != name) { + info.setLocal(false); + info.setUuid(QUuid::createUuid()); + info.setShortName(name); + info.setCompanyName(company); + info.setVersionCode(version); + info.setCapabilities(AppInfo::Capabilities(flags)); + apps->insertAppInfo(info); + } QUuid uuid = info.uuid(); _slots[index].uuid = uuid; diff --git a/daemon/manager.cpp b/daemon/manager.cpp index 6498c68..557fa07 100644 --- a/daemon/manager.cpp +++ b/daemon/manager.cpp @@ -374,7 +374,8 @@ QVariantList PebbledProxy::AllApps() const foreach (const QUuid &uuid, uuids) { const AppInfo &info = manager()->apps->info(uuid); QVariantMap m; - m.insert("uuid", QVariant::fromValue(uuid.toString())); + m.insert("local", QVariant::fromValue(info.isLocal())); + m.insert("uuid", QVariant::fromValue(info.uuid().toString())); m.insert("short-name", QVariant::fromValue(info.shortName())); m.insert("long-name", QVariant::fromValue(info.longName())); m.insert("company-name", QVariant::fromValue(info.companyName())); |
