From 5c2d700cb134b34dbfb5b92e33ab86d1f6b03125 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Tue, 19 Feb 2013 20:18:01 +0100 Subject: Make Virtual and Default tag mutually exclusive. Call m_vars value function directly. 1; To prevent recursive calls in case of key "Default". 2; To avoid the extra function call to fetch values from m_vars in case of other values set in the object. Change-Id: I8f40b53704d1f314071d7060d0c92829310c262d Reviewed-by: Tim Jenssen Reviewed-by: Niels Weber --- tools/common/repositorygen.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tools/common/repositorygen.cpp') diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index 76d547526..733323a79 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -172,13 +172,20 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt blackList << QLatin1String("UserInterfaces") << QLatin1String("Translations") << QLatin1String("Licenses") << QLatin1String("Name"); + bool foundDefault = false; + bool foundVirtual = false; const QDomNodeList childNodes = package.childNodes(); for (int i = 0; i < childNodes.count(); ++i) { const QDomNode node = childNodes.at(i); const QString key = node.nodeName(); - // just skip comments and some tags... + + if (key == QLatin1String("Default")) + foundDefault = true; + if (key == QLatin1String("Virtual")) + foundVirtual = true; if (node.isComment() || blackList.contains(key)) - continue; + continue; // just skip comments and some tags... + const QString value = node.toElement().text(); QDomElement element = doc.createElement(key); for (int i = 0; i < node.attributes().size(); i++) { @@ -188,6 +195,11 @@ void QInstallerTools::generateMetaDataDirectory(const QString &outDir, const QSt update.appendChild(element).appendChild(doc.createTextNode(value)); } + if (foundDefault && foundVirtual) { + throw QInstaller::Error(QString::fromLatin1("Error: and elements are " + "mutually exclusive. File: '%0'").arg(packageXmlPath)); + } + // get the size of the data quint64 componentSize = 0; quint64 compressedComponentSize = 0; -- cgit v1.2.3