summaryrefslogtreecommitdiff
path: root/libsowatch/configkey.h
blob: ef7665ee6f88d300bbc9bc24bda3b3cb3e3f1947 (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
#ifndef SOWATCH_CONFIGKEY_H
#define SOWATCH_CONFIGKEY_H

#include <QtCore/QObject>
#include <QtCore/QVariant>
#include <QtCore/QStringList>
#include "sowatch_global.h"

namespace sowatch
{

class SOWATCH_EXPORT ConfigKey : public QObject
{
	Q_OBJECT
	Q_PROPERTY(QString key READ key CONSTANT)
	Q_PROPERTY(QVariant value READ value WRITE set RESET unset NOTIFY changed USER true)
	Q_PROPERTY(QStringList dirs READ dirs)
	Q_PROPERTY(QStringList keys READ keys)

public:
	ConfigKey(QObject *parent = 0);

	virtual QString key() const = 0;

	virtual QVariant value() const = 0;
	virtual void set(const QVariant& value) = 0;
	virtual void unset() = 0;
	virtual bool isSet() const = 0;
	virtual bool isDir() const = 0;

	virtual QVariant value(const QString& subkey) const = 0;
	virtual QVariant value(const QString& subkey, const QVariant& def) const = 0;
	virtual void set(const QString& subkey, const QVariant& value) = 0;
	virtual void unset(const QString& subkey) = 0;
	virtual bool isSet(const QString& subkey) const = 0;
	virtual bool isDir(const QString& subkey) const = 0;

	virtual QStringList dirs() const = 0;
	virtual QStringList keys() const = 0;

	virtual void recursiveUnset() = 0;

	virtual ConfigKey* getSubkey(const QString& subkey, QObject *parent = 0) const = 0;

signals:
	void changed();
	void subkeyChanged(const QString& subkey);
};

}

#endif // SOWATCH_CONFIGKEY_H