@@ -41,6 +41,9 @@ static const char RootPathNameAttrib[] = "name";
4141static const char IgnoreElementName[] = " ignore" ;
4242static const char IgnorePathName[] = " path" ;
4343static const char IgnorePathNameAttrib[] = " name" ;
44+ static const char ExcludeElementName[] = " exclude" ;
45+ static const char ExcludePathName[] = " path" ;
46+ static const char ExcludePathNameAttrib[] = " name" ;
4447
4548ProjectFile::ProjectFile (QObject *parent) :
4649 QObject(parent)
@@ -91,9 +94,14 @@ bool ProjectFile::Read(const QString &filename)
9194 if (insideProject && xmlReader.name () == DefinesElementName)
9295 ReadDefines (xmlReader);
9396
97+ // Find exclude list from inside project element
98+ if (insideProject && xmlReader.name () == ExcludeElementName)
99+ ReadExcludes (xmlReader);
100+
94101 // Find ignore list from inside project element
102+ // These are read for compatibility
95103 if (insideProject && xmlReader.name () == IgnoreElementName)
96- ReadIgnores (xmlReader);
104+ ReadExcludes (xmlReader);
97105
98106 break ;
99107
@@ -148,10 +156,10 @@ QStringList ProjectFile::GetCheckPaths() const
148156 return paths;
149157}
150158
151- QStringList ProjectFile::GetIgnoredPaths () const
159+ QStringList ProjectFile::GetExcludedPaths () const
152160{
153161 QStringList paths;
154- foreach (QString path, mIgnoredPaths )
162+ foreach (QString path, mExcludedPaths )
155163 {
156164 paths << QDir::fromNativeSeparators (path);
157165 }
@@ -291,7 +299,7 @@ void ProjectFile::ReadCheckPaths(QXmlStreamReader &reader)
291299 while (!allRead);
292300}
293301
294- void ProjectFile::ReadIgnores (QXmlStreamReader &reader)
302+ void ProjectFile::ReadExcludes (QXmlStreamReader &reader)
295303{
296304 QXmlStreamReader::TokenType type;
297305 bool allRead = false ;
@@ -301,19 +309,29 @@ void ProjectFile::ReadIgnores(QXmlStreamReader &reader)
301309 switch (type)
302310 {
303311 case QXmlStreamReader::StartElement:
304- // Read define-elements
305- if (reader.name ().toString () == IgnorePathName)
312+ // Read exclude-elements
313+ if (reader.name ().toString () == ExcludePathName)
314+ {
315+ QXmlStreamAttributes attribs = reader.attributes ();
316+ QString name = attribs.value (" " , ExcludePathNameAttrib).toString ();
317+ if (!name.isEmpty ())
318+ mExcludedPaths << name;
319+ }
320+ // Read ignore-elements - deprecated but support reading them
321+ else if (reader.name ().toString () == IgnorePathName)
306322 {
307323 QXmlStreamAttributes attribs = reader.attributes ();
308324 QString name = attribs.value (" " , IgnorePathNameAttrib).toString ();
309325 if (!name.isEmpty ())
310- mIgnoredPaths << name;
326+ mExcludedPaths << name;
311327 }
312328 break ;
313329
314330 case QXmlStreamReader::EndElement:
315331 if (reader.name ().toString () == IgnoreElementName)
316332 allRead = true ;
333+ if (reader.name ().toString () == ExcludeElementName)
334+ allRead = true ;
317335 break ;
318336
319337 // Not handled
@@ -347,9 +365,9 @@ void ProjectFile::SetCheckPaths(const QStringList &paths)
347365 mPaths = paths;
348366}
349367
350- void ProjectFile::SetIgnoredPaths (const QStringList &paths)
368+ void ProjectFile::SetExcludedPaths (const QStringList &paths)
351369{
352- mIgnoredPaths = paths;
370+ mExcludedPaths = paths;
353371}
354372
355373bool ProjectFile::Write (const QString &filename)
@@ -410,13 +428,13 @@ bool ProjectFile::Write(const QString &filename)
410428 xmlWriter.writeEndElement ();
411429 }
412430
413- if (!mIgnoredPaths .isEmpty ())
431+ if (!mExcludedPaths .isEmpty ())
414432 {
415- xmlWriter.writeStartElement (IgnoreElementName );
416- foreach (QString path, mIgnoredPaths )
433+ xmlWriter.writeStartElement (ExcludeElementName );
434+ foreach (QString path, mExcludedPaths )
417435 {
418- xmlWriter.writeStartElement (IgnorePathName );
419- xmlWriter.writeAttribute (IgnorePathNameAttrib , path);
436+ xmlWriter.writeStartElement (ExcludePathName );
437+ xmlWriter.writeAttribute (ExcludePathNameAttrib , path);
420438 xmlWriter.writeEndElement ();
421439 }
422440 xmlWriter.writeEndElement ();
0 commit comments