blob: 5beaf7e34f78253489714bd38b0355bfcc0efefd (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#include "qmapwatchlet.h"
#include "mapview.h"
#include "qmapwatchletplugin.h"
#include "tripwatchlet.h"
using namespace sowatch;
QTM_USE_NAMESPACE
QGeoServiceProvider* QMapWatchletPlugin::_provider;
QMapWatchletPlugin::QMapWatchletPlugin(QObject *parent) :
QObject(parent)
{
QStringList avail = QGeoServiceProvider::availableServiceProviders();
if (!avail.isEmpty()) {
_provider = new QGeoServiceProvider(avail.first());
} else {
_provider = 0;
}
qmlRegisterType<MapView>("com.javispedro.sowatch.qmap", 1, 0, "MapView");
}
QMapWatchletPlugin::~QMapWatchletPlugin()
{
delete _provider;
_provider = 0;
}
QStringList QMapWatchletPlugin::watchlets()
{
QStringList l;
l << QMapWatchlet::myId;
return l;
}
WatchletPluginInterface::WatchletInfo QMapWatchletPlugin::describeWatchlet(const QString &id)
{
WatchletInfo info;
if (id == QMapWatchlet::myId) {
info.name = tr("Map");
info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmapwatchlet/icon.png");
} else if (id == TripWatchlet::myId) {
info.name = tr("Trip computer");
info.icon =
}
if (id != ) return info;
return info;
}
Watchlet* QMapWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, WatchServer *server)
{
Q_UNUSED(config);
if (id != QMapWatchlet::myId) return 0;
return new QMapWatchlet(server);
}
QGeoServiceProvider *QMapWatchletPlugin::geoServiceProvider()
{
return _provider;
}
Q_EXPORT_PLUGIN2(qmapwatchlet, QMapWatchletPlugin)
|