summaryrefslogtreecommitdiff
path: root/libsowatch/declarativewatchwrapper.h
blob: 5a827ab6b61605563ff9482d0e507a987d6ae492 (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
50
51
52
53
54
55
56
57
#ifndef SOWATCH_DECLARATIVEWATCHWRAPPER_H
#define SOWATCH_DECLARATIVEWATCHWRAPPER_H

#include <QtDeclarative/QtDeclarative>
#include "sowatch_global.h"

namespace sowatch
{

class WatchServer;
class Watch;
class DeclarativeWatchlet;
class Notification;

class SOWATCH_EXPORT DeclarativeWatchWrapper : public QObject
{
    Q_OBJECT
	Q_PROPERTY(QString model READ model CONSTANT)
	Q_PROPERTY(bool active READ active NOTIFY activeChanged)
	Q_PROPERTY(QList<QObject*> notifications READ notifications NOTIFY notificationsChanged)

public:
	explicit DeclarativeWatchWrapper(WatchServer *server, Watch *watch, QObject *parent = 0);

	QString model() const;
	bool active() const;

	QList<QObject*> notifications() const;

public slots:
	void useButton(int button);
	void vibrate(int msecs);

signals:
	void buttonPressed(int button);
	void buttonReleased(int button);

	void activeChanged();
	void notificationsChanged();

private:
	WatchServer *_server;
	Watch* _watch;
	bool _active;
	QSet<int> _usedButtons;

	void activate();
	void deactivate();

friend class DeclarativeWatchlet;
};

}

QML_DECLARE_TYPE(sowatch::DeclarativeWatchWrapper)

#endif // SOWATCH_DECLARATIVEWATCHWRAPPER_H