summaryrefslogtreecommitdiff
path: root/app/pebbledinterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/pebbledinterface.cpp')
-rw-r--r--app/pebbledinterface.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/app/pebbledinterface.cpp b/app/pebbledinterface.cpp
index 588e24a..c978dd0 100644
--- a/app/pebbledinterface.cpp
+++ b/app/pebbledinterface.cpp
@@ -183,7 +183,7 @@ QUrl PebbledInterface::configureApp(const QString &uuid)
}
}
-bool PebbledInterface::isAppInstalled(const QString &uuid)
+bool PebbledInterface::isAppInstalled(const QString &uuid) const
{
QUuid u(uuid);
@@ -196,6 +196,11 @@ bool PebbledInterface::isAppInstalled(const QString &uuid)
return false;
}
+QImage PebbledInterface::menuIconForApp(const QUuid &uuid) const
+{
+ return _appMenuIcons.value(uuid);
+}
+
void PebbledInterface::setAppConfiguration(const QString &uuid, const QString &data)
{
qDebug() << Q_FUNC_INFO << uuid << data;
@@ -210,8 +215,11 @@ void PebbledInterface::launchApp(const QString &uuid)
// TODO Terrible hack; need to give time for the watch to open the app
// A better solution would be to wait until AppUuidChanged is generated.
+ QUuid u(uuid);
+ if (u.isNull()) return;
int sleep_count = 0;
- while (watch->appUuid() != uuid && sleep_count < 5) {
+ while (QUuid(watch->appUuid()) != u && sleep_count < 5) {
+ qDebug() << "Waiting for" << u.toString() << "to launch";
QThread::sleep(1);
sleep_count++;
}
@@ -271,6 +279,7 @@ void PebbledInterface::refreshAllApps()
{
_apps.clear();
_appsByUuid.clear();
+ _appMenuIcons.clear();
qDebug() << "refreshing all apps list";
@@ -288,6 +297,11 @@ void PebbledInterface::refreshAllApps()
m.insert("shortName", orig.value("short-name"));
m.insert("longName", orig.value("long-name"));
+ QByteArray pngIcon = orig.value("menu-icon").toByteArray();
+ if (!pngIcon.isEmpty()) {
+ _appMenuIcons.insert(uuid, QImage::fromData(pngIcon, "PNG"));
+ }
+
_apps.append(QVariant::fromValue(m));
}