Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/project/projectwatcher.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | * This file is part of KDevelop * | ||||
3 | * Copyright 2017 René Bertin <rjvbertin@gmail.com> * | ||||
4 | * * | ||||
5 | * This program is free software; you can redistribute it and/or modify * | ||||
6 | * it under the terms of the GNU Library General Public License as * | ||||
7 | * published by the Free Software Foundation; either version 2 of the * | ||||
8 | * License, or (at your option) any later version. * | ||||
9 | * * | ||||
10 | * This program is distributed in the hope that it will be useful, * | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||||
13 | * GNU General Public License for more details. * | ||||
14 | * * | ||||
15 | * You should have received a copy of the GNU Library General Public * | ||||
16 | * License along with this program; if not, write to the * | ||||
17 | * Free Software Foundation, Inc., * | ||||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||||
19 | ***************************************************************************/ | ||||
20 | | ||||
21 | #ifndef KDEVPLATFORM_PROJECTWATCHER_H | ||||
22 | #define KDEVPLATFORM_PROJECTWATCHER_H | ||||
23 | | ||||
24 | #include "projectexport.h" | ||||
25 | | ||||
26 | #include <KDirWatch> | ||||
27 | | ||||
28 | namespace KDevelop { | ||||
29 | | ||||
30 | class IProject; | ||||
31 | class ProjectFilterManager; | ||||
32 | | ||||
33 | class KDEVPLATFORMPROJECT_EXPORT ProjectWatcher : public KDirWatch | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | public: | ||||
37 | /** | ||||
38 | * Create a dirwatcher for @p project based on KDirWatch and | ||||
39 | * enhanced with support for the project @p filter. | ||||
40 | */ | ||||
41 | explicit ProjectWatcher(IProject* project, ProjectFilterManager* filter); | ||||
42 | | ||||
43 | /** | ||||
44 | * Add directory @p path to the project dirwatcher if it is not | ||||
45 | * rejected by the project filter. | ||||
46 | */ | ||||
47 | void addDir(const QString& path, WatchModes watchModes = WatchDirOnly); | ||||
48 | void removeDir(const QString& path); | ||||
49 | | ||||
50 | /** | ||||
51 | * return the current number of directories being watched. | ||||
52 | */ | ||||
53 | int size() const; | ||||
54 | | ||||
55 | private: | ||||
56 | IProject* m_project; | ||||
57 | ProjectFilterManager* m_filter; | ||||
58 | int m_watchedCount; | ||||
59 | }; | ||||
60 | | ||||
61 | } | ||||
62 | #endif //KDEVPLATFORM_PROJECTWATCHER_H |