From 12d61ddf50f5f34cafd25d7cbdc827156cfb184c Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 5 May 2013 02:21:29 +0200 Subject: preparing face watchlet support --- libsowatch/watchserver.h | 13 +++++++++++++ metawatch/metawatch.pro | 7 ++++--- metawatch/metawatchdigital.h | 5 +++-- metawatch/metawatchdigitalfacewatchlet.cpp | 8 -------- metawatch/metawatchdigitalfacewatchlet.h | 18 ------------------ metawatch/metawatchfacewatchlet.cpp | 9 +++++++++ metawatch/metawatchfacewatchlet.h | 18 ++++++++++++++++++ 7 files changed, 47 insertions(+), 31 deletions(-) delete mode 100644 metawatch/metawatchdigitalfacewatchlet.cpp delete mode 100644 metawatch/metawatchdigitalfacewatchlet.h create mode 100644 metawatch/metawatchfacewatchlet.cpp create mode 100644 metawatch/metawatchfacewatchlet.h diff --git a/libsowatch/watchserver.h b/libsowatch/watchserver.h index fb1b4e7..30f39c6 100644 --- a/libsowatch/watchserver.h +++ b/libsowatch/watchserver.h @@ -23,6 +23,8 @@ class SOWATCH_EXPORT WatchServer : public QObject Q_OBJECT Q_PROPERTY(Watch* watch READ watch CONSTANT) Q_PROPERTY(QString nextWatchletButton READ nextWatchletButton WRITE setNextWatchletButton) + Q_PROPERTY(Watchlet* idleWatchlet READ idleWatchlet WRITE setIdleWatchlet) + Q_PROPERTY(Watchlet* notificationWatchlet READ notificationWatchlet WRITE setNotificationWatchlet) public: explicit WatchServer(Watch *watch, QObject *parent = 0); @@ -33,6 +35,12 @@ public: QString nextWatchletButton() const; void setNextWatchletButton(const QString& value); + Watchlet *idleWatchlet(); + void setIdleWatchlet(Watchlet *watchlet); + + Watchlet *notificationWatchlet(); + void setNotificationWatchlet(Watchlet *watchlet); + void addWatchlet(Watchlet *watchlet); void insertWatchlet(int position, Watchlet *watchlet); void moveWatchlet(const Watchlet *watchlet, int to); @@ -67,6 +75,11 @@ private: /** The amount of seconds that have to pass for a notification to be considered "outdated" and not shown. */ int _oldNotificationThreshold; + /** The watchlet that is activated whenever the watch goes to the idle screen (optional). */ + Watchlet *_idleWatchlet; + /** The watchlet that is used to display notifications (optional). */ + Watchlet *_notificationWatchlet; + /** A list of watchlets, in order. */ QList _watchlets; /** Stores all the watchlets with a given watchled id. */ diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro index 1437b71..bd6d9bc 100644 --- a/metawatch/metawatch.pro +++ b/metawatch/metawatch.pro @@ -19,7 +19,7 @@ SOURCES += metawatchplugin.cpp \ metawatchscanner.cpp \ metawatchdigitalsimulator.cpp \ metawatchdigitalsimulatorform.cpp \ - metawatchdigitalfacewatchlet.cpp + metawatchfacewatchlet.cpp HEADERS += metawatchplugin.h \ metawatchpaintengine.h \ @@ -29,13 +29,14 @@ HEADERS += metawatchplugin.h \ metawatchscanner.h \ metawatchdigitalsimulator.h \ metawatchdigitalsimulatorform.h \ - metawatchdigitalfacewatchlet.h + metawatchfacewatchlet.h FORMS += \ metawatchdigitalsimulatorform.ui res_files.files += res/graphics res/fonts -qml_files.files += qml/com qml/metawatch-digital-config.qml +qml_files.files += qml/com qml/metawatch-digital-config.qml \ + qml/metawatch-digital-watchface.qml LIBS += -L$$OUT_PWD/../libsowatch/ -lsowatch diff --git a/metawatch/metawatchdigital.h b/metawatch/metawatchdigital.h index 4fd6ae6..3648160 100644 --- a/metawatch/metawatchdigital.h +++ b/metawatch/metawatchdigital.h @@ -31,6 +31,9 @@ public: void update(Mode mode, const QList& rects = QList()); protected: + void handleWatchConnected(); + +private: // Idle screen: notifications unread count ushort _nMails, _nCalls, _nIms, _nSms, _nMms; // Idle screen: weather information @@ -39,8 +42,6 @@ protected: short _wTemperature; bool _wMetric; - void handleWatchConnected(); - void renderIdleScreen(); void renderIdleWeather(); QImage iconForWeather(WeatherNotification::WeatherType w); diff --git a/metawatch/metawatchdigitalfacewatchlet.cpp b/metawatch/metawatchdigitalfacewatchlet.cpp deleted file mode 100644 index 08d8ac4..0000000 --- a/metawatch/metawatchdigitalfacewatchlet.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "metawatchdigitalfacewatchlet.h" - -using namespace sowatch; - -MetaWatchDigitalFaceWatchlet::MetaWatchDigitalFaceWatchlet(Watch *watch) : - DeclarativeWatchlet(watch, "crap") -{ -} diff --git a/metawatch/metawatchdigitalfacewatchlet.h b/metawatch/metawatchdigitalfacewatchlet.h deleted file mode 100644 index b4b92ca..0000000 --- a/metawatch/metawatchdigitalfacewatchlet.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef METAWATCHDIGITALFACEWATCHLET_H -#define METAWATCHDIGITALFACEWATCHLET_H - -#include - -namespace sowatch -{ - -class MetaWatchDigitalFaceWatchlet : public DeclarativeWatchlet -{ - Q_OBJECT -public: - explicit MetaWatchDigitalFaceWatchlet(Watch* watch); -}; - -} - -#endif // METAWATCHDIGITALFACEWATCHLET_H diff --git a/metawatch/metawatchfacewatchlet.cpp b/metawatch/metawatchfacewatchlet.cpp new file mode 100644 index 0000000..7e18988 --- /dev/null +++ b/metawatch/metawatchfacewatchlet.cpp @@ -0,0 +1,9 @@ +#include "metawatchfacewatchlet.h" + +using namespace sowatch; + +MetaWatchFaceWatchlet::MetaWatchFaceWatchlet(Watch *watch) : + DeclarativeWatchlet(watch, "com.javispedro.sowatch.metawatch.watchface") +{ + setSource(QUrl(SOWATCH_QML_DIR "/metawatch/" + watch->model() + "-watchface.qml")); +} diff --git a/metawatch/metawatchfacewatchlet.h b/metawatch/metawatchfacewatchlet.h new file mode 100644 index 0000000..2895589 --- /dev/null +++ b/metawatch/metawatchfacewatchlet.h @@ -0,0 +1,18 @@ +#ifndef METAWATCHFACEWATCHLET_H +#define METAWATCHFACEWATCHLET_H + +#include + +namespace sowatch +{ + +class MetaWatchFaceWatchlet : public DeclarativeWatchlet +{ + Q_OBJECT +public: + explicit MetaWatchFaceWatchlet(Watch* watch); +}; + +} + +#endif // METAWATCHFACEWATCHLET_H -- cgit v1.2.3