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
40
41
42
|
#include <MafwShared.h>
#include "qmafwwatchletplayer.h"
#include "qmafwwatchletvolumecontrol.h"
#include "qmafwwatchlet.h"
using namespace sowatch;
QMafwWatchlet::QMafwWatchlet(Watch* watch) :
DeclarativeWatchlet(watch, "com.javispedro.sowatch.qmafw"),
_registry(MafwRegistry::instance()),
_player(new QMafwWatchletPlayer(this)),
_volumeControl(new QMafwWatchletVolumeControl(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()));
context()->setContextProperty("player", _player);
context()->setContextProperty("volumeControl", _volumeControl);
setSource(QUrl(SOWATCH_QML_DIR "/qmafwwatchlet/" + 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);
}
}
|