Skip to content

Commit 4998c91

Browse files
committed
GUI: Rename Ignore-feature to Exclude-feature.
Exclude is the correct term to use when removing paths from the list of checked items. Ignore as a term was a poor choise to begin with. XML file reading still recognizes and reads the 'ignore' element but writes 'exclude' element. Ticket: danmar#2995 (GUI: Rename ignore-feature to exclude-feature)
1 parent c7cb38b commit 4998c91

File tree

8 files changed

+66
-48
lines changed

8 files changed

+66
-48
lines changed

cppcheck.cppcheck

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<dir name="gui/"/>
1414
<dir name="test/"/>
1515
</paths>
16-
<ignore>
16+
<exclude>
1717
<path name="gui/temp/"/>
1818
<path name="test/test.cxx"/>
19-
</ignore>
19+
</exclude>
2020
</project>

gui/filelist.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void FileList::AddPathList(const QStringList &paths)
9696

9797
QStringList FileList::GetFileList() const
9898
{
99-
if (mIgnoredPaths.empty())
99+
if (mExcludedPaths.empty())
100100
{
101101
QStringList names;
102102
foreach(QFileInfo item, mFileList)
@@ -108,16 +108,16 @@ QStringList FileList::GetFileList() const
108108
}
109109
else
110110
{
111-
return ApplyIgnoreList();
111+
return ApplyExcludeList();
112112
}
113113
}
114114

115-
void FileList::AddIngoreList(const QStringList &paths)
115+
void FileList::AddExcludeList(const QStringList &paths)
116116
{
117-
mIgnoredPaths = paths;
117+
mExcludedPaths = paths;
118118
}
119119

