From 9e3eff1c3a2b7105fecf6d0d7f052eb9943fbada Mon Sep 17 00:00:00 2001
From: "Javier S. Pedro" <maemo@javispedro.com>
Date: Tue, 14 May 2013 01:57:34 +0200
Subject: perform only one bluetooth discovery for all watches

---
 qmafwwatchlet/qmafwwatchlet.cpp       |  4 ++--
 qmafwwatchlet/qmafwwatchletplugin.cpp | 10 ++++++----
 qmafwwatchlet/qmafwwatchletplugin.h   |  2 +-
 3 files changed, 9 insertions(+), 7 deletions(-)

(limited to 'qmafwwatchlet')

diff --git a/qmafwwatchlet/qmafwwatchlet.cpp b/qmafwwatchlet/qmafwwatchlet.cpp
index 41cea2a..05d707b 100644
--- a/qmafwwatchlet/qmafwwatchlet.cpp
+++ b/qmafwwatchlet/qmafwwatchlet.cpp
@@ -7,7 +7,7 @@
 using namespace sowatch;
 
 QMafwWatchlet::QMafwWatchlet(Watch* watch) :
-	DeclarativeWatchlet(server, "com.javispedro.sowatch.qmafw"),
+	DeclarativeWatchlet(watch, "com.javispedro.sowatch.qmafw"),
 	_registry(MafwRegistry::instance()),
 	_player(new QMafwWatchletPlayer(this)),
     _volumeControl(new QMafwWatchletVolumeControl(this))
@@ -24,7 +24,7 @@ QMafwWatchlet::QMafwWatchlet(Watch* watch) :
 
 	context()->setContextProperty("player", _player);
 	context()->setContextProperty("volumeControl", _volumeControl);
-	setSource(QUrl(SOWATCH_QML_DIR "/qmafwwatchlet/" + server->watch()->model() + ".qml"));
+	setSource(QUrl(SOWATCH_QML_DIR "/qmafwwatchlet/" + watch->model() + ".qml"));
 }
 
 void QMafwWatchlet::handleRendererAdded(const QString &uuid)
diff --git a/qmafwwatchlet/qmafwwatchletplugin.cpp b/qmafwwatchlet/qmafwwatchletplugin.cpp
index f2ec355..a2d7a1f 100644
--- a/qmafwwatchlet/qmafwwatchletplugin.cpp
+++ b/qmafwwatchlet/qmafwwatchletplugin.cpp
@@ -15,20 +15,22 @@ QStringList QMafwWatchletPlugin::watchlets()
 	return l;
 }
 
-WatchletPluginInterface::WatchletInfo QMafwWatchletPlugin::describeWatchlet(const QString &id)
+WatchletPluginInterface::WatchletInfo QMafwWatchletPlugin::describeWatchlet(const QString &id, const QString &watchModel)
 {
 	WatchletInfo info;
 	if (id != "com.javispedro.sowatch.qmafw") return info;
 	info.name = tr("Music player");
-	info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmafwwatchlet/icon.png");
+	info.phoneIcon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmafwwatchlet/icon.png");
+	info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmafwwatchlet/" + watchModel + "-icon.png");
+	info.visible = true;
 	return info;
 }
 
-Watchlet* QMafwWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, WatchServer *server)
+Watchlet* QMafwWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, Watch *watch)
 {
 	Q_UNUSED(config);
 	if (id != "com.javispedro.sowatch.qmafw") return 0;
-	return new QMafwWatchlet(server);
+	return new QMafwWatchlet(watch);
 }
 
 Q_EXPORT_PLUGIN2(qmafwwatchlet, QMafwWatchletPlugin)
diff --git a/qmafwwatchlet/qmafwwatchletplugin.h b/qmafwwatchlet/qmafwwatchletplugin.h
index b24dcff..7e99cf5 100644
--- a/qmafwwatchlet/qmafwwatchletplugin.h
+++ b/qmafwwatchlet/qmafwwatchletplugin.h
@@ -17,7 +17,7 @@ public:
 
 	QStringList watchlets();
 	WatchletInfo describeWatchlet(const QString &id, const QString &watchModel);
-	Watchlet* getWatchlet(const QString &id, ConfigKey *config, WatchServer *server);
+	Watchlet* getWatchlet(const QString &id, ConfigKey *config, Watch *watch);
 };
 
 }
-- 
cgit v1.2.3