diff options
Diffstat (limited to 'metawatchwatchlets')
-rw-r--r-- | metawatchwatchlets/metawatch-digital-watchface.qml | 18 | ||||
-rw-r--r-- | metawatchwatchlets/metawatchfacewatchlet.cpp | 11 | ||||
-rw-r--r-- | metawatchwatchlets/metawatchfacewatchlet.h | 20 | ||||
-rw-r--r-- | metawatchwatchlets/metawatchwatchlets.pro | 26 | ||||
-rw-r--r-- | metawatchwatchlets/metawatchwatchletsplugin.cpp | 40 | ||||
-rw-r--r-- | metawatchwatchlets/metawatchwatchletsplugin.h | 25 |
6 files changed, 140 insertions, 0 deletions
diff --git a/metawatchwatchlets/metawatch-digital-watchface.qml b/metawatchwatchlets/metawatch-digital-watchface.qml new file mode 100644 index 0000000..712dbeb --- /dev/null +++ b/metawatchwatchlets/metawatch-digital-watchface.qml @@ -0,0 +1,18 @@ +import QtQuick 1.0 +import com.javispedro.sowatch.metawatch 1.0 + +MWPage { + // Remember that firmware draws top 30 lines + + Connections { + target: watch + onActiveChanged: { + console.log("watchface is now " + (watch.active ? "active" : "inactive")) + } + } + + MWLabel { + anchors.centerIn: parent + text: "This is a test" + } +} diff --git a/metawatchwatchlets/metawatchfacewatchlet.cpp b/metawatchwatchlets/metawatchfacewatchlet.cpp new file mode 100644 index 0000000..5b03e42 --- /dev/null +++ b/metawatchwatchlets/metawatchfacewatchlet.cpp @@ -0,0 +1,11 @@ +#include "metawatchfacewatchlet.h" + +using namespace sowatch; + +const QLatin1String MetaWatchFaceWatchlet::myId("com.javispedro.sowatch.metawatch.watchface"); + +MetaWatchFaceWatchlet::MetaWatchFaceWatchlet(Watch *watch) : + DeclarativeWatchlet(watch, myId) +{ + setSource(QUrl(SOWATCH_QML_DIR "/metawatchwatchlets/" + watch->model() + "-watchface.qml")); +} diff --git a/metawatchwatchlets/metawatchfacewatchlet.h b/metawatchwatchlets/metawatchfacewatchlet.h new file mode 100644 index 0000000..4ef23df --- /dev/null +++ b/metawatchwatchlets/metawatchfacewatchlet.h @@ -0,0 +1,20 @@ +#ifndef METAWATCHFACEWATCHLET_H +#define METAWATCHFACEWATCHLET_H + +#include <sowatch.h> + +namespace sowatch +{ + +class MetaWatchFaceWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit MetaWatchFaceWatchlet(Watch* watch); + + static const QLatin1String myId; +}; + +} + +#endif // METAWATCHFACEWATCHLET_H diff --git a/metawatchwatchlets/metawatchwatchlets.pro b/metawatchwatchlets/metawatchwatchlets.pro new file mode 100644 index 0000000..f4393e4 --- /dev/null +++ b/metawatchwatchlets/metawatchwatchlets.pro @@ -0,0 +1,26 @@ +TARGET = metawatchwatchlets +TEMPLATE = lib +CONFIG += plugin + +SOURCES += metawatchwatchletsplugin.cpp metawatchfacewatchlet.cpp + +HEADERS += metawatchwatchletsplugin.h metawatchfacewatchlet.h + +qml_files.files = metawatch-digital-watchface.qml + +LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch +INCLUDEPATH += $$PWD/../libsowatch +DEPENDPATH += $$PWD/../libsowatch +QML_IMPORT_PATH += $$PWD/../metawatch/qml + +unix:!symbian { + !isEmpty(MEEGO_VERSION_MAJOR)|maemo5 { + QMAKE_RPATHDIR += /opt/sowatch/lib + target.path = /opt/sowatch/lib/watchlets + qml_files.path = /opt/sowatch/qml/$$TARGET + } else { + target.path = /usr/lib/sowatch/watchlets + qml_files.path = /usr/share/sowatch/qml/$$TARGET + } + INSTALLS += target qml_files +} diff --git a/metawatchwatchlets/metawatchwatchletsplugin.cpp b/metawatchwatchlets/metawatchwatchletsplugin.cpp new file mode 100644 index 0000000..31b66ab --- /dev/null +++ b/metawatchwatchlets/metawatchwatchletsplugin.cpp @@ -0,0 +1,40 @@ +#include "metawatchfacewatchlet.h" +#include "metawatchwatchletsplugin.h" + +using namespace sowatch; + +MetaWatchWatchletsPlugin::MetaWatchWatchletsPlugin(QObject *parent) : + QObject(parent) +{ +} + +MetaWatchWatchletsPlugin::~MetaWatchWatchletsPlugin() +{ +} + +QStringList MetaWatchWatchletsPlugin::watchlets() +{ + QStringList l; + l << MetaWatchFaceWatchlet::myId; + return l; +} + +WatchletPluginInterface::WatchletInfo MetaWatchWatchletsPlugin::describeWatchlet(const QString &id) +{ + WatchletInfo info; + if (id == MetaWatchFaceWatchlet::myId) { + info.name = "MetaWatch Face Watchlet"; + info.hidden = true; + } + return info; +} + +Watchlet* MetaWatchWatchletsPlugin::getWatchlet(const QString& id, ConfigKey *settings, Watch *watch) +{ + Q_UNUSED(settings); + if (id == MetaWatchFaceWatchlet::myId) { + return new MetaWatchFaceWatchlet(watch); + } +} + +Q_EXPORT_PLUGIN2(notificationswatchlet, MetaWatchWatchletsPlugin) diff --git a/metawatchwatchlets/metawatchwatchletsplugin.h b/metawatchwatchlets/metawatchwatchletsplugin.h new file mode 100644 index 0000000..a7ba34b --- /dev/null +++ b/metawatchwatchlets/metawatchwatchletsplugin.h @@ -0,0 +1,25 @@ +#ifndef METAWATCHWATCHLETSPLUGIN_H +#define METAWATCHWATCHLETSPLUGIN_H + +#include <sowatch.h> + +namespace sowatch +{ + +class MetaWatchWatchletsPlugin : public QObject, public WatchletPluginInterface +{ + Q_OBJECT + Q_INTERFACES(sowatch::WatchletPluginInterface) + +public: + explicit MetaWatchWatchletsPlugin(QObject *parent = 0); + ~MetaWatchWatchletsPlugin(); + + QStringList watchlets(); + WatchletInfo describeWatchlet(const QString &id); + Watchlet* getWatchlet(const QString& id, ConfigKey *settings, Watch* watch); +}; + +} + +#endif // NEKOWATCHLETPLUGIN_H |