Changeset View
Standalone View
kdevplatform/language/backgroundparser/parseprojectjob.h
Show All 22 Lines | |||||
23 | #include <language/languageexport.h> | 23 | #include <language/languageexport.h> | ||
24 | 24 | | |||
25 | #include <KJob> | 25 | #include <KJob> | ||
26 | 26 | | |||
27 | namespace KDevelop { | 27 | namespace KDevelop { | ||
28 | class ReferencedTopDUContext; | 28 | class ReferencedTopDUContext; | ||
29 | class IProject; | 29 | class IProject; | ||
30 | 30 | | |||
31 | ///A job that parses all project-files in the given project | 31 | ///A job that parses all project-files in the given project either | ||
32 | ///Deletes itself as soon as the project is deleted | 32 | ///when KDevelop is configured to parse all files at project import | ||
33 | ///(see ProjectController:parseAllProjectSources()) or when the | ||||
34 | ///forceAll argument is true. That forceAll argument allows to | ||||
35 | ///trigger a full project reparse after the initial import, e.g. | ||||
36 | ///via the project manager's context menu. | ||||
37 | ///ParseProjectJob instances delete themselves as soon as the project | ||||
38 | ///is deleted or when a new job is started. | ||||
33 | class KDEVPLATFORMLANGUAGE_EXPORT ParseProjectJob | 39 | class KDEVPLATFORMLANGUAGE_EXPORT ParseProjectJob | ||
34 | : public KJob | 40 | : public KJob | ||
35 | { | 41 | { | ||
36 | Q_OBJECT | 42 | Q_OBJECT | ||
37 | 43 | | |||
38 | public: | 44 | public: | ||
39 | explicit ParseProjectJob(KDevelop::IProject* project, bool forceUpdate = false); | 45 | explicit ParseProjectJob(KDevelop::IProject* project, bool forceUpdate = false, bool forceAll = false); | ||
mwolff: please document the difference between forcing an update and forcing all - I've figured it out… | |||||
rjvbb: I can imagine, I had to figure it out for myself again too :-/ | |||||
In fact, what do you think of making this explicit ParseProjectJob(KDevelop::IProject* project, bool forceUpdate = false, bool forceAll = ICore::self()->projectController()->parseAllProjectSources() ); You'd need to include 2 icore headers in this file but it'd make the behaviour of the option easier to explain. But we'd probably also need to do the same thing for the corresponding new argument to ProjectController::reparseProject() (but not iProjectController::reparseProjet(), I think)? rjvbb: In fact, what do you think of making this
```
explicit ParseProjectJob(KDevelop::IProject*… | |||||
please don't do that. rather, reuse ProjectController::reparseProject below instead of creating the job manually mwolff: please don't do that. rather, reuse `ProjectController::reparseProject` below instead of… | |||||
The idea was to move the "should we parse everything and why" logic outside of the function; it's not entirely relevant where the condition is moved to. Could be to this function's declaration, but could probably also be to the reparseProject definition. rjvbb: The idea was to move the "should we parse everything and why" logic outside of the function… | |||||
40 | ~ParseProjectJob() override; | 46 | ~ParseProjectJob() override; | ||
41 | void start() override; | 47 | void start() override; | ||
42 | bool doKill() override; | 48 | bool doKill() override; | ||
43 | 49 | | |||
44 | private Q_SLOTS: | 50 | private Q_SLOTS: | ||
45 | void deleteNow(); | 51 | void deleteNow(); | ||
46 | void updateReady(const KDevelop::IndexedString& url, const KDevelop::ReferencedTopDUContext& topContext); | 52 | void updateReady(const KDevelop::IndexedString& url, const KDevelop::ReferencedTopDUContext& topContext); | ||
47 | 53 | | |||
48 | private: | 54 | private: | ||
49 | void updateProgress(); | 55 | void updateProgress(); | ||
50 | 56 | | |||
51 | private: | 57 | private: | ||
52 | const QScopedPointer<class ParseProjectJobPrivate> d; | 58 | const QScopedPointer<class ParseProjectJobPrivate> d; | ||
53 | }; | 59 | }; | ||
mwolff: move that to the dptr | |||||
54 | } | 60 | } | ||
55 | 61 | | |||
56 | #endif // KDEVPLATFORM_PARSEPROJECTJOB_H | 62 | #endif // KDEVPLATFORM_PARSEPROJECTJOB_H |
please document the difference between forcing an update and forcing all - I've figured it out but it wasn't directly obvious to me