summaryrefslogtreecommitdiffstats
path: root/sigscript/Config.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-12-31 09:35:11 -0500
committerBen Boeckel <MathStuf@gmail.com>2008-12-31 09:35:11 -0500
commit541ed4742c6368cc36c35ca74dba09b9d108283b (patch)
tree67e5d39723bcb7638eecaf0687baf16ed513ad00 /sigscript/Config.cpp
parent06387e2d3c6e4396560dfa7d6fe86d4854089858 (diff)
downloadsigen-541ed4742c6368cc36c35ca74dba09b9d108283b.tar.gz
sigen-541ed4742c6368cc36c35ca74dba09b9d108283b.tar.xz
sigen-541ed4742c6368cc36c35ca74dba09b9d108283b.zip
Changed Config to use Config as parents instead of plain QObject
Diffstat (limited to 'sigscript/Config.cpp')
-rw-r--r--sigscript/Config.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/sigscript/Config.cpp b/sigscript/Config.cpp
index 54774720..70644be5 100644
--- a/sigscript/Config.cpp
+++ b/sigscript/Config.cpp
@@ -18,9 +18,13 @@
// Header include
#include "Config.h"
-Sigscript::Config::Config(QObject* parent) :
+// Qt includes
+#include <QtCore/QSet>
+
+Sigscript::Config::Config(Config* parent) :
QObject(parent),
- m_lock(QReadWriteLock::Recursive)
+ m_lock(QReadWriteLock::Recursive),
+ m_parent(parent)
{
}
@@ -78,12 +82,12 @@ QVariant Sigscript::Config::value(const QString& name, const bool recursive) con
}
if (recursive)
{
- QObject* par = parent();
+ Config* par = m_parent;
while (par)
{
- if (qobject_cast<Config*>(par) && qobject_cast<Config*>(par)->hasValue(name))
- return qobject_cast<Config*>(par)->value(name);
- par = par->parent();
+ if (par->hasValue(name))
+ return par->value(name);
+ par = par->m_parent;
}
}
return QVariant();
@@ -94,8 +98,8 @@ bool Sigscript::Config::hasValue(const QString& name, const bool recursive) cons
QReadLocker locker(&m_lock);
if (m_values.contains(name))
return !(m_values[name].second & (Deleted | Hidden));
- if (recursive && qobject_cast<Config*>(parent()))
- return qobject_cast<Config*>(parent())->hasValue(name, true);
+ if (recursive)
+ return m_parent->hasValue(name, true);
return false;
}