Bug 75936 - Only show classes of active target/dir in classtree
Summary: Only show classes of active target/dir in classtree
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: classbrowser (show other bugs)
Version: git master
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-23 19:09 UTC by Jeroen Dierckx
Modified: 2013-03-31 01:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch to only show the active target's classes in the classview (3.68 KB, patch)
2004-03-25 22:00 UTC, Jeroen Dierckx
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeroen Dierckx 2004-02-23 19:09:46 UTC
Version:           3.0.1 (using KDE KDE 3.2.0)
Installed from:    Gentoo Packages
OS:          Linux

Hi,

I'd like to see an extra mode for the class tree: one where only the classes of the active target/dir are visible. It would be a very nice feature when working with large projects/subprojects.

It would also be nice if the selected class/function in the tree would be updated when changing the cursor position (maybe with an option: no update/only select class/select function).

And if the comboboxes on top of the editor (namespace, class, function) would reflect the current position, that would be just perfect :-D

Greetz,
JeDi

P.S. I had a glimpse at the kdevelop code, but at the moment I don't have time to get used to the kdevelop architecture.
Comment 1 Jeroen Dierckx 2004-03-25 16:57:31 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
Comment 2 Jeroen Dierckx 2004-03-25 19:45:29 UTC
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
Comment 3 Jens Dagerbo 2004-03-25 19:57:25 UTC
Please create a patch and either attach it here or submit it on kdevelop-devel.

Personally, I wouldn't mind such a feature. :)
Comment 4 Jeroen Dierckx 2004-03-25 20:25:35 UTC
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).
Comment 5 Jeroen Dierckx 2004-03-25 22:00:34 UTC
Created attachment 5396 [details]
Patch to only show the active target's classes in the classview
Comment 6 Jeroen Dierckx 2004-03-25 22:03:32 UTC
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
Comment 7 greatbunzinni 2006-05-06 12:37:33 UTC
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)
Comment 8 Andreas Pakulat 2008-06-29 18:09:55 UTC
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.
Comment 9 Aleix Pol 2013-03-31 01:32:20 UTC
moving to kdevplatform's classbrowser