digiKam Developer Documentation: Digikam::LoadSaveThread Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Digikam::LoadSaveThread Class Reference
Inheritance diagram for Digikam::LoadSaveThread:

## Public Types
enum | AccessMode { AccessModeRead , AccessModeReadWrite }
| used by SharedLoadSaveThread only More...
enum | NotificationPolicy { NotificationPolicyDirect , NotificationPolicyTimeLimited }
Public Types inherited from Digikam::DynamicThread
enum | State { Inactive , Scheduled , Running , Deactivating }

## Signals
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)
Signals inherited from Digikam::DynamicThread
void | finished ()
void | starting ()
| Emitted if emitSignals is enabled.

## Public Member Functions
| 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
virtual void | load (const LoadingDescription &description)
| Append a task to load the given file to the task list.
void | loadingProgress (const LoadingDescription &loadingDescription, float progress) override
void | moreCompleteLoadingAvailable (const LoadingDescription &oldLoadingDescription, const LoadingDescription &newLoadingDescription) override
virtual bool | querySendNotifyEvent () const
virtual void | save (const DImg &image, const QString &filePath, const QString &format)
| Append a task to save the image to the task list.
void | savingProgress (const QString &filePath, float progress) override
void | setNotificationPolicy (NotificationPolicy notificationPolicy)
virtual void | taskHasFinished ()
void | thumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img) override
Public Member Functions inherited from Digikam::DynamicThread
| 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 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 | notificationReceived ()
void | run () override
| Implement this pure virtual function in your subclass.
Protected Member Functions inherited from Digikam::DynamicThread
bool | runningFlag () const volatile
| In you run() method, you shall regularly check for runningFlag() and cleanup and return if false.
virtual void | shutDown ()
| 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 | 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)

## Protected Attributes
LoadSaveTask * | m_currentTask = nullptr
QMutex | m_mutex
NotificationPolicy | m_notificationPolicy = NotificationPolicyTimeLimited
QList< LoadSaveTask * > | m_todo

## Additional Inherited Members
Public Slots inherited from Digikam::DynamicThread
void | start ()
void | stop ()
| Stop computation, sets the running flag to false.
void | wait ()
| Waits until the thread finishes.

## Member Enumeration Documentation

## ◆ AccessMode

enum Digikam::LoadSaveThread::AccessMode

Enumerator
AccessModeRead | image will only be used for reading
AccessModeReadWrite | image data will possibly be changed

## ◆ NotificationPolicy

enum Digikam::LoadSaveThread::NotificationPolicy

Enumerator
NotificationPolicyDirect | Always send notification, unless the last event is still in the event queue.
NotificationPolicyTimeLimited | Always wait for a certain amount of time after the last event sent. In particular, the first event will be sent only after waiting for this time span. (Or no event will be sent, when the loading has finished before) This is the default.

## Member Function Documentation

## ◆ imageLoaded()

void Digikam::LoadSaveThread::imageLoaded | ( | const LoadingDescription & | loadingDescription,
|  | const DImg & | img
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ imageSaved()

void Digikam::LoadSaveThread::imageSaved | ( | const QString & | filePath,
|  | bool | success
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ imageStartedLoading()

void Digikam::LoadSaveThread::imageStartedLoading | ( | const LoadingDescription & | loadingDescription | ) |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ imageStartedSaving()

void Digikam::LoadSaveThread::imageStartedSaving | ( | const QString & | filePath | ) |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ load()

void Digikam::LoadSaveThread::load | ( | const LoadingDescription & | description | ) |
| virtual

Reimplemented in Digikam::ManagedLoadSaveThread, Digikam::PreviewLoadThread, and Digikam::ThumbnailLoadThread.

## ◆ loadingProgress()

void Digikam::LoadSaveThread::loadingProgress | ( | const LoadingDescription & | loadingDescription,
|  | float | progress
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ moreCompleteLoadingAvailable()

void Digikam::LoadSaveThread::moreCompleteLoadingAvailable | ( | const LoadingDescription & | oldLoadingDescription,
|  | const LoadingDescription & | newLoadingDescription
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ run()

void Digikam::LoadSaveThread::run | ( |  | ) |
| overrideprotectedvirtual

Implements Digikam::DynamicThread.

## ◆ save()

void Digikam::LoadSaveThread::save | ( | const DImg & | image,
|  | const QString & | filePath,
|  | const QString & | format
| ) |  |
| virtual

Reimplemented in Digikam::ManagedLoadSaveThread.

## ◆ savingProgress()

void Digikam::LoadSaveThread::savingProgress | ( | const QString & | filePath,
|  | float | progress
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

## ◆ signalImageLoaded

void Digikam::LoadSaveThread::signalImageLoaded | ( | const LoadingDescription & | loadingDescription,
|  | const DImg & | img
| ) |  |
| signal

If the process failed, img is null.

## ◆ signalImageStartedLoading

void Digikam::LoadSaveThread::signalImageStartedLoading | ( | const LoadingDescription & | loadingDescription | ) |
| signal

This thread must use its event loop to get the signals. You must connect to these signals with Qt::AutoConnection (default) or Qt::QueuedConnection. This signal is emitted when the loading process begins.

## ◆ signalLoadingProgress

void Digikam::LoadSaveThread::signalLoadingProgress | ( | const LoadingDescription & | loadingDescription,
|  | float | progress
| ) |  |
| signal

No progress info will be sent for preloaded images (ManagedLoadSaveThread).

## ◆ signalMoreCompleteLoadingAvailable

void Digikam::LoadSaveThread::signalMoreCompleteLoadingAvailable | ( | const LoadingDescription & | oldLoadingDescription,
|  | const LoadingDescription & | newLoadingDescription
| ) |  |
| signal

- you are doing shared loading (SharedLoadSaveThread)
- you started a loading operation with a LoadingDescription for a reduced version of the image
- another thread started a loading operation for a more complete version You may want to cancel the current operation and start with the given loadingDescription

## ◆ thumbnailLoaded()

void Digikam::LoadSaveThread::thumbnailLoaded | ( | const LoadingDescription & | loadingDescription,
|  | const QImage & | img
| ) |  |
| overridevirtual

Implements Digikam::LoadSaveNotifier.

Reimplemented in Digikam::ThumbnailLoadThread.