[Digikam-devel] extragear/graphics/digikam/digikam
Achim Bohnet
ach at mpe.mpg.de
Fri Nov 23 22:31:49 GMT 2007
On Friday, 23. November 2007, Gilles Caulier wrote:
> SVN commit 740390 by cgilles:
>
> digiKam from trunk (KDE4): following Marcel tips by IRC, We use now a dedicaced Multithreaded Thumbnail Loader
> instance from digiKam core for all kipi-plugins we need thumb. We never use default KDE thumbnails loader with
> all kipi-plugins running under digiKam.
> Why ? : because KDE thumnails loader is slow, do not work properlly with JPEG and PNG, do not support RAW pictures,
> do not rotate properlly thumbs accordinly to Exif or Xmp metadata, etc...
Well, sounds like this needs to be merged somehow for KDE 4.1?
Achim
>
> It's perfect... To test it, start SendImages kipi-plugin for ex. and add new pictures to e-mail on the list.
> Look how is render the pictures thumb on the left of open file dialog (Standard KDE + new preview widget).
> This rock! digiKam and kipi-plugins because more homogenous now.
>
> CCMAIL: digikam-devel at kde.org
>
>
> M +44 -36 kipiinterface.cpp
> M +10 -4 kipiinterface.h
>
>
> --- trunk/extragear/graphics/digikam/digikam/kipiinterface.cpp #740389:740390
> @@ -248,7 +248,7 @@
> //-- Image Collection ------------------------------------------------------------
>
> DigikamImageCollection::DigikamImageCollection( Type tp, Album* album, const QString& filter )
> - : tp_( tp ), album_(album), imgFilter_(filter)
> + : m_tp( tp ), m_album(album), m_imgFilter(filter)
> {
> if (!album)
> {
> @@ -262,24 +262,24 @@
>
> QString DigikamImageCollection::name()
> {
> - if ( album_->type() == Album::TAG )
> + if ( m_album->type() == Album::TAG )
> {
> - return i18n("Tag: %1",album_->title());
> + return i18n("Tag: %1",m_album->title());
> }
> else
> - return album_->title();
> + return m_album->title();
> }
>
> QString DigikamImageCollection::category()
> {
> - if ( album_->type() == Album::PHYSICAL )
> + if ( m_album->type() == Album::PHYSICAL )
> {
> - PAlbum *p = dynamic_cast<PAlbum*>(album_);
> + PAlbum *p = dynamic_cast<PAlbum*>(m_album);
> return p->collection();
> }
> - else if ( album_->type() == Album::TAG )
> + else if ( m_album->type() == Album::TAG )
> {
> - TAlbum *p = dynamic_cast<TAlbum*>(album_);
> + TAlbum *p = dynamic_cast<TAlbum*>(m_album);
> return i18n("Tag: %1",p->tagPath());
> }
> else
> @@ -288,9 +288,9 @@
>
> QDate DigikamImageCollection::date()
> {
> - if ( album_->type() == Album::PHYSICAL )
> + if ( m_album->type() == Album::PHYSICAL )
> {
> - PAlbum *p = dynamic_cast<PAlbum*>(album_);
> + PAlbum *p = dynamic_cast<PAlbum*>(m_album);
> return p->date();
> }
> else
> @@ -299,9 +299,9 @@
>
> QString DigikamImageCollection::comment()
> {
> - if ( album_->type() == Album::PHYSICAL )
> + if ( m_album->type() == Album::PHYSICAL )
> {
> - PAlbum *p = dynamic_cast<PAlbum*>(album_);
> + PAlbum *p = dynamic_cast<PAlbum*>(m_album);
> return p->caption();
> }
> else
> @@ -310,20 +310,20 @@
>
> KUrl::List DigikamImageCollection::images()
> {
> - switch ( tp_ )
> + switch ( m_tp )
> {
> case AllItems:
> {
> - if (album_->type() == Album::PHYSICAL)
> + if (m_album->type() == Album::PHYSICAL)
> {
> - return imagesFromPAlbum(dynamic_cast<PAlbum*>(album_));
> + return imagesFromPAlbum(dynamic_cast<PAlbum*>(m_album));
> }
> - else if (album_->type() == Album::TAG)
> + else if (m_album->type() == Album::TAG)
> {
> - return imagesFromTAlbum(dynamic_cast<TAlbum*>(album_));
> + return imagesFromTAlbum(dynamic_cast<TAlbum*>(m_album));
> }
> - else if (album_->type() == Album::DATE ||
> - album_->type() == Album::SEARCH)
> + else if (m_album->type() == Album::DATE ||
> + m_album->type() == Album::SEARCH)
> {
> AlbumItemHandler* handler = AlbumManager::instance()->getItemHandler();
>
> @@ -392,7 +392,7 @@
>
> KUrl::List urlList;
>
> - NameFilter nameFilter(imgFilter_);
> + NameFilter nameFilter(m_imgFilter);
>
> for (QStringList::iterator it = urls.begin(); it != urls.end(); ++it)
> {
> @@ -412,7 +412,7 @@
>
> KUrl::List urlList;
>
> - NameFilter nameFilter(imgFilter_);
> + NameFilter nameFilter(m_imgFilter);
>
> for (QStringList::iterator it = urls.begin(); it != urls.end(); ++it)
> {
> @@ -425,9 +425,9 @@
>
> KUrl DigikamImageCollection::path()
> {
> - if (album_->type() == Album::PHYSICAL)
> + if (m_album->type() == Album::PHYSICAL)
> {
> - PAlbum *p = dynamic_cast<PAlbum*>(album_);
> + PAlbum *p = dynamic_cast<PAlbum*>(m_album);
> KUrl url;
> url.setPath(p->folderPath());
> return url;
> @@ -441,9 +441,9 @@
>
> KUrl DigikamImageCollection::uploadPath()
> {
> - if (album_->type() == Album::PHYSICAL)
> + if (m_album->type() == Album::PHYSICAL)
> {
> - PAlbum *p = dynamic_cast<PAlbum*>(album_);
> + PAlbum *p = dynamic_cast<PAlbum*>(m_album);
> KUrl url;
> url.setPath(p->folderPath());
> return url;
> @@ -467,7 +467,7 @@
>
> bool DigikamImageCollection::isDirectory()
> {
> - if (album_->type() == Album::PHYSICAL)
> + if (m_album->type() == Album::PHYSICAL)
> return true;
> else
> return false;
> @@ -476,7 +476,7 @@
> bool DigikamImageCollection::operator==(ImageCollectionShared& imgCollection)
> {
> DigikamImageCollection* thatCollection = static_cast<DigikamImageCollection*>(&imgCollection);
> - return (album_ == thatCollection->album_);
> + return (m_album == thatCollection->m_album);
> }
>
> //-- LibKipi interface -----------------------------------------------------------
> @@ -484,15 +484,22 @@
> DigikamKipiInterface::DigikamKipiInterface( QObject *parent, const char *name)
> : KIPI::Interface( parent, name )
> {
> + m_thumbLoadThread = new ThumbnailLoadThread();
> +
> + // Set cache size to 256 to have the max quality thumb.
> + m_thumbLoadThread->setThumbnailSize(256);
> + m_thumbLoadThread->setSendSurrogatePixmap(true);
> + m_thumbLoadThread->setExifRotate(AlbumSettings::instance()->getExifRotate());
> +
> m_albumManager = AlbumManager::instance();
>
> - connect( m_albumManager, SIGNAL( signalAlbumItemsSelected( bool ) ),
> - this, SLOT( slotSelectionChanged( bool ) ) );
> + connect(m_albumManager, SIGNAL( signalAlbumItemsSelected( bool ) ),
> + this, SLOT( slotSelectionChanged( bool ) ));
>
> - connect( m_albumManager, SIGNAL( signalAlbumCurrentChanged(Album*) ),
> - this, SLOT( slotCurrentAlbumChanged(Album*) ) );
> + connect(m_albumManager, SIGNAL( signalAlbumCurrentChanged(Album*) ),
> + this, SLOT( slotCurrentAlbumChanged(Album*) ));
>
> - connect(ThumbnailLoadThread::defaultThread(), SIGNAL(signalThumbnailLoaded(const LoadingDescription&, const QPixmap&)),
> + connect(m_thumbLoadThread, SIGNAL(signalThumbnailLoaded(const LoadingDescription&, const QPixmap&)),
> this, SLOT(slotThumbnailLoaded(const LoadingDescription&, const QPixmap&)));
> }
>
> @@ -661,15 +668,16 @@
> s->getRawFileFilter());
> }
>
> -void DigikamKipiInterface::thumbnail( const KUrl& url, int /*size*/ )
> +void DigikamKipiInterface::thumbnail(const KUrl& url, int /*size*/)
> {
> - ThumbnailLoadThread::defaultThread()->find(url.path());
> + // NOTE: size is not used here. Cache use the max pixmap size to store thumbs (256).
> + m_thumbLoadThread->find(url.path());
> }
>
> -void DigikamKipiInterface::thumbnails( const KUrl::List& list, int /*size*/ )
> +void DigikamKipiInterface::thumbnails(const KUrl::List& list, int size)
> {
> for (KUrl::List::const_iterator it = list.begin() ; it != list.end() ; ++it)
> - ThumbnailLoadThread::defaultThread()->find((*it).path());
> + thumbnail((*it).path(), size);
> }
>
> void DigikamKipiInterface::slotThumbnailLoaded(const LoadingDescription& desc, const QPixmap& pix)
> --- trunk/extragear/graphics/digikam/digikam/kipiinterface.h #740389:740390
> @@ -63,6 +63,7 @@
> namespace Digikam
> {
>
> +class ThumbnailLoadThread;
> class AlbumManager;
> class Album;
> class PAlbum;
> @@ -143,9 +144,10 @@
>
> private:
>
> - Type tp_;
> - Album *album_;
> - QString imgFilter_;
> + QString m_imgFilter;
> +
> + Type m_tp;
> + Album *m_album;
> };
>
>
> @@ -164,11 +166,14 @@
> KIPI::ImageCollection currentSelection();
> QList<KIPI::ImageCollection> allAlbums();
> KIPI::ImageInfo info( const KUrl& );
> +
> bool addImage( const KUrl&, QString& errmsg );
> void delImage( const KUrl& );
> void refreshImages( const KUrl::List& urls );
> +
> int features() const;
> QString fileExtensions();
> +
> void thumbnail( const KUrl& url, int size );
> void thumbnails( const KUrl::List& list, int size );
>
> @@ -183,7 +188,8 @@
>
> private:
>
> - AlbumManager *m_albumManager;
> + AlbumManager *m_albumManager;
> + ThumbnailLoadThread *m_thumbLoadThread;
> };
>
> } // namespace Digikam
>
>
--
To me vi is Zen. To use vi is to practice zen. Every command is
a koan. Profound to the user, unintelligible to the uninitiated.
You discover truth everytime you use it.
-- reddy at lion.austin.ibm.com
More information about the Digikam-devel
mailing list