diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-16 17:47:24 +0200 |
---|---|---|
committer | Javier <javier@pcjavier.(none)> | 2011-09-16 17:47:24 +0200 |
commit | aa1c0fd3146b4ed055d181c99d52463afa6bedbb (patch) | |
tree | f6fb8d9693ad8c545ddabf76312f8f33b5b9878f /watch.h | |
download | sowatch-aa1c0fd3146b4ed055d181c99d52463afa6bedbb.tar.gz sowatch-aa1c0fd3146b4ed055d181c99d52463afa6bedbb.zip |
Initial import
Diffstat (limited to 'watch.h')
-rw-r--r-- | watch.h | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -0,0 +1,49 @@ +#ifndef WATCH_H +#define WATCH_H + +#include <QtCore/QObject> +#include <QtGui/QPaintDevice> +#include <QtGui/QImage> + +namespace sowatch +{ + +class Watch : public QObject, public QPaintDevice +{ + Q_OBJECT + Q_PROPERTY(QString model READ model) + Q_PROPERTY(bool connected READ isConnected) +public: + explicit Watch(const QImage& image, QObject* parent = 0); + ~Watch(); + + QPaintEngine* paintEngine() const; + int metric(PaintDeviceMetric metric) const; + + Q_INVOKABLE virtual QString model() const = 0; + Q_INVOKABLE virtual bool isConnected() const = 0; + + /** Indicates if watch is too busy atm and we should limit frame rate. */ + Q_INVOKABLE virtual bool busy() const = 0; + +signals: + void connected(); + void disconnected(); + void buttonPressed(int button); + void buttonReleased(int button); + +public slots: + virtual void update(const QList<QRect>& rects) = 0; + virtual void update(const QRect& rect); + virtual void vibrate(bool on) = 0; + +protected: + QImage _image; + mutable QPaintEngine* _paintEngine; + +friend class WatchPaintEngine; +}; + +} + +#endif // WATCH_H |