120-
QStringList FileList::ApplyIgnoreList() const
120+
QStringList FileList::ApplyExcludeList() const
121121
{
122122
QStringList paths;
123123
foreach(QFileInfo item, mFileList)
@@ -131,17 +131,17 @@ QStringList FileList::ApplyIgnoreList() const
131131

132132
bool FileList::Match(const QString &path) const
133133
{
134-
for (int i = 0; i < mIgnoredPaths.size(); i++)
134+
for (int i = 0; i < mExcludedPaths.size(); i++)
135135
{
136-
if (mIgnoredPaths[i].endsWith('/'))
136+
if (mExcludedPaths[i].endsWith('/'))
137137
{
138-
const QString pathignore("/" + mIgnoredPaths[i]);
139-
if (path.indexOf(pathignore) != -1)
138+
const QString pathexclude("/" + mExcludedPaths[i]);
139+
if (path.indexOf(pathexclude) != -1)
140140
return true;
141141
}
142142
else
143143
{
144-
if (path.endsWith(mIgnoredPaths[i]))
144+
if (path.endsWith(mExcludedPaths[i]))
145145
return true;
146146
}
147147
}

gui/filelist.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class FileList
6565
QStringList GetFileList() const;
6666

6767
/**
68-
* @brief Add list of paths to ignore list.
69-
* @param paths Paths to ignore.
68+
* @brief Add list of paths to exclusion list.
69+
* @param paths Paths to exclude.
7070
*/
71-
void AddIngoreList(const QStringList &paths);
71+
void AddExcludeList(const QStringList &paths);
7272

7373
protected:
7474

@@ -86,23 +86,23 @@ class FileList
8686

8787
/**
8888
* @brief Get filtered list of paths.
89-
* This method takes the list of paths and applies the ignore lists to
89+
* This method takes the list of paths and applies the exclude lists to
9090
* it. And then returns the list of paths that did not match the
91-
* ignore filters.
91+
* exclude filters.
9292
* @return Filtered list of paths.
9393
*/
94-
QStringList ApplyIgnoreList() const;
94+
QStringList ApplyExcludeList() const;
9595

9696
/**
97-
* @brief Test if path matches any of the ignore filters.
98-
* @param path Path to test against filters.
97+
* @brief Test if path matches any of the exclude filters.
98+
* @param path Path to test against exclude filters.
9999
* @return true if any of the filters matches, false otherwise.
100100
*/
101101
bool Match(const QString &path) const;
102102

103103
private:
104104
QFileInfoList mFileList;
105-
QStringList mIgnoredPaths;
105+
QStringList mExcludedPaths;
106106
};
107107

108108
#endif // FILELIST_H

gui/mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void MainWindow::DoCheckFiles(const QStringList &files)
267267
FileList pathList;
268268
pathList.AddPathList(files);
269269
if (mProject)
270-
pathList.AddIngoreList(mProject->GetProjectFile()->GetIgnoredPaths());
270+
pathList.AddExcludeList(mProject->GetProjectFile()->GetExcludedPaths());
271271
QStringList fileNames = pathList.GetFileList();
272272

273273
mUI.mResults->Clear();

gui/project.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void Project::Edit()
8585
dlg.SetDefines(defines);
8686
QStringList paths = mPFile->GetCheckPaths();
8787
dlg.SetPaths(paths);
88-
QStringList ignorepaths = mPFile->GetIgnoredPaths();
88+
QStringList ignorepaths = mPFile->GetExcludedPaths();
8989
dlg.SetIgnorePaths(ignorepaths);
9090

9191
int rv = dlg.exec();
@@ -100,7 +100,7 @@ void Project::Edit()
100100
QStringList paths = dlg.GetPaths();
101101
mPFile->SetCheckPaths(paths);
102102
QStringList ignorepaths = dlg.GetIgnorePaths();
103-
mPFile->SetIgnoredPaths(ignorepaths);
103+
mPFile->SetExcludedPaths(ignorepaths);
104104

105105
bool writeSuccess = mPFile->Write();
106106
if (!writeSuccess)

gui/projectfile.cpp

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ static const char RootPathNameAttrib[] = "name";
4141
static const char IgnoreElementName[] = "ignore";
4242
static const char IgnorePathName[] = "path";
4343
static const char IgnorePathNameAttrib[] = "name";
44+
static const char ExcludeElementName[] = "exclude";
45+
static const char ExcludePathName[] = "path";
46+
static const char ExcludePathNameAttrib[] = "name";
4447

4548
ProjectFile::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

355373
bool 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();

gui/projectfile.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030

3131
/**
32-
* @brief A class that reads and writes (TODO) project files.
32+
* @brief A class that reads and writes project files.
3333
* The project files contain project-specific settings for checking. For
3434
* example a list of include paths.
3535
*/
@@ -75,10 +75,10 @@ class ProjectFile : public QObject
7575
QStringList GetCheckPaths() const;
7676

7777
/**
78-
* @brief Get list of paths to ignore.
78+
* @brief Get list of paths to exclude from the check.
7979
* @return list of paths.
8080
*/
81-
QStringList GetIgnoredPaths() const;
81+
QStringList GetExcludedPaths() const;
8282

8383
/**
8484
* @brief Get filename for the project file.
@@ -117,10 +117,10 @@ class ProjectFile : public QObject
117117
void SetCheckPaths(const QStringList &paths);
118118

119119
/**
120-
* @brief Set list of paths to ignore.
120+
* @brief Set list of paths to exclude from the check.
121121
* @param defines List of paths.
122122
*/
123-
void SetIgnoredPaths(const QStringList &paths);
123+
void SetExcludedPaths(const QStringList &paths);
124124

125125
/**
126126
* @brief Write project file (to disk).
@@ -164,10 +164,10 @@ class ProjectFile : public QObject
164164
void ReadCheckPaths(QXmlStreamReader &reader);
165165

166166
/**
167-
* @brief Read lists of ignores.
167+
* @brief Read lists of excluded paths.
168168
* @param reader XML stream reader.
169169
*/
170-
void ReadIgnores(QXmlStreamReader &reader);
170+
void ReadExcludes(QXmlStreamReader &reader);
171171

172172
private:
173173

@@ -200,9 +200,9 @@ class ProjectFile : public QObject
200200
QStringList mPaths;
201201

202202
/**
203-
* @brief Paths ignored from the check.
203+
* @brief Paths excluded from the check.
204204
*/
205-
QStringList mIgnoredPaths;
205+
QStringList mExcludedPaths;
206206
};
207207
/// @}
208208
#endif // PROJECT_FILE_H

gui/projectfile.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
</widget>
213213
<widget class="QWidget" name="tab_3">
214214
<attribute name="title">
215-
<string>Ignore</string>
215+
<string>Exclude</string>
216216
</attribute>
217217
<layout class="QVBoxLayout" name="verticalLayout_9">
218218
<item>

0 commit comments

Comments
 (0)