1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <MafwShared.h>
#include "qmafwwatchletplayer.h"
#include "qmafwwatchlet.h"
using namespace sowatch;
QMafwWatchlet::QMafwWatchlet(WatchServer* server) :
DeclarativeWatchlet(server, "com.javispedro.sowatch.qmafw"),
_registry(MafwRegistry::instance()),
_player(new QMafwWatchletPlayer(this))
{
MafwShared* shared = MafwShared::instance();
connect(_registry, SIGNAL(rendererAdded(QString, QString)), SLOT(handleRendererAdded(QString)));
connect(_registry, SIGNAL(rendererRemoved(QString, QString)), SLOT(handleRendererRemoved(QString)));
shared->initTracking(_registry);
connect(this, SIGNAL(activated()), _player, SLOT(activate()));
connect(this, SIGNAL(deactivated()), _player, SLOT(deactivate()));
rootContext()->setContextProperty("player", _player);
setSource(QUrl(SOWATCH_QML_DIR "/qmafwwatchlet/" + server->watch()->model() + ".qml"));
}
void QMafwWatchlet::handleRendererAdded(const QString &uuid)
{
if (uuid == "mafw_gst_renderer") {
_player->setRenderer(_registry->renderer(uuid));
}
}
void QMafwWatchlet::handleRendererRemoved(const QString &uuid)
{
if (uuid == "mafw_gst_renderer") {
_player->setRenderer(0);
}
}
|