[KPhotoAlbum] Very experimental image-grouping patch

Paul Fleischer paul at xpg.dk
Wed Nov 28 18:12:41 CET 2007


2007/11/28, Martin Höller <martin at xss.co.at>:
> On 28. November 2007 Paul Fleischer wrote:
> >
> > images = loadImagesFromXML();
> > foreach img in images {
> >   if( images->parent() != null ) {
> >      DB::ImageDB::instance()->info( img->parent() )->addChildImage(
> > img->fileName() );
> >   }
> > }
>
> Why not do the actual work in loadImagesFromXML()? This method aims to
> load all image info from the DB, and has to go through all images anyway.

 The main reason for not doing it is that it requires that the parent
has been read before any of its children.

> It could build an additional list of images whith some attributes
> (i.e. "children") still missing and fill in the missing pieces once all
> images exist in memory.

If I understand you correctly, loadImagesFromXML() tries to append an
image to the child list of its parent. But if that fails, because the
parent is not loaded yet, it is done after loadImagesFromXML(). That
is a fairly good solution, IMHO.


/Paul


-- 
Paul Fleischer
Ph.D student
University of Aarhus
Department of Computer Science
IT-Parken, Aabogade 34
DK-8200 Aarhus N, Denmark
Email  : pf at daimi.au.dk
Website: http://daimi.au.dk/~pf
Office : Ada-223


More information about the KPhotoAlbum mailing list