summaryrefslogtreecommitdiff
path: root/libsowatch/gconfkey.h
blob: d2bf088c6d6e4fd81241e09e6f12c27ae39c9a0b (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
#ifndef SOWATCH_GCONFKEY_H
#define SOWATCH_GCONFKEY_H

#include "configkey.h"

namespace sowatch
{

class SOWATCH_EXPORT GConfKey : public ConfigKey
{
	Q_OBJECT

public:
	GConfKey(const QString& key = QString(), QObject *parent = 0);
	~GConfKey();

	QString key() const;
	void setKey(const QString &key);

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

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

	QStringList dirs() const;
	QStringList keys() const;

	void recursiveUnset();

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

	void notifyChanged(const QString& key);

protected:
	void connectNotify(const char *signal);

private:
	QString _key;
	uint _notify;

	QString fullpath(const QString& subkey = QString()) const;
	QByteArray getNativeKey() const;
};

}

#endif // SOWATCH_CONFIGKEY_H