summaryrefslogtreecommitdiff
path: root/qmapwatchlet
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-27 20:22:49 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-27 20:22:49 +0200
commit64662ecc6ea6b5296ea77d83eac6eb1372afac01 (patch)
treec32745b57e9f65c9aff83717ea930de06c853577 /qmapwatchlet
parent754d02ae6f8d19e64a36cee970a7e364b5b295de (diff)
downloadsowatch-64662ecc6ea6b5296ea77d83eac6eb1372afac01.tar.gz
sowatch-64662ecc6ea6b5296ea77d83eac6eb1372afac01.zip
new crappy map watchlet
Diffstat (limited to 'qmapwatchlet')
-rw-r--r--qmapwatchlet/metawatch-digital.qml36
-rw-r--r--qmapwatchlet/qmapwatchlet.cpp11
-rw-r--r--qmapwatchlet/qmapwatchlet.h18
-rw-r--r--qmapwatchlet/qmapwatchlet.pro48
-rw-r--r--qmapwatchlet/qmapwatchlet.qrc5
-rw-r--r--qmapwatchlet/qmapwatchletplugin.cpp29
-rw-r--r--qmapwatchlet/qmapwatchletplugin.h24
7 files changed, 171 insertions, 0 deletions
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 <sowatch.h>
+
+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 @@
+<RCC>
+ <qresource prefix="/qmapwatchlet">
+ <file>metawatch-digital.qml</file>
+ </qresource>
+</RCC>
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 <sowatch.h>
+
+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