diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-17 04:57:27 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-17 04:57:27 +0200 |
commit | 659c53b0d8faf26e6f06334833b2e105a4c4193d (patch) | |
tree | 8dced84e65f3c662622159acb6ab096bfc005976 /qmapwatchlet/qmapwatchletplugin.cpp | |
parent | a2059b5cfaa600402dfbec5d63099fd724998e9f (diff) | |
download | sowatch-659c53b0d8faf26e6f06334833b2e105a4c4193d.tar.gz sowatch-659c53b0d8faf26e6f06334833b2e105a4c4193d.zip |
trying to make the map watchlet more useful
Diffstat (limited to 'qmapwatchlet/qmapwatchletplugin.cpp')
-rw-r--r-- | qmapwatchlet/qmapwatchletplugin.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/qmapwatchlet/qmapwatchletplugin.cpp b/qmapwatchlet/qmapwatchletplugin.cpp index e8e1c43..517d167 100644 --- a/qmapwatchlet/qmapwatchletplugin.cpp +++ b/qmapwatchlet/qmapwatchletplugin.cpp @@ -1,28 +1,41 @@ #include "qmapwatchlet.h" +#include "mapview.h" #include "qmapwatchletplugin.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 << "com.javispedro.sowatch.qmap"; + l << QMapWatchlet::myId; return l; } WatchletPluginInterface::WatchletInfo QMapWatchletPlugin::describeWatchlet(const QString &id) { WatchletInfo info; - if (id != "com.javispedro.sowatch.qmap") return info; + if (id != QMapWatchlet::myId) return info; info.name = "Moving map"; info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmapwatchlet/icon.png"); return info; @@ -31,8 +44,13 @@ WatchletPluginInterface::WatchletInfo QMapWatchletPlugin::describeWatchlet(const Watchlet* QMapWatchletPlugin::getWatchlet(const QString &id, ConfigKey *config, WatchServer *server) { Q_UNUSED(config); - if (id != "com.javispedro.sowatch.qmap") return 0; + if (id != QMapWatchlet::myId) return 0; return new QMapWatchlet(server); } +QGeoServiceProvider *QMapWatchletPlugin::geoServiceProvider() +{ + return _provider; +} + Q_EXPORT_PLUGIN2(qmapwatchlet, QMapWatchletPlugin) |