[KPhotoAlbum] Very experimental image-grouping patch

Tero Tilus tero at tilus.net
Thu Nov 29 00:12:38 GMT 2007


2007-11-29 00:11, Paul Fleischer:
> I might be wrong here, but doesn't ImageDB::info() do exactly this?

I might be wrong as well, but I'd say it does not.  I could not found
ImageDB::info() btw, but afaik we are talking about this method.

  DB::ImageInfoPtr XMLDB::Database::info( const QString& fileName ) const
  {
      static QMap<QString, DB::ImageInfoPtr > fileMap;

      if ( fileMap.contains( fileName ) )
	  return fileMap[ fileName ];
      else {
	  fileMap.clear();
	  for( DB::ImageInfoListConstIterator it = _images.constBegin(); it != _images.constEnd(); ++it ) {
	      fileMap.insert( (*it)->fileName(), *it );
	  }
	  if ( fileMap.contains( fileName ) )
	      return fileMap[ fileName ];
      }
      return DB::ImageInfoPtr();
  }

What I can tell it just looks up from fileMap and if fileName isn't
there it (re)builds the whole map.  SQLDB version looks like this

  DB::ImageInfoPtr SQLDB::Database::info( const QString& fileName ) const
  {
      return _infoCollection.
	  getImageInfoOf(Utilities::stripImageDirectory(fileName));
  }

QMap does the footwork for lookup.  Doc says it's a skip-list.  Using
QHash (any reason why not?) instead we could speed it up a bit.

  http://doc.trolltech.com/4.0/qmap.html#details

-- 
Tero Tilus ## 050 3635 235 ## http://www.tilus.net/koti/tero/



More information about the Kphotoalbum mailing list