summaryrefslogtreecommitdiff
path: root/libsowatch/declarativewatchwrapper.h
blob: 42746ec07aa4da842bef01bbb1900645b621f38b (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
#ifndef SOWATCH_DECLARATIVEWATCHWRAPPER_H
#define SOWATCH_DECLARATIVEWATCHWRAPPER_H

#include <QtDeclarative/QtDeclarative>

namespace sowatch
{

class Watch;
class DeclarativeWatchlet;

class DeclarativeWatchWrapper : public QObject
{
    Q_OBJECT
	Q_PROPERTY(QString model READ model CONSTANT)
	Q_PROPERTY(bool active READ active NOTIFY activeChanged)

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

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

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

	void activeChanged();

protected:
	Watch* _watch;
	bool _active;

	void activate();
	void deactivate();

friend class DeclarativeWatchlet;
};

}

QML_DECLARE_TYPE(sowatch::DeclarativeWatchWrapper)

#endif // SOWATCH_DECLARATIVEWATCHWRAPPER_H