digiKam
|
Classes | |
class | CacheLock |
Signals | |
void | fileChanged (const QString &filePath) |
Public Member Functions | |
void | addLoadingProcess (LoadingProcess *const process) |
bool | hasThumbnailPixmap (const QString &cacheKey) const |
QStringList | imageFilePathsInCache () const |
bool | isCacheable (const DImg &img) const |
void | notifyFileChanged (const QString &filePath, bool notify=true) |
void | notifyNewLoadingProcess (LoadingProcess *const process, const LoadingDescription &description) |
bool | putImage (const QString &cacheKey, const DImg &img, const QString &filePath) const |
void | putThumbnail (const QString &cacheKey, const QImage &thumb, const QString &filePath) |
void | putThumbnail (const QString &cacheKey, const QPixmap &thumb, const QString &filePath) |
void | removeImage (const QString &cacheKey) |
void | removeImages () |
void | removeLoadingProcess (LoadingProcess *const process) |
void | removeThumbnail (const QString &cacheKey) |
void | removeThumbnails () |
DImg * | retrieveImage (const QString &cacheKey) const |
LoadingProcess * | retrieveLoadingProcess (const QString &cacheKey) const |
const QImage * | retrieveThumbnail (const QString &cacheKey) const |
const QPixmap * | retrieveThumbnailPixmap (const QString &cacheKey) const |
void | setCacheSize (int megabytes) |
void | setFileWatch (LoadingCacheFileWatch *const watch) |
void | setThumbnailCacheSize (int numberOfQImages, int numberOfQPixmaps) |
QStringList | thumbnailFilePathsInCache () const |
Static Public Member Functions | |
static LoadingCache * | cache () |
static void | cleanUp () |
Friends | |
class | CacheLock |
class | LoadingCacheFileWatch |
void Digikam::LoadingCache::addLoadingProcess | ( | LoadingProcess *const | process | ) |
Add a loading process to the list. Only one loading process for the same cache key is registered at a time.
References Digikam::LoadingProcess::cacheKey().
Referenced by Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), and Digikam::ThumbnailLoadingTask::execute().
|
static |
Referenced by Digikam::ThumbnailLoadThread::Private::checkDescription(), Digikam::LoadingCacheInterface::cleanCache(), Digikam::LoadingCacheInterface::cleanThumbnailCache(), Digikam::LoadingCacheInterface::connectToSignalFileChanged(), Digikam::ScanController::databaseInitialization(), Digikam::ThumbnailLoadThread::deleteThumbnail(), Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), Digikam::ThumbnailLoadingTask::execute(), Digikam::LoadingCacheInterface::fileChanged(), Digikam::LoadingCacheInterface::initialize(), Digikam::SharedLoadingTask::progressInfo(), Digikam::LoadingCacheInterface::putImage(), and Digikam::LoadingCacheInterface::setCacheOptions().
|
static |
Referenced by Digikam::LoadingCacheInterface::cleanUp().
|
signal |
This signal is emitted when the cache is notified that a file was changed. 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.
Referenced by notifyFileChanged().
bool Digikam::LoadingCache::hasThumbnailPixmap | ( | const QString & | cacheKey | ) | const |
Referenced by Digikam::ThumbnailLoadThread::Private::checkDescription().
QStringList Digikam::LoadingCache::imageFilePathsInCache | ( | ) | const |
Returns a list of all possible file paths in cache.
Referenced by Digikam::LoadingCacheFileWatch::addedImage().
bool Digikam::LoadingCache::isCacheable | ( | const DImg & | img | ) | const |
Returns whether the given DImg fits in the cache.
References Digikam::DImg::numBytes().
Referenced by putImage(), and Digikam::LoadingCacheInterface::putImage().
void Digikam::LoadingCache::notifyFileChanged | ( | const QString & | filePath, |
bool | notify = true |
||
) |
Remove all entries from cache that were loaded from filePath. Emits relevant signals if notify = true.
References fileChanged().
Referenced by Digikam::LoadingCacheFileWatch::checkFileWatch(), Digikam::LoadingCacheInterface::fileChanged(), and Digikam::LoadingCacheFileWatch::notifyFileChanged().
void Digikam::LoadingCache::notifyNewLoadingProcess | ( | LoadingProcess *const | process, |
const LoadingDescription & | description | ||
) |
Notify all currently registered loading processes
Referenced by Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), and Digikam::ThumbnailLoadingTask::execute().
bool Digikam::LoadingCache::putImage | ( | const QString & | cacheKey, |
const DImg & | img, | ||
const QString & | filePath | ||
) | const |
Put image into for given string into the cache. 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.
References isCacheable(), and Digikam::DImg::numBytes().
Referenced by Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), and Digikam::LoadingCacheInterface::putImage().
void Digikam::LoadingCache::putThumbnail | ( | const QString & | cacheKey, |
const QImage & | thumb, | ||
const QString & | filePath | ||
) |
Puts a thumbnail into the thumbnail cache.
Referenced by Digikam::ThumbnailLoadingTask::execute().
void Digikam::LoadingCache::putThumbnail | ( | const QString & | cacheKey, |
const QPixmap & | thumb, | ||
const QString & | filePath | ||
) |
void Digikam::LoadingCache::removeImage | ( | const QString & | cacheKey | ) |
Remove entries for the given cacheKey from the cache
void Digikam::LoadingCache::removeImages | ( | ) |
Remove all entries from the cache
Referenced by Digikam::LoadingCacheInterface::cleanCache().
void Digikam::LoadingCache::removeLoadingProcess | ( | LoadingProcess *const | process | ) |
Remove loading process for given cache key
Referenced by Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), and Digikam::ThumbnailLoadingTask::execute().
void Digikam::LoadingCache::removeThumbnail | ( | const QString & | cacheKey | ) |
Remove the thumbnail for the given file path from the thumbnail cache
Referenced by Digikam::ThumbnailLoadThread::deleteThumbnail().
void Digikam::LoadingCache::removeThumbnails | ( | ) |
Remove all thumbnails
Referenced by Digikam::LoadingCacheInterface::cleanThumbnailCache().
DImg * Digikam::LoadingCache::retrieveImage | ( | const QString & | cacheKey | ) | const |
Retrieves an image for the given string from the cache, or 0 if no image is found.
Referenced by Digikam::SharedLoadingTask::execute(), and Digikam::PreviewLoadingTask::execute().
LoadingProcess * Digikam::LoadingCache::retrieveLoadingProcess | ( | const QString & | cacheKey | ) | const |
Find the loading process for given cacheKey, or 0 if not found
Referenced by Digikam::SharedLoadingTask::execute(), Digikam::PreviewLoadingTask::execute(), and Digikam::ThumbnailLoadingTask::execute().
const QImage * Digikam::LoadingCache::retrieveThumbnail | ( | const QString & | cacheKey | ) | const |
The LoadingCache support both the caching of QImage and QPixmap objects. 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.
Referenced by Digikam::ThumbnailLoadingTask::execute().
const QPixmap * Digikam::LoadingCache::retrieveThumbnailPixmap | ( | const QString & | cacheKey | ) | const |
void Digikam::LoadingCache::setCacheSize | ( | int | megabytes | ) |
Sets the cache size in megabytes. The thumbnail cache is not affected and setThumbnailCacheSize takes the maximum number.
Referenced by Digikam::LoadingCacheInterface::setCacheOptions().
void Digikam::LoadingCache::setFileWatch | ( | LoadingCacheFileWatch *const | watch | ) |
Sets a LoadingCacheFileWatch to watch the files contained in this cache. Ownership of this object is transferred to the cache.
Referenced by Digikam::ScanController::databaseInitialization().
void Digikam::LoadingCache::setThumbnailCacheSize | ( | int | numberOfQImages, |
int | numberOfQPixmaps | ||
) |
Sets the size of the thumbnail cache
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) |
References Digikam::ThumbnailSize::maxThumbsSize().
QStringList Digikam::LoadingCache::thumbnailFilePathsInCache | ( | ) | const |
|
friend |
|
friend |