diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-10-17 00:20:20 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-10-17 00:20:20 +0200 |
commit | 0e265ebc99a274cd4809b628a7667408a0c0a11c (patch) | |
tree | dde5595e3ea51131ed8649ee4058747dee7f2eb2 /metawatch | |
parent | 5db79919b3140673f66c9da5965b54671e8f4b6a (diff) | |
download | sowatch-0e265ebc99a274cd4809b628a7667408a0c0a11c.tar.gz sowatch-0e265ebc99a274cd4809b628a7667408a0c0a11c.zip |
Adding stub MetaWatchAnalog plugin
Diffstat (limited to 'metawatch')
-rw-r--r-- | metawatch/metawatch.pro | 8 | ||||
-rw-r--r-- | metawatch/metawatchanalog.cpp | 90 | ||||
-rw-r--r-- | metawatch/metawatchanalog.h | 38 | ||||
-rw-r--r-- | metawatch/metawatchplugin.cpp | 6 |
4 files changed, 139 insertions, 3 deletions
diff --git a/metawatch/metawatch.pro b/metawatch/metawatch.pro index 366695e..96518da 100644 --- a/metawatch/metawatch.pro +++ b/metawatch/metawatch.pro @@ -16,14 +16,16 @@ SOURCES += metawatchplugin.cpp \ metawatchsimulator.cpp \ metawatchpaintengine.cpp \ metawatch.cpp \ - metawatchdigital.cpp + metawatchdigital.cpp \ + metawatchanalog.cpp HEADERS += metawatchplugin.h \ metawatchsimulatorform.h \ metawatchsimulator.h \ metawatchpaintengine.h \ metawatch.h \ - metawatchdigital.h + metawatchdigital.h \ + metawatchanalog.h FORMS += \ metawatchsimulatorform.ui @@ -73,3 +75,5 @@ unix:!symbian { } + + diff --git a/metawatch/metawatchanalog.cpp b/metawatch/metawatchanalog.cpp new file mode 100644 index 0000000..cfd8f19 --- /dev/null +++ b/metawatch/metawatchanalog.cpp @@ -0,0 +1,90 @@ +#include "metawatchanalog.h" + +using namespace sowatch; + +MetaWatchAnalog::MetaWatchAnalog(const QBluetoothAddress& address, QSettings* settings, QObject *parent) : + MetaWatch(address, settings, parent) +{ +} + +int MetaWatchAnalog::metric(PaintDeviceMetric metric) const +{ + switch (metric) { + case PdmWidth: + return screenWidth; + case PdmHeight: + return screenHeight; + case PdmWidthMM: + return 8; + case PdmHeightMM: + return 8; + case PdmNumColors: + return 2; + case PdmDepth: + return 1; + case PdmDpiX: + case PdmPhysicalDpiX: + return 96; + case PdmDpiY: + case PdmPhysicalDpiY: + return 96; + } + + return -1; +} + +QString MetaWatchAnalog::model() const +{ + return "metawatch-analog"; +} + +void MetaWatchAnalog::updateNotificationCount(Notification::Type type, int count) +{ + // Analog doesn't do anything with this +} + +void MetaWatchAnalog::updateWeather(WeatherNotification *weather) +{ + // Analog doesn't do anything with this +} + +void MetaWatchAnalog::displayIdleScreen() +{ + qDebug() << "displaying idle screen"; + MetaWatch::displayIdleScreen(); +} + +void MetaWatchAnalog::displayNotification(Notification *n) +{ + qDebug() << "display notification" << n->title() << n->body(); + + // Render the notification and display it before invoking haptic feedback + _currentMode = NotificationMode; + // TODO + + MetaWatch::displayNotification(n); +} + +void MetaWatchAnalog::displayApplication() +{ + qDebug() << "entering application mode"; + + MetaWatch::displayApplication(); +} + +void MetaWatchAnalog::update(Mode mode, const QList<QRect> &rects) +{ + if (!_connected) return; + // TODO +} + +void MetaWatchAnalog::clear(Mode mode, bool black) +{ + if (!_connected) return; + // TODO Still need to understand this +} + +void MetaWatchAnalog::handleWatchConnected() +{ + +} diff --git a/metawatch/metawatchanalog.h b/metawatch/metawatchanalog.h new file mode 100644 index 0000000..ff941c5 --- /dev/null +++ b/metawatch/metawatchanalog.h @@ -0,0 +1,38 @@ +#ifndef METAWATCHANALOG_H +#define METAWATCHANALOG_H + +#include "metawatch.h" + +namespace sowatch +{ + +class MetaWatchAnalog : public MetaWatch +{ + Q_OBJECT +public: + explicit MetaWatchAnalog(const QBluetoothAddress& address, QSettings* settings = 0, QObject *parent = 0); + + static const int screenWidth = 80; + static const int screenHeight = 16*2; + + int metric(PaintDeviceMetric metric) const; + + QString model() const; + + void updateNotificationCount(Notification::Type type, int count); + void updateWeather(WeatherNotification *weather); + + void displayIdleScreen(); + void displayNotification(Notification *notification); + void displayApplication(); + + void clear(Mode mode, bool black = false); + void update(Mode mode, const QList<QRect>& rects = QList<QRect>()); + +protected: + void handleWatchConnected(); +}; + +} + +#endif // METAWATCHANALOG_H diff --git a/metawatch/metawatchplugin.cpp b/metawatch/metawatchplugin.cpp index 5744196..5e649a9 100644 --- a/metawatch/metawatchplugin.cpp +++ b/metawatch/metawatchplugin.cpp @@ -1,6 +1,7 @@ #include <QtGui/QFontDatabase> #include <QtConnectivity/QBluetoothAddress> #include "metawatchdigital.h" +#include "metawatchanalog.h" #include "metawatchsimulator.h" #include "metawatchplugin.h" @@ -28,7 +29,7 @@ MetaWatchPlugin::~MetaWatchPlugin() QStringList MetaWatchPlugin::drivers() { QStringList d; - d << "metawatch-digital"; + d << "metawatch-digital" << "metawatch-analog"; return d; } @@ -37,6 +38,9 @@ Watch* MetaWatchPlugin::getWatch(const QString& driver, QSettings& settings, QOb if (driver == "metawatch-digital") { QBluetoothAddress address(settings.value("address").toString()); return new MetaWatchDigital(address, &settings, parent); + } else if (driver == "metawatch-analog") { + QBluetoothAddress address(settings.value("address").toString()); + return new MetaWatchAnalog(address, &settings, parent); } else { return 0; } |