summaryrefslogtreecommitdiffstats
path: root/installerbuilder
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
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')
-rw-r--r--installerbuilder/libinstaller/qinstallerglobal.h1
-rw-r--r--installerbuilder/libinstaller/settings.cpp26
2 files changed, 26 insertions, 1 deletions
diff --git a/installerbuilder/libinstaller/qinstallerglobal.h b/installerbuilder/libinstaller/qinstallerglobal.h
index 10f9184d6..c2f9eb45e 100644
--- a/installerbuilder/libinstaller/qinstallerglobal.h
+++ b/installerbuilder/libinstaller/qinstallerglobal.h
@@ -98,6 +98,7 @@ static const QLatin1String scSortingPriority("SortingPriority");
static const QLatin1String scIcon("Icon");
static const QLatin1String scLogo("Logo");
static const QLatin1String scTitle("Title");
+static const QLatin1String scPages("Pages");
static const QLatin1String scPrefix("Prefix");
static const QLatin1String scLogoSmall("LogoSmall");
static const QLatin1String scPublisher("Publisher");
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));