summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/settings.cpp
diff options
context:
space:
mode:
authorkh1 <qt-info@nokia.com>2011-06-23 14:06:15 +0200
committerkh1 <qt-info@nokia.com>2011-06-23 14:06:51 +0200
commitea3360f47f4729f60bb546f42be1e33ccc3db71c (patch)
tree58e81d12dda6dd53a3f41a8dcd6229c2b3ba2ecf /installerbuilder/libinstaller/settings.cpp
parente7dc0f9095390abf3b22870438d611d3834aafc4 (diff)
Add support to have gui pages configurable.
Now we can expose all objects thru the config.xml and set there values as well. Should help to reduce the need to change code inside the ui classes.
Diffstat (limited to 'installerbuilder/libinstaller/settings.cpp')
-rw-r--r--installerbuilder/libinstaller/settings.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/installerbuilder/libinstaller/settings.cpp b/installerbuilder/libinstaller/settings.cpp
index 41c022bc3..e75f67c86 100644
--- a/installerbuilder/libinstaller/settings.cpp
+++ b/installerbuilder/libinstaller/settings.cpp
@@ -86,6 +86,23 @@ static QList<Repository> readRemoteRepositories(QXmlStreamReader &reader)
return set.toList();
}
+static QHash<QString, QVariantHash> readPages(QXmlStreamReader &reader)
+{
+ QHash<QString, QVariantHash> hash;
+ while (reader.readNextStartElement()) {
+ if (reader.name() == QLatin1String("Page")) {
+ QVariantHash pageElements;
+ QString pageName = reader.attributes().value(QLatin1String("name")).toString();
+ while (reader.readNextStartElement()) {
+ pageElements.insert(reader.name().toString(), reader
+ .readElementText(QXmlStreamReader::SkipChildElements));
+ }
+ hash.insert(pageName, pageElements);
+ }
+ }
+ return hash;
+}
+
// -- Settings::Private
@@ -147,7 +164,7 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
}
QStringList blackList;
- blackList << scPrivateKey << scPublicKey << scRemoteRepositories << scSigningCertificate;
+ blackList << scPrivateKey << scPublicKey << scRemoteRepositories << scSigningCertificate << scPages;
Settings s;
s.d->m_data.insert(scPrefix, prefix);
@@ -165,6 +182,13 @@ Settings Settings::fromFileAndPrefix(const QString &path, const QString &prefix)
foreach (const Repository &repository, repositories)
s.d->m_data.insertMulti(scRepositories, QVariant().fromValue(repository));
}
+
+ if (name == scPages) {
+ QHash<QString, QVariantHash> pages = readPages(reader);
+ const QStringList &keys = pages.keys();
+ foreach (const QString &key, keys)
+ s.d->m_data.insert(key, pages.value(key));
+ }
} else {
if (s.d->m_data.contains(name))
throw Error(QObject::tr("Multiple %1 elements found, but only one allowed.").arg(name));