2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #ifndef MASTERSETTINGS_H
12 #define MASTERSETTINGS_H
21 class MasterSettings
: public QObject
32 const char* dependency
;
35 Observer(QObject
* obj
, const char* meth
, const char* dep
)
40 typedef std::list
<Observer
> ObserverList
;
42 ObserverList m_observers
;
44 mutable QDomDocument m_doc
;
46 void setupObserver(Observer
&);
48 void objectDestroyed(QObject
* o
);
51 virtual QDomElement
node() const;
54 MasterSettings(const QString
& file
, LookupType lookup
= StandardDirsLookup
);
57 * Bind to the local configuration file.
63 * Set up an observer to be notified whenever settings change.
64 * \param observer The object to be notified.
65 * \param method The callback method for the notification, specified as a C string.
66 * \note @a method should be just the method name (no parentheses, no SLOT macro).
68 void onChange(QObject
* observer
, const char* method
);
71 * Set up an observer to be notified whenever settings change.
72 * \param observer The object to be notified.
73 * \param method The callback method for the notification, specified as a C string.
74 * \param dependency A C string representing a type (inheriting from QObject). Objects
75 * of this type will be notified before @a observer.
76 * \note @a method should be just the method name (no parentheses, no SLOT macro).
78 void onChange(QObject
* observer
, const char* method
, const char* dependency
);
82 QString
filename() const;
85 MasterSettings
& settings();
87 #endif // MASTERSETTINGS_H