summaryrefslogtreecommitdiff
path: root/sowatchd/watchhandler.h
blob: 83f0a67455d52111d36322308f46b8721f1208af (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
#ifndef WATCHHANDLER_H
#define WATCHHANDLER_H

#include <QtCore/QObject>
#include <QtCore/QList>

#include <sowatch.h>

namespace sowatch
{

class WatchHandler : public QObject
{
	Q_OBJECT
	Q_PROPERTY(QString status READ status NOTIFY statusChanged)

public:
	explicit WatchHandler(ConfigKey *config, QObject *parent = 0);

	QString status() const;

signals:
	void statusChanged();

private:
	Watchlet* createWatchlet(const QString& id);
	void deleteWatchletAt(int index);

private slots:
	void updateWatchlets();
	void updateProviders();
	void handleConfigSubkeyChanged(const QString& key);
	void handleDriverUnloaded(const QString& id);
	void handleWatchletUnloaded(const QString& id);
	void handleProviderUnloaded(const QString& id);

private:
	ConfigKey *_config;
	Watch *_watch;
	WatchServer *_server;
	QList<QString> _watchlet_order;
	QMap<QString, Watchlet*> _watchlets;
	QMap<QString, NotificationProvider*> _providers;
};

}

#endif // WATCHHANDLER_H