![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Signals | |
void | signalThumbnailLoaded (const LoadingDescription &loadingDescription, const QPixmap &pix) |
void | ThumbnailLoaded (const LoadingDescription &, const QImage &) |
void | thumbnailsAvailable () |
![]() | |
void | signalImageLoaded (const LoadingDescription &loadingDescription, const DImg &img) |
This signal is emitted when the loading process has finished. | |
void | signalImageSaved (const QString &filePath, bool success) |
void | signalImageStartedLoading (const LoadingDescription &loadingDescription) |
All signals are delivered to the thread from where the LoadSaveThread object has been created. | |
void | signalImageStartedSaving (const QString &filePath) |
void | signalLoadingProgress (const LoadingDescription &loadingDescription, float progress) |
This signal is emitted whenever new progress info is available and the notification policy allows emitting the signal. | |
void | signalMoreCompleteLoadingAvailable (const LoadingDescription &oldLoadingDescription, const LoadingDescription &newLoadingDescription) |
This signal is emitted if. | |
void | signalQImageThumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img) |
void | signalSavingProgress (const QString &filePath, float progress) |
![]() | |
void | finished () |
void | starting () |
Emitted if emitSignals is enabled. | |
Public Member Functions | |
ThumbnailLoadThread (QObject *const parent=nullptr) | |
void | find (const ThumbnailIdentifier &identifier) |
Find a thumbnail. | |
void | find (const ThumbnailIdentifier &identifier, const QRect &rect) |
void | find (const ThumbnailIdentifier &identifier, const QRect &rect, int size) |
bool | find (const ThumbnailIdentifier &identifier, const QRect &rect, QPixmap &pixmap) |
All tastes of find() methods, for loading the thumbnail of a detail. | |
bool | find (const ThumbnailIdentifier &identifier, const QRect &rect, QPixmap &pixmap, int size, bool onlyStorage=false) |
void | find (const ThumbnailIdentifier &identifier, int size) |
Same as above, but does not use the global size, but an extra specified size. | |
bool | find (const ThumbnailIdentifier &identifier, QPixmap &pixmap) |
Find a thumbnail. | |
bool | find (const ThumbnailIdentifier &identifier, QPixmap &pixmap, int size, bool onlyStorage=false) |
Same as above, but does not use the global size, but an extra specified size. | |
bool | findBuffered (const ThumbnailIdentifier &identifier, const QRect &rect, QPixmap &pixmap, int size) |
Find the thumbnail pixmap in the buffered cache to avoid flickering while loading a new thumbnail. | |
void | findGroup (const QList< QPair< ThumbnailIdentifier, QRect > > &filePathAndRects) |
void | findGroup (const QList< QPair< ThumbnailIdentifier, QRect > > &filePathsAndRects, int size) |
void | findGroup (QList< ThumbnailIdentifier > &identifiers) |
Find a group of thumbnails. | |
void | findGroup (QList< ThumbnailIdentifier > &identifiers, int size) |
QList< LoadingDescription > | lastDescriptions () const |
Returns the descriptions used by the last call to any of the above methods. | |
void | load (const LoadingDescription &description) override |
Load a thumbnail. | |
int | pixmapToThumbnailSize (int size) const |
Computes the thumbnail size for the give pixmap size. | |
void | pregenerateGroup (const QList< ThumbnailIdentifier > &identifiers) |
Pregenerate the thumbnail group. | |
void | pregenerateGroup (const QList< ThumbnailIdentifier > &identifiers, int size) |
void | preload (const ThumbnailIdentifier &identifier) |
Preload the thumbnail or thumbnail group. | |
void | preload (const ThumbnailIdentifier &identifier, int size) |
void | preloadGroup (QList< ThumbnailIdentifier > &identifiers) |
void | preloadGroup (QList< ThumbnailIdentifier > &identifiers, int size) |
void | setHighlightPixmap (bool highlight) |
If you enable this, a highlighting border will be drawn around the pixmap. | |
void | setPixmapRequested (bool wantPixmap) |
If you enable this, the signal thumbnailLoaded(LoadingDescription, QPixmap) will be emitted. | |
void | setSendSurrogatePixmap (bool send) |
If you enable this, the thread will try hard to send a pixmap if thumbnail loading failed. | |
void | setThumbnailSize (int size, bool forFace=false) |
Set the requested thumbnail size. | |
void | storeDetailThumbnail (const QString &filePath, const QRect &detailRect, const QImage &image, bool isFace=false) |
Stores the given detail thumbnail on disk. | |
int | storedSize () const |
ThumbnailCreator * | thumbnailCreator () const |
int | thumbnailToPixmapSize (int size) const |
Computes the pixmap size for the give thumbnail size. | |
![]() | |
ManagedLoadSaveThread (QObject *const parent=nullptr) | |
void | load (const LoadingDescription &description, LoadingPolicy policy) |
LoadingPolicy | loadingPolicy () const |
virtual void | save (const DImg &image, const QString &filePath, const QString &format) override |
Append a task to save the image to the task list. | |
void | setLoadingPolicy (LoadingPolicy policy) |
Set the loading policy. | |
void | setTerminationPolicy (TerminationPolicy terminationPolicy) |
void | stopAllTasks () |
void | stopLoading (const LoadingDescription &desc, LoadingTaskFilter filter=LoadingTaskFilterAll) |
Same than previous method, but Stop and remove tasks filtered by LoadingDescription. | |
void | stopLoading (const QString &filePath=QString(), LoadingTaskFilter filter=LoadingTaskFilterAll) |
Stop and remove tasks filtered by filePath and policy. | |
void | stopSaving (const QString &filePath=QString()) |
Stop and remove saving tasks filtered by filePath. | |
TerminationPolicy | terminationPolicy () const |
![]() | |
LoadSaveThread (QObject *const parent=nullptr) | |
~LoadSaveThread () override | |
Destructor: The thread will execute all pending tasks and wait for this upon destruction. | |
void | imageLoaded (const LoadingDescription &loadingDescription, const DImg &img) override |
void | imageSaved (const QString &filePath, bool success) override |
void | imageStartedLoading (const LoadingDescription &loadingDescription) override |
void | imageStartedSaving (const QString &filePath) override |
void | loadingProgress (const LoadingDescription &loadingDescription, float progress) override |
void | moreCompleteLoadingAvailable (const LoadingDescription &oldLoadingDescription, const LoadingDescription &newLoadingDescription) override |
virtual bool | querySendNotifyEvent () const |
void | savingProgress (const QString &filePath, float progress) override |
void | setNotificationPolicy (NotificationPolicy notificationPolicy) |
virtual void | taskHasFinished () |
![]() | |
DynamicThread (QObject *const parent=nullptr) | |
This class extends QRunnable, so you have to reimplement virtual void run(). | |
~DynamicThread () override | |
The destructor calls stop() and wait(), but if you, in your destructor, delete any data that is accessed by your run() method, you must call stop() and wait() before yourself. | |
bool | isFinished () const |
bool | isRunning () const |
QThread::Priority | priority () const |
void | setEmitSignals (bool emitThem) |
void | setPriority (QThread::Priority priority) |
Sets the priority for this dynamic thread. | |
State | state () const |
Static Public Member Functions | |
static void | cleanUp () |
static ThumbnailLoadThread * | defaultIconViewThread () |
static ThumbnailLoadThread * | defaultThread () |
Return application-wide default thumbnail threads. | |
static void | deleteThumbnail (const QString &filePath) |
This is a tool to force regeneration of thumbnails. | |
static void | initializeNoThumbnailStorage () |
Disable storing thumbnails in the disk cache. | |
static void | initializeThumbnailDatabase (const DbEngineParameters ¶ms, ThumbnailInfoProvider *const provider=nullptr) |
Enable loading of thumbnails from a thumbnail database. | |
static int | maximumThumbnailPixmapSize (bool withHighlighting) |
static int | maximumThumbnailSize () |
Returns the maximum possible size of a thumbnail. | |
static void | setDisplayingWidget (QWidget *const widget) |
For color management, this sets the widget the thumbnails will be color managed for. | |
static int | thumbnailToPixmapSize (bool withHighlight, int size) |
![]() | |
static int | exifOrientation (const QString &filePath, const DMetadata &metadata, bool isRaw, bool fromRawEmbeddedPreview) |
Retrieves the Exif orientation, either from the info provider if available, or from the metadata. | |
static LoadSaveFileInfoProvider * | infoProvider () |
static void | setInfoProvider (LoadSaveFileInfoProvider *const infoProvider) |
Protected Member Functions | |
void | thumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img) override |
virtual method overridden from LoadSaveNotifier, implemented first by LoadSaveThread called by ThumbnailTask from working thread | |
![]() | |
void | load (const LoadingDescription &description, LoadingMode loadingMode, AccessMode mode=AccessModeReadWrite) |
void | load (const LoadingDescription &description, LoadingMode loadingMode, LoadingPolicy policy, AccessMode mode=AccessModeReadWrite) |
void | loadPreview (const LoadingDescription &description, LoadingPolicy policy) |
void | loadThumbnail (const LoadingDescription &description) |
void | preloadThumbnail (const LoadingDescription &description) |
void | preloadThumbnailGroup (const QList< LoadingDescription > &descriptions) |
void | prependThumbnailGroup (const QList< LoadingDescription > &descriptions) |
void | shutDown () override |
If you are deleting data in your destructor which is accessed from the thread, do one of the following from your destructor to guarantee a safe shutdown: 1) Call this method 2) Call stop() and wait(), knowing that nothing will call start() anymore after this 3) Be sure the thread will never be running at destruction. | |
![]() | |
void | notificationReceived () |
void | run () override |
Implement this pure virtual function in your subclass. | |
![]() | |
bool | runningFlag () const volatile |
In you run() method, you shall regularly check for runningFlag() and cleanup and return if false. | |
void | start (QMutexLocker< QMutex > &locker) |
Doing the same as start(), stop() and wait above, provide it with a locked QMutexLocker on mutex(). | |
void | stop (const QMutexLocker< QMutex > &locker) |
QMutex * | threadMutex () const |
This is the non-recursive mutex used to protect state variables and waiting in this class. | |
void | wait (QMutexLocker< QMutex > &locker) |
|
static |
It is perfectly all right to create an extra object of the class, but it is useful to have default object
|
static |
All thumbnail files for the given file will be removed from disk, and the cached instances will be removed as well. Use this method if you know that the contents of the file has changed. This method works independently from the multithreaded thumbnail loading.
void Digikam::ThumbnailLoadThread::find | ( | const ThumbnailIdentifier & | identifier | ) |
This method sends the signals and does not return values like the method above. If you certainly need asynchronous return, connect with Qt::QueuedConnection to the signals. If you connect directly, the signals may be sent from within the method call.
bool Digikam::ThumbnailLoadThread::find | ( | const ThumbnailIdentifier & | identifier, |
QPixmap & | pixmap | ||
) |
If the pixmap is found in the cache, returns true and sets pixmap to the found QPixmap. If the pixmap is not found in the cache, load() is called to start the loading process, false is returned and pixmap is not touched.
void Digikam::ThumbnailLoadThread::findGroup | ( | QList< ThumbnailIdentifier > & | identifiers | ) |
The items will be loaded in order and signals will be sent. Can be used to ensure that thumbnails are loaded in a particular order
|
static |
This shall be called once at application startup. This need not be called, then the FreeDesktop standard is used.
|
static |
This shall be called once at application startup. This need not be called, then the FreeDesktop standard is used. You can optionally provide a thumbnail info provider.
QList< LoadingDescription > Digikam::ThumbnailLoadThread::lastDescriptions | ( | ) | const |
After calling single-thumbnail methods (find, preload) the list will have size 1, after the group methods (findGroup, preloadGroup, pregenerateGroup) the list can be larger than 1. There is no information if the description was ever scheduled in the thread, already processed, skipped or canceled.
|
overridevirtual |
You do not need to use this method directly, it will not access the pixmap cache. Use find(). The LoadingDescription shall be constructed with the constructor for preview/thumbnail jobs. (in the description constructor, you need to specify file path, thumbnail size and Exif rotation)
Reimplemented from Digikam::ManagedLoadSaveThread.
|
static |
If you request a larger size, the thumbnail will not load. The size of the pixmap can slightly differ, especially when highlighting.
void Digikam::ThumbnailLoadThread::pregenerateGroup | ( | const QList< ThumbnailIdentifier > & | identifiers | ) |
No signals will be emitted when these are loaded.
void Digikam::ThumbnailLoadThread::preload | ( | const ThumbnailIdentifier & | identifier | ) |
This is essentially the same as loading, but with a lower priority.
|
static |
(currently it is only possible to set one global widget)
void Digikam::ThumbnailLoadThread::setHighlightPixmap | ( | bool | highlight | ) |
This option has only an effect if pixmapRequested is true. Default value: Enabled.
void Digikam::ThumbnailLoadThread::setPixmapRequested | ( | bool | wantPixmap | ) |
If you do not enable this, only the QImage-based signal (see LoadSaveThread) will be emitted.
If you disable this, pay attention to the (global) setting of the LoadingCache, which per default does not cache the images !!
Default value: Enabled.
void Digikam::ThumbnailLoadThread::setSendSurrogatePixmap | ( | bool | send | ) |
It will use standard system icons to replace the real thumbnail. If you disable this, a null QPixmap will be sent. This does not influence the QImage-based signal; this signal will be emitted with a null QImage regardless of this setting here, if the loading failed. Default value: Enabled.
void Digikam::ThumbnailLoadThread::setThumbnailSize | ( | int | size, |
bool | forFace = false |
||
) |
|
signal |
void Digikam::ThumbnailLoadThread::storeDetailThumbnail | ( | const QString & | filePath, |
const QRect & | detailRect, | ||
const QImage & | image, | ||
bool | isFace = false |
||
) |
Use this if possible because generation of detail thumbnails is potentially slower. The image should at least have storedSize().
ThumbnailCreator * Digikam::ThumbnailLoadThread::thumbnailCreator | ( | ) | const |
|
overrideprotectedvirtual |
Reimplemented from Digikam::LoadSaveThread.
|
signal |
int Digikam::ThumbnailLoadThread::thumbnailToPixmapSize | ( | int | size | ) | const |
These can differ when highlighting is turned on.