Summary: | Only show classes of active target/dir in classtree | ||
---|---|---|---|
Product: | [Developer tools] kdevplatform | Reporter: | Jeroen Dierckx <jeroen.dierckx> |
Component: | classbrowser | Assignee: | KDevelop Developers <kdevelop-devel> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Patch to only show the active target's classes in the classview |
Description
Jeroen Dierckx
2004-02-23 19:09:46 UTC
Hi, I had a bit of a look at the ClassViewPart code, but I can't find the part where the tree is constructed. You can easily check if a file is in the active dir (or its children), by checking if project()->activeDirectory() is a part of project->relativeProjectFile(fileName). Then, you should only connect the signal emitted when the active directory is changed, to the refresh slot of the tree. For the creator of this part, it should only be 5 minutes of work. It would be a VERY nice feature (at least for me...). If no one has time to do it, I will figure this out myself (and maybe submit a patch?) Thanks in advance! Greetz, JeDi I experimented a bit (but I'm not very familiar with the kdevelop framework, so I'm not sure if I'm doing this the right way) with the code, and (for me) my classview now only shows the classes of the active directory. I've only added this for the qmake manager, but other managers should be similar. Things I've added/changed: - In kdevproject.h (in lib/interfaces), I've added a signal: void activeDirectoryChanged(); - In trollprojectpart.h (in buildtools/qmake), I've added a slot: void slotActiveDirectoryChanged(); - In trollprojectpart.cpp (in buildtools/qmake), I've implemented the slot: it just calls "emit activeDirectoryChanged();". - In trollprojectwidget.cpp (in buildtools/qmake), I've added the following code to the TrollProjectWidget::slotOverviewSelectionChanged(QListViewItem *item) function (after the other commands): m_part->slotActiveDirectoryChanged(); - In classviewwidget.cpp (in parts/classview), I've added the following code to the insertFile( const QString& fileName ) function (after the first if-test): QString activePath = m_part->project()->activeDirectory(); QString relFile = m_part->project()->relativeProjectFile(fileName); if(!relFile.startsWith(activePath)) return; The choice to only show the classes of the active target should probably an option... Hope this feature will be in kdevelop soon... Greetz, JeDi Please create a patch and either attach it here or submit it on kdevelop-devel. Personally, I wouldn't mind such a feature. :) This maybe a stupid question, but this would be my first patch ever :-D Should I just put a diff with CVS HEAD into a file? Or how should I create this patch? My solution hasn't got an option to turn the feature on/off yet. I haven't got the time to figure this out now (I'm in my exams). Created attachment 5396 [details]
Patch to only show the active target's classes in the classview
I've attached a patch. I used the command "cvs diff -u > patch.diff" to create it. Please let me know if this was not the right way to do it! Also, please note that this only works with the qmake manager. With the other managers, the view won't get updated, unless you change your class view (or in another way force the classview to refresh). This is because the other managers don't emit the "activeDirectoryChanged()" yet. Greetz, JeDi This option is a great idea. It is a bit annoying when, in a debugging session, a non-project header file is opened (STL, for example) and the class browser immediately lists the functions contained in it in the class tree. Cleanliness is next to godliness and by opening a non-project source file, the class tree immediately turns very very evil :o) This is implemented in KDevelop4 by limiting to the project scope. As we don't have a notion of "active directory" that won't be supported there. The other option available is limiting to current file. moving to kdevplatform's classbrowser |