From 64662ecc6ea6b5296ea77d83eac6eb1372afac01 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Tue, 27 Sep 2011 20:22:49 +0200 Subject: new crappy map watchlet --- qmapwatchlet/metawatch-digital.qml | 36 ++++++++++++++++++++++++++++ qmapwatchlet/qmapwatchlet.cpp | 11 +++++++++ qmapwatchlet/qmapwatchlet.h | 18 ++++++++++++++ qmapwatchlet/qmapwatchlet.pro | 48 +++++++++++++++++++++++++++++++++++++ qmapwatchlet/qmapwatchlet.qrc | 5 ++++ qmapwatchlet/qmapwatchletplugin.cpp | 29 ++++++++++++++++++++++ qmapwatchlet/qmapwatchletplugin.h | 24 +++++++++++++++++++ 7 files changed, 171 insertions(+) create mode 100644 qmapwatchlet/metawatch-digital.qml create mode 100644 qmapwatchlet/qmapwatchlet.cpp create mode 100644 qmapwatchlet/qmapwatchlet.h create mode 100644 qmapwatchlet/qmapwatchlet.pro create mode 100644 qmapwatchlet/qmapwatchlet.qrc create mode 100644 qmapwatchlet/qmapwatchletplugin.cpp create mode 100644 qmapwatchlet/qmapwatchletplugin.h (limited to 'qmapwatchlet') diff --git a/qmapwatchlet/metawatch-digital.qml b/qmapwatchlet/metawatch-digital.qml new file mode 100644 index 0000000..16206db --- /dev/null +++ b/qmapwatchlet/metawatch-digital.qml @@ -0,0 +1,36 @@ +import QtQuick 1.0 +import QtMobility.location 1.2 + +Rectangle { + width: 96 + height: 96 + + color: "white" + + PositionSource { + id: pos + updateInterval: 5000 + active: watch.active + } + + Map { + id: map + anchors.fill: parent; + plugin : Plugin { name : "nokia" } + center: pos.position.coordinate + } + + Connections { + target: watch + onButtonPressed : { + switch(button) { + case 1: + map.zoomLevel -= 1; + break; + case 2: + map.zoomLevel += 1; + break; + } + } + } +} diff --git a/qmapwatchlet/qmapwatchlet.cpp b/qmapwatchlet/qmapwatchlet.cpp new file mode 100644 index 0000000..c77ede4 --- /dev/null +++ b/qmapwatchlet/qmapwatchlet.cpp @@ -0,0 +1,11 @@ +#include "qmapwatchlet.h" + +using namespace sowatch; + +QMapWatchlet::QMapWatchlet(WatchServer* server) : + DeclarativeWatchlet(server, "com.javispedro.sowatch.map") +{ + + setSource(QUrl("qrc:/qmapwatchlet/" + server->watch()->model() + ".qml")); +} + diff --git a/qmapwatchlet/qmapwatchlet.h b/qmapwatchlet/qmapwatchlet.h new file mode 100644 index 0000000..ae8e7ea --- /dev/null +++ b/qmapwatchlet/qmapwatchlet.h @@ -0,0 +1,18 @@ +#ifndef QMAPWATCHLET_H +#define QMAPWATCHLET_H + +#include + +namespace sowatch +{ + +class QMapWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit QMapWatchlet(WatchServer* server); +}; + +} + +#endif // QMAPWATCHLET_H diff --git a/qmapwatchlet/qmapwatchlet.pro b/qmapwatchlet/qmapwatchlet.pro new file mode 100644 index 0000000..da5cf6f --- /dev/null +++ b/qmapwatchlet/qmapwatchlet.pro @@ -0,0 +1,48 @@ + +TARGET = qmapwatchlet +TEMPLATE = lib +# CONFIG += plugin +CONFIG += mobility + +SOURCES += qmapwatchletplugin.cpp qmapwatchlet.cpp + +HEADERS += qmapwatchletplugin.h qmapwatchlet.h + +win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/release/ -lsowatch +else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../libsowatch/debug/ -lsowatch +else:symbian: LIBS += -lsowatch +else:unix: LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch + +INCLUDEPATH += $$PWD/../libsowatch +DEPENDPATH += $$PWD/../libsowatch + +unix:!symbian { + maemo5 { + target.path = /opt/sowatch/watchlets + } else { + target.path = /usr/lib/sowatch/watchlets + } + INSTALLS += target +} + +OTHER_FILES += \ + metawatch-digital.qml + +RESOURCES += \ + qmapwatchlet.qrc + + + + + + + + + + + + + + + + diff --git a/qmapwatchlet/qmapwatchlet.qrc b/qmapwatchlet/qmapwatchlet.qrc new file mode 100644 index 0000000..96c215e --- /dev/null +++ b/qmapwatchlet/qmapwatchlet.qrc @@ -0,0 +1,5 @@ + + + metawatch-digital.qml + + diff --git a/qmapwatchlet/qmapwatchletplugin.cpp b/qmapwatchlet/qmapwatchletplugin.cpp new file mode 100644 index 0000000..5b72482 --- /dev/null +++ b/qmapwatchlet/qmapwatchletplugin.cpp @@ -0,0 +1,29 @@ +#include "qmapwatchlet.h" +#include "qmapwatchletplugin.h" + +using namespace sowatch; + +QMapWatchletPlugin::QMapWatchletPlugin(QObject *parent) : + QObject(parent) +{ +} + +QMapWatchletPlugin::~QMapWatchletPlugin() +{ +} + +QStringList QMapWatchletPlugin::watchlets() +{ + QStringList l; + l << "com.javispedro.sowatch.qmap"; + return l; +} + +Watchlet* QMapWatchletPlugin::getWatchlet(const QString& driver, QSettings& settings, WatchServer *server) +{ + Q_UNUSED(driver); + Q_UNUSED(settings); + return new QMapWatchlet(server); +} + +Q_EXPORT_PLUGIN2(qmapwatchlet, QMapWatchletPlugin) diff --git a/qmapwatchlet/qmapwatchletplugin.h b/qmapwatchlet/qmapwatchletplugin.h new file mode 100644 index 0000000..e594209 --- /dev/null +++ b/qmapwatchlet/qmapwatchletplugin.h @@ -0,0 +1,24 @@ +#ifndef QMAPWATCHLETPLUGIN_H +#define QMAPWATCHLETPLUGIN_H + +#include + +namespace sowatch +{ + +class QMapWatchletPlugin : public QObject, public WatchletPluginInterface +{ + Q_OBJECT + Q_INTERFACES(sowatch::WatchletPluginInterface) + +public: + explicit QMapWatchletPlugin(QObject *parent = 0); + ~QMapWatchletPlugin(); + + QStringList watchlets(); + Watchlet* getWatchlet(const QString& driver, QSettings& settings, WatchServer* server); +}; + +} + +#endif // QMAPWATCHLETPLUGIN_H -- cgit v1.2.3