[KimDaBa] Patch to improve thumbnail cache handling
Robert L Krawitz
rlk at alum.mit.edu
Sun Jan 9 00:53:35 GMT 2005
The following patch improves the handling of the thumbnail cache by
clearing it if the thumbnail size changes. I believe I may have
already sent this one in.
-------------- next part --------------
diff -ru kimdaba-2005-01-02-old/kimdaba/thumbnail.cpp kimdaba-2005-01-02-noi18n/kimdaba/thumbnail.cpp
--- kimdaba-2005-01-02-old/kimdaba/thumbnail.cpp 2005-01-02 15:38:10.000000000 -0500
+++ kimdaba-2005-01-02-noi18n/kimdaba/thumbnail.cpp 2005-01-08 19:31:51.002463848 -0500
@@ -208,7 +208,13 @@
QPixmapCache& ThumbNail::pixmapCache()
{
static QPixmapCache cache;
+ static int lastSize = -1;
cache.setCacheLimit( 4* 1024 );
+ int currentThumbSize = Options::instance()->thumbSize();
+ if (lastSize != currentThumbSize) {
+ cache.clear();
+ lastSize = currentThumbSize;
+ }
return cache;
}
@@ -220,7 +226,10 @@
int size = Options::instance()->thumbSize();
ImageManager::instance()->load( _imageInfo->fileName(), const_cast<ThumbNail*>( this ), _imageInfo->angle(), size, size, true, false );
- return emptyPixmap();
+ if ((pix = pixmapCache().find( _imageInfo->fileName())) != NULL)
+ return pix;
+ else
+ return emptyPixmap();
}
QPixmap* ThumbNail::emptyPixmap()
More information about the Kphotoalbum
mailing list