Tue, 09/03/2013 - 00:24
Today, after a bit more than a month since I started working on it, I merged the
projectfilter branches into KDevplatform/KDevelop. This is a generic configuration interface and library which allows users to customize which folders/files KDevelop includes in a project.
How to use it
The simplest way to use the new code to exclude items from a project, is to use the context menu. Simply right click on any folder/file (not the project root, or anything target related) and choose the “exclude item from project” action. This will then add a filter for the selected item(s). If you want to undo this, go to the project configuration (see below) and remove the filter.
For more advanced management of project filters, or to remove filters and/or adapt the default filters, you need to go to the project configuration and select the new “Project Filter” config page. This allows you to add new filters, remove existing ones or edit them, including reordering them.
How it works
The pattern syntax uses
QRegExp::WildcardUnix on relative project paths. This should be fairly easy to grasp and similar to what you know from e.g.
svn:ignore. Generally, if you can write a
.gitignore file then you should be able to configure your KDevelop project as well!
If you wonder what you can do with the include/exclude pattern type, see again the documentation of
.gitignore and it’s
!pattern syntax. It allows you to selectively unhide some paths which where previously hidden. E.g. you can only show
*.cpp files in your project by first excluding all files
* and then adding an inclusive pattern for
Note that the distinction between files/folders is probably not required most of the time. It does allow for some better performance though and may make some patterns more easy to write.
Note to Users-Who-Compile-Master-From-Source
Those of you who build KDevelop/KDevplatfrom from git master, please make sure to remove
kcm_kdev_genericprojectmanagersettings.so and just to make sure also remove
kcm_kdev_genericprojectmanagersettings.desktop. Otherwise you’ll get the old generic manager configuration alongside the new project filter, which may break things.
If you install KDevelop via the package manager of your distribution, you should have nothing to do but wait until we release a new KDevelop version (4.6) which will then include this new feature!
Anyhow, please test this and report bugs on bugs.kde.org. Feature requests also welcome, but I like that this new UI is rather simple and still powerful. I’m reluctant to add more here. Something which I do want to implement in the future though is support for reading e.g.
.gitignore files and hiding files based on that from the project. The new API I added to KDevplatform should make this rather easy btw. You/I just have to write a new plugin implementing the
IProjectFilterProvider interface and then we could e.g. query
git directly for whether a given path is included or not.