KIO::ThumbnailCache Namespace
Functions
| short | cacheSize(const QSize &size) |
| QString | filePath(const QByteArray &uri, const QString &thumbRoot, const QSize &size, qreal devicePixelRatio) |
| bool | isCurrent(const QImage &thumb, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize) |
| QImage | load(const QString &path, qreal devicePixelRatio) |
| bool | matches(const QImage &thumb, const QByteArray &uri, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize, const QSize &requestSize, qreal devicePixelRatio, bool requireSufficientResolution = true) |
| QString | rootPath() |
| QImage | scaledToFit(const QImage &thumb, const QSize &size) |
| QImage | thumbnailFor(const QByteArray &uri, const QString &thumbRoot, const QSize &size, qreal devicePixelRatio, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize) |
| QString | tierDir(short cacheSize, qreal devicePixelRatio) |
Function Documentation
short ThumbnailCache::cacheSize(const QSize &size)
The size a thumbnail of size is generated and cached at: 128, 256, 512 or 1024.
QString ThumbnailCache::filePath(const QByteArray &uri, const QString &thumbRoot, const QSize &size, qreal devicePixelRatio)
Cache file path for the encoded uri, empty when no directory holds thumbnails of that size.
bool ThumbnailCache::isCurrent(const QImage &thumb, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize)
Whether thumb was made from the file as it stands now.
QImage ThumbnailCache::load(const QString &path, qreal devicePixelRatio)
Reads the thumbnail at path, tagging it with devicePixelRatio, or a null image.
bool ThumbnailCache::matches(const QImage &thumb, const QByteArray &uri, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize, const QSize &requestSize, qreal devicePixelRatio, bool requireSufficientResolution = true)
Whether thumb was made from the file uri names, of this modification time and size. With requireSufficientResolution a thumbnail smaller than the request is rejected as well, which a job wants and a lookup that shows what there is right now does not.
QString ThumbnailCache::rootPath()
Root of the cache, holding one directory per thumbnail size.
QImage ThumbnailCache::scaledToFit(const QImage &thumb, const QSize &size)
Scales thumb down to fit size, honouring its ratio, or returns it as it is.
QImage ThumbnailCache::thumbnailFor(const QByteArray &uri, const QString &thumbRoot, const QSize &size, qreal devicePixelRatio, qint64 sourceMTimeSecs, KIO::filesize_t sourceSize)
The cached thumbnail for the file uri names, ready to be shown at size, or a null image when nothing usable is cached. Takes what it needs by value, so it can run on any thread.
QString ThumbnailCache::tierDir(short cacheSize, qreal devicePixelRatio)
The directory ("normal/", "large/", ...) that holds thumbnails of cacheSize at devicePixelRatio, empty when none of them is large enough. A thumbnailer multiplies what it is asked for by the ratio, so that product is what decides the directory.