summaryrefslogtreecommitdiff
path: root/libsowatch/watch.h
blob: 3581ada44c275d26b861966e05cf2e93cd4b41c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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