summaryrefslogtreecommitdiff
path: root/sowatchd/daemon.h
blob: 45a2d60dce3f704716c6b3852d97c069904ac9a4 (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
#ifndef WATCHDAEMON_H
#define WATCHDAEMON_H

#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QtCore/QSignalMapper>

#include <sowatch.h>

#include "watchhandler.h"

namespace sowatch
{

class Daemon : public QObject
{
	Q_OBJECT
public:
	explicit Daemon(QObject *parent = 0);

	Q_INVOKABLE QString getWatchStatus(const QString& name);

public slots:
	void terminate();

signals:
	void WatchStatusChanged(const QString &watch, const QString &status);

private:
	ConfigKey* _config;
	ConfigKey* _watches_list;
	QMap<QString, WatchHandler*> _watches;
	QSignalMapper *_status_mapper;

	void startWatch(const QString& name);
	void stopWatch(const QString& name);

private slots:
	void startEnabledWatches();
	void handleSettingsChanged(const QString& subkey);
	void handleWatchStatusChange(const QString& watch);
};

}

#endif // WATCHDAEMON_H