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
KDevelop
KDevelop
Commits
64b4ce9d
Commit
64b4ce9d
authored
Nov 09, 2021
by
Milian Wolff
Browse files
Use ProblemScope in favor of plan int in more places
Improved typesafety and easier to understand code.
parent
b0e65127
Changes
6
Hide whitespace changes
Inline
Side-by-side
kdevplatform/shell/problemmodel.cpp
View file @
64b4ce9d
...
...
@@ -377,7 +377,7 @@ bool ProblemModel::showImports() const
return
d
->
m_problems
->
showImports
();
}
void
ProblemModel
::
setScope
(
int
scope
)
void
ProblemModel
::
setScope
(
ProblemScope
scope
)
{
Q_D
(
ProblemModel
);
...
...
kdevplatform/shell/problemmodel.h
View file @
64b4ce9d
...
...
@@ -13,8 +13,10 @@
#include
<shell/problem.h>
#include
<language/editor/documentrange.h>
#include
"problemconstants.h"
namespace
KDevelop
{
class
IDocument
;
class
IDocument
;
class
IndexedString
;
class
ProblemStore
;
class
ProblemModelPrivate
;
...
...
@@ -163,7 +165,7 @@ public Q_SLOTS:
void
setShowImports
(
bool
showImports
);
/// Sets the scope filter
void
setScope
(
int
scope
);
void
setScope
(
ProblemScope
scope
);
/// Sets the severity filter
void
setSeverity
(
int
severity
);
///old-style severity filtering
...
...
kdevplatform/shell/problemstore.cpp
View file @
64b4ce9d
...
...
@@ -195,22 +195,21 @@ WatchedDocumentSet* ProblemStore::documents() const
return
d
->
m_documents
;
}
void
ProblemStore
::
setScope
(
int
scope
)
void
ProblemStore
::
setScope
(
ProblemScope
scope
)
{
Q_D
(
ProblemStore
);
auto
cast_scope
=
static_cast
<
ProblemScope
>
(
scope
);
bool
showImports
=
false
;
if
(
d
->
m_documents
)
{
if
(
cast_
scope
==
d
->
m_documents
->
scope
())
if
(
scope
==
d
->
m_documents
->
scope
())
return
;
showImports
=
d
->
m_documents
->
showImports
();
delete
d
->
m_documents
;
}
switch
(
cast_
scope
)
{
switch
(
scope
)
{
case
CurrentDocument
:
d
->
m_documents
=
new
CurrentDocumentSet
(
d
->
m_currentDocument
,
this
);
break
;
...
...
@@ -237,7 +236,7 @@ void ProblemStore::setScope(int scope)
emit
changed
();
}
int
ProblemStore
::
scope
()
const
ProblemScope
ProblemStore
::
scope
()
const
{
Q_D
(
const
ProblemStore
);
...
...
kdevplatform/shell/problemstore.h
View file @
64b4ce9d
...
...
@@ -11,6 +11,8 @@
#include
<shell/shellexport.h>
#include
<interfaces/iproblem.h>
#include
"problemconstants.h"
namespace
KDevelop
{
...
...
@@ -95,10 +97,10 @@ public:
WatchedDocumentSet
*
documents
()
const
;
/// Sets the scope filter
void
setScope
(
int
scope
);
void
setScope
(
ProblemScope
scope
);
/// Returns the current scope
int
scope
()
const
;
ProblemScope
scope
()
const
;
/// Sets the grouping method
virtual
void
setGrouping
(
int
grouping
);
...
...
plugins/problemreporter/problemsview.cpp
View file @
64b4ce9d
...
...
@@ -461,7 +461,7 @@ void ProblemsView::handleSeverityActionToggled()
(
m_hintSeverityAction
->
isChecked
()
?
IProblem
::
Hint
:
IProblem
::
Severities
())
);
}
void
ProblemsView
::
setScope
(
int
scope
)
void
ProblemsView
::
setScope
(
ProblemScope
scope
)
{
m_scopeMenu
->
setText
(
i18nc
(
"@title:menu"
,
"Scope: %1"
,
m_scopeMenu
->
menu
()
->
actions
().
at
(
scope
)
->
text
()));
...
...
plugins/problemreporter/problemsview.h
View file @
64b4ce9d
...
...
@@ -9,6 +9,8 @@
#include
<interfaces/itoolviewactionlistener.h>
#include
<problemconstants.h>
#include
<QWidget>
class
ProblemTreeView
;
...
...
@@ -73,7 +75,7 @@ private:
void
updateActions
();
void
handleSeverityActionToggled
();
void
setScope
(
int
scope
);
void
setScope
(
ProblemScope
scope
);
/// Create a view for the model and add to the tabbed widget
void
addModel
(
const
ModelData
&
data
);
...
...
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