summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-05 02:21:29 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-05 02:21:29 +0200
commit12d61ddf50f5f34cafd25d7cbdc827156cfb184c (patch)
treebe975c0ba828c8322230b0146e1eb4fa30133127
parent49c64104c0750857858504b512955d9cc31e5c42 (diff)
downloadsowatch-12d61ddf50f5f34cafd25d7cbdc827156cfb184c.tar.gz
sowatch-12d61ddf50f5f34cafd25d7cbdc827156cfb184c.zip
preparing face watchlet support
-rw-r--r--libsowatch/watchserver.h13
-rw-r--r--metawatch/metawatch.pro7
-rw-r--r--metawatch/metawatchdigital.h5
-rw-r--r--metawatch/metawatchdigitalfacewatchlet.cpp8
-rw-r--r--metawatch/metawatchdigitalfacewatchlet.h18
-rw-r--r--metawatch/metawatchfacewatchlet.cpp9
-rw-r--r--metawatch/metawatchfacewatchlet.h18
7 files changed, 47 insertions, 31 deletions
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<Watchlet*> _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<QRect>& rects = QList<QRect>());
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 <sowatch.h>
-
-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 <sowatch.h>
+
+namespace sowatch
+{
+
+class MetaWatchFaceWatchlet : public DeclarativeWatchlet
+{
+ Q_OBJECT
+public:
+ explicit MetaWatchFaceWatchlet(Watch* watch);
+};
+
+}
+
+#endif // METAWATCHFACEWATCHLET_H