Commit f054f4da authored by Igor Kushnir's avatar Igor Kushnir

ParseProjectJob: don't depend on IProjectController

Both the code and the documentation of ParseProjectJob are simplified by
letting ProjectController call its parseAllProjectSources() function.

GIT_SILENT
parent 960a39e9
......@@ -23,7 +23,6 @@
#include <interfaces/icore.h>
#include <interfaces/ilanguagecontroller.h>
#include <interfaces/idocumentcontroller.h>
#include <interfaces/iprojectcontroller.h>
#include <interfaces/iproject.h>
#include <interfaces/icompletionsettings.h>
......@@ -42,15 +41,15 @@ using namespace KDevelop;
class KDevelop::ParseProjectJobPrivate
{
public:
explicit ParseProjectJobPrivate(bool forceUpdate, bool forceAll)
explicit ParseProjectJobPrivate(bool forceUpdate, bool parseAllProjectSources)
: forceUpdate(forceUpdate)
, forceAll(forceAll)
, parseAllProjectSources{parseAllProjectSources}
{
}
int updated = 0;
bool forceUpdate;
bool forceAll;
bool parseAllProjectSources;
QSet<IndexedString> filesToParse;
};
......@@ -65,12 +64,12 @@ ParseProjectJob::~ParseProjectJob()
ICore::self()->languageController()->backgroundParser()->revertAllRequests(this);
}
ParseProjectJob::ParseProjectJob(IProject* project, bool forceUpdate, bool forceAll)
: d_ptr{new ParseProjectJobPrivate(forceUpdate, forceAll)}
ParseProjectJob::ParseProjectJob(IProject* project, bool forceUpdate, bool parseAllProjectSources)
: d_ptr{new ParseProjectJobPrivate(forceUpdate, parseAllProjectSources)}
{
Q_D(ParseProjectJob);
if (forceAll || ICore::self()->projectController()->parseAllProjectSources()) {
if (parseAllProjectSources) {
d->filesToParse = project->fileSet();
} else {
// In case we don't want to parse the whole project, still add all currently open files that belong to the project to the background-parser
......@@ -179,7 +178,7 @@ void ParseProjectJob::queueFilesToParse()
}
}
if (!d->forceAll && !ICore::self()->projectController()->parseAllProjectSources()) {
if (!d->parseAllProjectSources) {
return;
}
......
......@@ -29,19 +29,16 @@ class ReferencedTopDUContext;
class IProject;
class ParseProjectJobPrivate;
///A job that parses all project-files in the given project either
///when KDevelop is configured to parse all files at project import
///(see ProjectController:parseAllProjectSources()) or when the
///forceAll argument is true. That forceAll argument allows to
///trigger a full project reparse after the initial import, e.g.
///via the project manager's context menu.
/// A job that parses currently open files that belong to the given project, or all
/// files that belong to the project if the parseAllProjectSources argument is true.
class KDEVPLATFORMLANGUAGE_EXPORT ParseProjectJob
: public KJob
{
Q_OBJECT
public:
explicit ParseProjectJob(KDevelop::IProject* project, bool forceUpdate = false, bool forceAll = false);
explicit ParseProjectJob(KDevelop::IProject* project, bool forceUpdate = false,
bool parseAllProjectSources = false);
~ParseProjectJob() override;
void start() override;
bool doKill() override;
......
......@@ -1381,7 +1381,7 @@ void ProjectController::reparseProject(IProject* project, bool forceUpdate, bool
}
auto& job = d->m_parseJobs[project];
job = new ParseProjectJob(project, forceUpdate, forceAll);
job = new ParseProjectJob(project, forceUpdate, forceAll || parseAllProjectSources());
connect(job, &KJob::finished, this, [d, project](KJob* job) {
const auto it = d->m_parseJobs.constFind(project);
if (it != d->m_parseJobs.cend() && *it == job) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment