diff options
Diffstat (limited to 'qmapwatchlet')
-rw-r--r-- | qmapwatchlet/compass-metawatch-digital.qml | 47 | ||||
-rw-r--r-- | qmapwatchlet/compasswatchlet.cpp | 11 | ||||
-rw-r--r-- | qmapwatchlet/compasswatchlet.h | 20 | ||||
-rw-r--r-- | qmapwatchlet/map-arrow.png (renamed from qmapwatchlet/arrow.png) | bin | 2809 -> 2809 bytes | |||
-rw-r--r-- | qmapwatchlet/map-icon.png (renamed from qmapwatchlet/icon.png) | bin | 207 -> 207 bytes | |||
-rw-r--r-- | qmapwatchlet/map-metawatch-digital.qml (renamed from qmapwatchlet/metawatch-digital.qml) | 0 | ||||
-rw-r--r-- | qmapwatchlet/mapview.cpp (renamed from qmapwatchlet/mapview.cc) | 0 | ||||
-rw-r--r-- | qmapwatchlet/qmapwatchlet.cpp | 2 | ||||
-rw-r--r-- | qmapwatchlet/qmapwatchlet.pro | 9 | ||||
-rw-r--r-- | qmapwatchlet/qmapwatchletplugin.cpp | 13 |
10 files changed, 95 insertions, 7 deletions
diff --git a/qmapwatchlet/compass-metawatch-digital.qml b/qmapwatchlet/compass-metawatch-digital.qml new file mode 100644 index 0000000..9268435 --- /dev/null +++ b/qmapwatchlet/compass-metawatch-digital.qml @@ -0,0 +1,47 @@ +import QtQuick 1.0 +import QtMobility.location 1.2 +import com.javispedro.sowatch.metawatch 1.0 +import com.javispedro.sowatch.qmap 1.0 + +MWPage { + MWTitle { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + text: qsTr("Trip computer") + icon.source: "trip-icon.png" + } + + PositionSource { + id: gps + active: watch.active + updateInterval: 2000 + } + + function formatSpeed(speed) { + if (speed < 10) { + return speed.toFixed(1); + } else { + return speed.toFixed(0); + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + MWLabel { + text: qsTr("Speed") + } + MWLabel { + id: speedLabel + text: gps.position.speedValid ? formatSpeed(gps.position.speed) : "" + } + + MWLabel { + text: qsTr("Altitude") + } + } + + Column { + + } +} diff --git a/qmapwatchlet/compasswatchlet.cpp b/qmapwatchlet/compasswatchlet.cpp new file mode 100644 index 0000000..3101955 --- /dev/null +++ b/qmapwatchlet/compasswatchlet.cpp @@ -0,0 +1,11 @@ +#include "tripwatchlet.h" + +using namespace sowatch; + +const QLatin1String TripWatchlet::myId("com.javispedro.sowatch.trip"); + +TripWatchlet::TripWatchlet(WatchServer* server) : + DeclarativeWatchlet(server, myId) +{ + setSource(QUrl(SOWATCH_QML_DIR "/qmapwatchlet/trip-" + server->watch()->model() + ".qml")); +} diff --git a/qmapwatchlet/compasswatchlet.h b/qmapwatchlet/compasswatchlet.h new file mode 100644 index 0000000..185205b --- /dev/null +++ b/qmapwatchlet/compasswatchlet.h @@ -0,0 +1,20 @@ +#ifndef TRIPWATCHLET_H +#define TRIPWATCHLET_H + +#include <sowatch.h> + +namespace sowatch +{ + +class TripWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit TripWatchlet(WatchServer* server); + + static const QLatin1String myId; +}; + +} + +#endif // TRIPWATCHLET_H diff --git a/qmapwatchlet/arrow.png b/qmapwatchlet/map-arrow.png Binary files differindex b0e4d0c..b0e4d0c 100644 --- a/qmapwatchlet/arrow.png +++ b/qmapwatchlet/map-arrow.png diff --git a/qmapwatchlet/icon.png b/qmapwatchlet/map-icon.png Binary files differindex 4e9cd9e..4e9cd9e 100644 --- a/qmapwatchlet/icon.png +++ b/qmapwatchlet/map-icon.png diff --git a/qmapwatchlet/metawatch-digital.qml b/qmapwatchlet/map-metawatch-digital.qml index 9c054a4..9c054a4 100644 --- a/qmapwatchlet/metawatch-digital.qml +++ b/qmapwatchlet/map-metawatch-digital.qml diff --git a/qmapwatchlet/mapview.cc b/qmapwatchlet/mapview.cpp index 5972e07..5972e07 100644 --- a/qmapwatchlet/mapview.cc +++ b/qmapwatchlet/mapview.cpp diff --git a/qmapwatchlet/qmapwatchlet.cpp b/qmapwatchlet/qmapwatchlet.cpp index 82132db..efc478e 100644 --- a/qmapwatchlet/qmapwatchlet.cpp +++ b/qmapwatchlet/qmapwatchlet.cpp @@ -8,6 +8,6 @@ QMapWatchlet::QMapWatchlet(WatchServer* server) : DeclarativeWatchlet(server, myId) { setFullUpdateMode(true); - setSource(QUrl(SOWATCH_QML_DIR "/qmapwatchlet/" + server->watch()->model() + ".qml")); + setSource(QUrl(SOWATCH_QML_DIR "/qmapwatchlet/map-" + server->watch()->model() + ".qml")); } diff --git a/qmapwatchlet/qmapwatchlet.pro b/qmapwatchlet/qmapwatchlet.pro index 9bfb755..ab51e30 100644 --- a/qmapwatchlet/qmapwatchlet.pro +++ b/qmapwatchlet/qmapwatchlet.pro @@ -5,11 +5,14 @@ CONFIG += plugin CONFIG += mobility MOBILITY += location -SOURCES += qmapwatchletplugin.cpp qmapwatchlet.cpp mapview.cc +SOURCES += qmapwatchletplugin.cpp qmapwatchlet.cpp mapview.cpp \ + compasswatchlet.cpp -HEADERS += qmapwatchletplugin.h qmapwatchlet.h mapview.h +HEADERS += qmapwatchletplugin.h qmapwatchlet.h mapview.h \ + compasswatchlet.h -qml_files.files = metawatch-digital.qml icon.png arrow.png +qml_files.files = map-metawatch-digital.qml map-icon.png map-arrow.png \ + compass-metawatch-digital.qml compass-icon.png LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch INCLUDEPATH += $$PWD/../libsowatch diff --git a/qmapwatchlet/qmapwatchletplugin.cpp b/qmapwatchlet/qmapwatchletplugin.cpp index 9450558..5beaf7e 100644 --- a/qmapwatchlet/qmapwatchletplugin.cpp +++ b/qmapwatchlet/qmapwatchletplugin.cpp @@ -1,6 +1,7 @@ #include "qmapwatchlet.h" #include "mapview.h" #include "qmapwatchletplugin.h" +#include "tripwatchlet.h" using namespace sowatch; QTM_USE_NAMESPACE @@ -35,9 +36,15 @@ QStringList QMapWatchletPlugin::watchlets() WatchletPluginInterface::WatchletInfo QMapWatchletPlugin::describeWatchlet(const QString &id) { WatchletInfo info; - if (id != QMapWatchlet::myId) return info; - info.name = tr("Map"); - info.icon = QUrl::fromLocalFile(SOWATCH_QML_DIR "/qmapwatchlet/icon.png"); + 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; } |