roviz  0.7
Code Documentation of roviz
settings_scope.h
1 #ifndef SETTINGS_SCOPE_H_
2 #define SETTINGS_SCOPE_H_
3 
4 #include <qvariant.h>
5 #include <qdom.h>
6 
7 #include "appcore.h"
8 
21 class ITEMFRAMEWORK_EXPORT SettingsScope : public QObject
22 {
23  Q_OBJECT
24  Q_PROPERTY(QString name READ name WRITE setName)
25 
26 public:
33  explicit SettingsScope(const QString& name, SettingsScope* parent = 0);
37  virtual ~SettingsScope();
38 
58  QVariant value(const QString& key, QVariant defaultValue = QVariant(),
59  bool searchAll = true) const;
60 
75  void setValue(const QString& key, const QVariant& value);
76 
89  const QString& name() const;
97  void setName(const QString& name);
98 
107  QString scopeId() const;
108 
117  {
118  return qobject_cast<SettingsScope*>(parent());
119  }
120 
126  void setParentScope(SettingsScope* newParent);
127 
133  static SettingsScope* applicationScope();
134 
143  static SettingsScope* globalScope();
144 
158  QHash<QString, QVariant> allSettings(bool recurse = false);
159 
169  bool load(const QDomElement& parent);
176  bool save(QDomDocument& doc, QDomElement& parent);
177 
187  static void init();
197  static void deinit();
198 
199 signals:
212  void valueChanged(const QString& key, const QVariant& value);
222  void scopeChanged();
223 
229  void parentScopeChanged(SettingsScope *old);
230 
231 private:
232  QScopedPointer<class SettingsScopePrivate> d_ptr;
233  Q_DECLARE_PRIVATE(SettingsScope);
234  Q_DISABLE_COPY(SettingsScope);
235 };
236 
237 #endif /* SETTINGS_SCOPE_H_ */
The SettingsScope class acts as a container for scoped settings.
Definition: settings_scope.h:21
SettingsScope * parentScope() const
Returns the parent setting scope or NULL, if this settings scope has no parent settings scope...
Definition: settings_scope.h:116