summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-12-06 18:03:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-09 12:58:41 +0100
commit37dd94a993e181b9a0e152de4eb4fb96959318bf (patch)
treeafcdc5feafbb608ea2d389342162b2f1669bcee9
parent1e71b35d9775b0abc9de0ce051bff400f0f1ba64 (diff)
downloadqttools-37dd94a993e181b9a0e152de4eb4fb96959318bf.tar.gz
qttools-37dd94a993e181b9a0e152de4eb4fb96959318bf.tar.bz2
qttools-37dd94a993e181b9a0e152de4eb4fb96959318bf.zip
Improve error messages when qhp files are messed up
Hopefully this saves me and everyone time when mixing up project names resulting in empty namespaces in .qhp projects. Change-Id: Ib4151225011c866219504c1fdbaadd17d387500a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
-rw-r--r--src/assistant/help/qhelpprojectdata.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/assistant/help/qhelpprojectdata.cpp b/src/assistant/help/qhelpprojectdata.cpp
index ee86f78a..27fc3a06 100644
--- a/src/assistant/help/qhelpprojectdata.cpp
+++ b/src/assistant/help/qhelpprojectdata.cpp
@@ -60,6 +60,7 @@ public:
QString virtualFolder;
QString namespaceName;
+ QString fileName;
QString rootPath;
QStringList fileList;
@@ -85,7 +86,7 @@ private:
void QHelpProjectDataPrivate::raiseUnknownTokenError()
{
- raiseError(QCoreApplication::translate("QHelpProject", "Unknown token."));
+ raiseError(QCoreApplication::translate("QHelpProject", "Unknown token in file \"%1\".").arg(fileName));
}
void QHelpProjectDataPrivate::readData(const QByteArray &contents)
@@ -119,12 +120,12 @@ void QHelpProjectDataPrivate::readProject()
virtualFolder = readElementText();
if (!hasValidSyntax(QLatin1String("test"), virtualFolder))
raiseError(QCoreApplication::translate("QHelpProject",
- "Virtual folder has invalid syntax."));
+ "Virtual folder has invalid syntax in file: \"%1\"").arg(fileName));
} else if (name() == QLatin1String("namespace")) {
namespaceName = readElementText();
if (!hasValidSyntax(namespaceName, QLatin1String("test")))
raiseError(QCoreApplication::translate("QHelpProject",
- "Namespace has invalid syntax."));
+ "Namespace \"%1\" has invalid syntax in file: \"%2\"").arg(namespaceName, fileName));
} else if (name() == QLatin1String("customFilter")) {
readCustomFilter();
} else if (name() == QLatin1String("filterSection")) {
@@ -143,10 +144,10 @@ void QHelpProjectDataPrivate::readProject()
} else if (isEndElement() && name() == QLatin1String("QtHelpProject")) {
if (namespaceName.isEmpty())
raiseError(QCoreApplication::translate("QHelpProject",
- "Missing namespace in QtHelpProject."));
+ "Missing namespace in QtHelpProject file: \"%1\"").arg(fileName));
else if (virtualFolder.isEmpty())
raiseError(QCoreApplication::translate("QHelpProject",
- "Missing virtual folder in QtHelpProject"));
+ "Missing virtual folder in QtHelpProject file: \"%1\"").arg(fileName));
break;
}
}
@@ -374,6 +375,7 @@ QHelpProjectData::~QHelpProjectData()
*/
bool QHelpProjectData::readData(const QString &fileName)
{
+ d->fileName = fileName;
d->rootPath = QFileInfo(fileName).absolutePath();
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly)) {