Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Schöps
kdevelop
Commits
8aa7bb2a
Commit
8aa7bb2a
authored
Jun 26, 2019
by
Friedrich W. H. Kossebau
Browse files
projectfilter: port foreach -> range-based for
parent
9756bab6
Changes
5
Hide whitespace changes
Inline
Side-by-side
plugins/projectfilter/comboboxdelegate.cpp
View file @
8aa7bb2a
...
...
@@ -52,7 +52,7 @@ void ComboBoxDelegate::setEditorData(QWidget* editor, const QModelIndex& index)
const
QString
&
current
=
index
.
data
().
toString
();
int
currentIndex
=
-
1
;
int
i
=
0
;
for
each
(
const
Item
&
item
,
m_items
)
{
for
(
const
Item
&
item
:
m_items
)
{
if
(
item
.
text
==
current
)
{
currentIndex
=
i
;
}
...
...
plugins/projectfilter/projectfilter.cpp
View file @
8aa7bb2a
...
...
@@ -67,7 +67,7 @@ bool ProjectFilter::isValid( const Path &path, const bool isFolder ) const
}
bool
isValid
=
true
;
for
each
(
const
Filter
&
filter
,
m_filters
)
{
for
(
const
Filter
&
filter
:
m_filters
)
{
if
(
isFolder
&&
!
(
filter
.
targets
&
Filter
::
Folders
))
{
continue
;
}
else
if
(
!
isFolder
&&
!
(
filter
.
targets
&
Filter
::
Files
))
{
...
...
plugins/projectfilter/projectfilterconfigpage.cpp
View file @
8aa7bb2a
...
...
@@ -170,7 +170,8 @@ void ProjectFilterConfigPage::checkFilters()
{
// check for errors, only show one error at once
QString
errorText
;
foreach
(
const
Filter
&
filter
,
m_model
->
filters
())
{
const
auto
filters
=
m_model
->
filters
();
for
(
const
Filter
&
filter
:
filters
)
{
const
QString
&
pattern
=
filter
.
pattern
.
pattern
();
if
(
pattern
.
isEmpty
())
{
errorText
=
i18n
(
"A filter with an empty pattern will match all items. Use <code>
\"
*
\"
</code> to make this explicit."
);
...
...
plugins/projectfilter/projectfilterprovider.cpp
View file @
8aa7bb2a
...
...
@@ -53,7 +53,8 @@ ProjectFilterProvider::ProjectFilterProvider( QObject* parent, const QVariantLis
this
,
&
ProjectFilterProvider
::
projectAboutToBeOpened
);
// initialize the filters for each project
foreach
(
IProject
*
project
,
core
()
->
projectController
()
->
projects
())
{
const
auto
projects
=
core
()
->
projectController
()
->
projects
();
for
(
IProject
*
project
:
projects
)
{
updateProjectFilters
(
project
);
}
}
...
...
plugins/projectfilter/tests/test_projectfilter.cpp
View file @
8aa7bb2a
...
...
@@ -359,10 +359,10 @@ static QVector<BenchData> createBenchData(const Path& base, int folderDepth, int
void
TestProjectFilter
::
bench
()
{
QFETCH
(
TestFilter
,
filter
);
QFETCH
(
QVector
<
BenchData
>
,
data
);
QFETCH
(
const
QVector
<
BenchData
>
,
data
);
QBENCHMARK
{
for
each
(
const
BenchData
&
bench
,
data
)
{
for
(
const
BenchData
&
bench
:
data
)
{
filter
->
isValid
(
bench
.
path
,
bench
.
isFolder
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment