![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Classes | |
class | CacheLock |
Signals | |
void | fileChanged (const QString &filePath) |
This signal is emitted when the cache is notified that a file was changed. | |
Public Member Functions | |
void | addLoadingProcess (LoadingProcess *const process) |
Add a loading process to the list. | |
quint64 | getCacheSize () const |
Get the cache size in bytes. | |
bool | hasThumbnailPixmap (const QString &cacheKey) const |
bool | isCacheable (const DImg &img) const |
Returns whether the given DImg fits in the cache. | |
void | notifyFileChanged (const QString &filePath, bool notify=true) |
Remove all entries from cache that were loaded from filePath. | |
void | notifyNewLoadingProcess (LoadingProcess *const process, const LoadingDescription &description) |
Notify all currently registered loading processes. | |
bool | putImage (const QString &cacheKey, const DImg &img, const QString &filePath) const |
Put image into for given string into the cache. | |
void | putThumbnail (const QString &cacheKey, const QImage &thumb, const QString &filePath) |
Puts a thumbnail into the thumbnail cache. | |
void | putThumbnail (const QString &cacheKey, const QPixmap &thumb, const QString &filePath) |
void | removeImage (const QString &cacheKey) |
Remove entries for the given cacheKey from the cache. | |
void | removeImages () |
Remove all entries from the cache. | |
void | removeLoadingProcess (LoadingProcess *const process) |
Remove loading process for given cache key. | |
void | removeThumbnail (const QString &cacheKey) |
Remove the thumbnail for the given file path from the thumbnail cache. | |
void | removeThumbnails () |
Remove all thumbnails. | |
const QPixmap * | retrieveBufferedTPixmap (const QString &cacheKey) const |
DImg * | retrieveImage (const QString &cacheKey) const |
Retrieves an image for the given string from the cache, or 0 if no image is found. | |
LoadingProcess * | retrieveLoadingProcess (const QString &cacheKey) const |
Find the loading process for given cacheKey, or 0 if not found. | |
const QImage * | retrieveThumbnail (const QString &cacheKey) const |
The LoadingCache support both the caching of QImage and QPixmap objects. | |
const QPixmap * | retrieveThumbnailPixmap (const QString &cacheKey) const |
void | setCacheSize (int megabytes) |
Sets the cache size in megabytes. | |
void | setFileWatch (LoadingCacheFileWatch *const watch) |
Sets a LoadingCacheFileWatch to watch the files contained in this cache. | |
void | setThumbnailCacheSize (int numberOfQImages, int numberOfQPixmaps) |
Sets the size of the thumbnail cache. | |
Static Public Member Functions | |
static LoadingCache * | cache () |
static void | cleanUp () |
Friends | |
class | CacheLock |
class | LoadingCacheFileWatch |
void Digikam::LoadingCache::addLoadingProcess | ( | LoadingProcess *const | process | ) |
Only one loading process for the same cache key is registered at a time.
|
signal |
There is no information in this signal if the file was ever contained in the cache. The signal may be emitted under CacheLock. Strongly consider a queued connection.
void Digikam::LoadingCache::notifyFileChanged | ( | const QString & | filePath, |
bool | notify = true |
||
) |
Emits relevant signals if notify = true.
bool Digikam::LoadingCache::putImage | ( | const QString & | cacheKey, |
const DImg & | img, | ||
const QString & | filePath | ||
) | const |
Returns true if image has been put in the cache, false otherwise. Ownership of the DImg instance is passed to the cache. When it cannot be put in the cache it is deleted. The third parameter specifies a file path that will be watched. If this file changes, the object will be removed from the cache.
const QImage * Digikam::LoadingCache::retrieveThumbnail | ( | const QString & | cacheKey | ) | const |
QPixmaps can only be accessed from the main thread, so the tasks cannot access this cache. Retrieves a thumbnail for the given filePath from the thumbnail cache, or a 0 if the thumbnail is not found.
void Digikam::LoadingCache::setCacheSize | ( | int | megabytes | ) |
The thumbnail cache is not affected and setThumbnailCacheSize takes the maximum number.
void Digikam::LoadingCache::setFileWatch | ( | LoadingCacheFileWatch *const | watch | ) |
Ownership of this object is transferred to the cache.
void Digikam::LoadingCache::setThumbnailCacheSize | ( | int | numberOfQImages, |
int | numberOfQPixmaps | ||
) |
numberOfQImages | The maximum number of thumbnails of max possible size in QImage format that will be cached. If the size of the images is smaller, a larger number will be cached. |
numberOfQPixmaps | The maximum number of thumbnails of max possible size in QPixmap format that will be cached. If the size of the images is smaller, a larger number will be cached. Note: The main cache is unaffected by this method, and setCacheSize takes megabytes as parameter. Note: A good caching strategy will be to set one of the numbers to 0 Default values: (0, 100) |