ProjectItem vs. ProjectFolderItem

Aleix aleixpol at gmail.com
Sun Sep 30 14:13:41 UTC 2007


On 9/30/07, Matt Rogers <mattr at kde.org> wrote:
>
> On Sunday 30 September 2007 04:51:02 am Andreas Pakulat wrote:
> > Hi,
> >
> > as Aleix pointed out its currently quite ugly to create custom
> > ProjectItem's for your buildmanager. The reason is that you'd have to
> > subclass KDevelop::ProjectItem+<custom folder item> resulting in this:
> >
> > class QMakeProjectItem : public ProjectItem, QMakeFolderItem
> > {
> > };
> >
> > The reason why this is ugly because the inheritance graph for this is
> > now:
> >
> >              ProjectFolderItem
> >
> >           ----------+-------------
> >
> >    QMakeFolderItem         ProjectItem
> >
> >           ----------+-------------
> >
> >              QMakeProjectItem
> >
> > (not 100% correct, I left out the ProjectBuildFolderItem)
> >
> > So we have that dreaded diamond-shape inheritance :(
> >
>
> Why do we have ProjectItem to begin with? Is there some reason we can't
> just
> add an isProjectRoot() function to ProjectFolderItem?
>
>
> > Unfortunately I don't see a way of removing this inheritance graph
> > without having to duplicate the code between ProjectFolderItem and
> > ProjectItem (and thus all subclasses as well).
> >
>
> Remove ProjectItem


Well, I think that the problem was that the project item name was the
project name, that's why we used the ProjectItem.

> All those Item classes are ProjectBaseItem subclasses which is a
> > QStandardItem subclass.
> >
>
>
> > The only way I currently see is making the project item a separate thing
> > from the source folder of the project. Of course you'd see that in the
> > project manager, so we'd have "Project->project-source-folder" instead
> of
> > only "Project" in the hierarchy.
> >
> > My question is: Did I overlook a way to solve that inheritance dilemma
> > without having to duplicate code? (I thought about changing to
> > has-a-relationship between projectitem and projectfolderitem, but then
> > you'd still get the new hierarchy in the project manager)
> >
> > Andreas
>
> You did. Remove the inheritance. It's not needed. Add some nice functions
> to
> ProjectFolderItem to find the root of the project.
> --
> Matt


Aleix

_______________________________________________
> KDevelop-devel mailing list
> KDevelop-devel at kdevelop.org
> https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20070930/5199321b/attachment.html>


More information about the KDevelop-devel mailing list