digiKam
Digikam::LoadSaveThread Class Reference
+ Inheritance diagram for Digikam::LoadSaveThread:

Public Types

enum  AccessMode { AccessModeRead , AccessModeReadWrite }
 
enum  NotificationPolicy { NotificationPolicyDirect , NotificationPolicyTimeLimited }
 
enum  State { Inactive , Scheduled , Running , Deactivating }
 

Public Slots

void start ()
 
void stop ()
 
void wait ()
 

Signals

void finished ()
 
void signalImageLoaded (const LoadingDescription &loadingDescription, const DImg &img)
 
void signalImageSaved (const QString &filePath, bool success)
 
void signalImageStartedLoading (const LoadingDescription &loadingDescription)
 
void signalImageStartedSaving (const QString &filePath)
 
void signalLoadingProgress (const LoadingDescription &loadingDescription, float progress)
 
void signalMoreCompleteLoadingAvailable (const LoadingDescription &oldLoadingDescription, const LoadingDescription &newLoadingDescription)
 
void signalSavingProgress (const QString &filePath, float progress)
 
void signalThumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img)
 
void starting ()
 

Public Member Functions

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
 
bool isFinished () const
 
bool isRunning () const
 
void load (const LoadingDescription &description)
 
void loadingProgress (const LoadingDescription &loadingDescription, float progress) override
 
 LoadSaveThread (QObject *const parent=nullptr)
 
void moreCompleteLoadingAvailable (const LoadingDescription &oldLoadingDescription, const LoadingDescription &newLoadingDescription) override
 
QThread::Priority priority () const
 
virtual bool querySendNotifyEvent () const
 
void save (const DImg &image, const QString &filePath, const QString &format)
 
void savingProgress (const QString &filePath, float progress) override
 
void setEmitSignals (bool emitThem)
 
void setNotificationPolicy (NotificationPolicy notificationPolicy)
 
void setPriority (QThread::Priority priority)
 
State state () const
 
virtual void taskHasFinished ()
 
void thumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img) override
 
 ~LoadSaveThread () override
 

Static Public Member Functions

static int exifOrientation (const QString &filePath, const DMetadata &metadata, bool isRaw, bool fromRawEmbeddedPreview)
 
static LoadSaveFileInfoProviderinfoProvider ()
 
static void setInfoProvider (LoadSaveFileInfoProvider *const infoProvider)
 

Protected Member Functions

void notificationReceived ()
 
void run () override
 
bool runningFlag () const volatile
 
void shutDown ()
 
void start (QMutexLocker &locker)
 
void stop (QMutexLocker &locker)
 
QMutex * threadMutex () const
 
void wait (QMutexLocker &locker)
 

Protected Attributes

LoadSaveTaskm_currentTask
 
QMutex m_mutex
 
NotificationPolicy m_notificationPolicy
 
QList< LoadSaveTask * > m_todo
 

Member Enumeration Documentation

◆ AccessMode

used by SharedLoadSaveThread only

Enumerator
AccessModeRead 

image will only be used for reading

AccessModeReadWrite 

image data will possibly be changed

◆ 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.

◆ State

Enumerator
Inactive 
Scheduled 
Running 
Deactivating 

Constructor & Destructor Documentation

◆ LoadSaveThread()

Digikam::LoadSaveThread::LoadSaveThread ( QObject *const  parent = nullptr)
explicit

◆ ~LoadSaveThread()

Digikam::LoadSaveThread::~LoadSaveThread ( )
override

Destructor: The thread will execute all pending tasks and wait for this upon destruction

References Digikam::DynamicThread::shutDown().

Member Function Documentation

◆ exifOrientation()

int Digikam::LoadSaveThread::exifOrientation ( const QString &  filePath,
const DMetadata metadata,
bool  isRaw,
bool  fromRawEmbeddedPreview 
)
static

◆ finished

◆ imageLoaded()

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

◆ imageSaved()

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

◆ imageStartedLoading()

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

◆ imageStartedSaving()

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

◆ infoProvider()

LoadSaveFileInfoProvider * Digikam::LoadSaveThread::infoProvider ( )
static

Referenced by exifOrientation(), and setInfoProvider().

◆ isFinished()

bool Digikam::DynamicThread::isFinished ( ) const
inherited

◆ isRunning()

◆ load()

void Digikam::LoadSaveThread::load ( const LoadingDescription description)

Append a task to load the given file to the task list

References m_todo, Digikam::DynamicThread::start(), and Digikam::DynamicThread::threadMutex().

◆ loadingProgress()

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

◆ moreCompleteLoadingAvailable()

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

◆ notificationReceived()

◆ priority()

QThread::Priority Digikam::DynamicThread::priority ( ) const
inherited

◆ querySendNotifyEvent()

◆ run()

void Digikam::LoadSaveThread::run ( )
overrideprotectedvirtual

◆ runningFlag()

bool Digikam::DynamicThread::runningFlag ( ) const volatile
protectedinherited

◆ save()

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

Append a task to save the image to the task list

References m_todo, Digikam::DynamicThread::start(), and Digikam::DynamicThread::threadMutex().

◆ savingProgress()

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

◆ setEmitSignals()

void Digikam::DynamicThread::setEmitSignals ( bool  emitThem)
inherited

◆ setInfoProvider()

void Digikam::LoadSaveThread::setInfoProvider ( LoadSaveFileInfoProvider *const  infoProvider)
static

◆ setNotificationPolicy()

void Digikam::LoadSaveThread::setNotificationPolicy ( NotificationPolicy  notificationPolicy)

References m_notificationPolicy.

◆ setPriority()

void Digikam::DynamicThread::setPriority ( QThread::Priority  priority)
inherited

Sets the priority for this dynamic thread. Can be set anytime. If the thread is currently not running, the priority will be set when it is run next time. When you set QThread::InheritPriority (default), the priority is not changed but inherited from the thread pool.

References Digikam::DynamicThread::priority().

Referenced by Digikam::FacePipeline::Private::applyPriority(), and Digikam::FacePipeline::Private::createThumbnailLoadThread().

◆ shutDown()

void Digikam::DynamicThread::shutDown ( )
protectedinherited

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. Note: This irrevocably stops this object. Note: It is not sufficient that your parent class does this. Calling this method, or providing one of the above mentioned equivalent guarantees, must be done by every single last class in the hierarchy with an implemented destructor deleting data. (the base class destructor is always called after the derived class)

References Digikam::DynamicThread::stop(), and Digikam::DynamicThread::wait().

Referenced by Digikam::ManagedLoadSaveThread::shutDown(), Digikam::DynamicThread::~DynamicThread(), and ~LoadSaveThread().

◆ signalImageLoaded

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

This signal is emitted when the loading process has finished. If the process failed, img is null.

Referenced by Digikam::FacePreviewLoader::FacePreviewLoader(), and imageLoaded().

◆ signalImageSaved

void Digikam::LoadSaveThread::signalImageSaved ( const QString &  filePath,
bool  success 
)
signal

Referenced by imageSaved().

◆ signalImageStartedLoading

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

All signals are delivered to the thread from where the LoadSaveThread object has been created. 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.

Referenced by imageStartedLoading().

◆ signalImageStartedSaving

void Digikam::LoadSaveThread::signalImageStartedSaving ( const QString &  filePath)
signal

Referenced by imageStartedSaving().

◆ signalLoadingProgress

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

This signal is emitted whenever new progress info is available and the notification policy allows emitting the signal. No progress info will be sent for preloaded images (ManagedLoadSaveThread).

Referenced by loadingProgress().

◆ signalMoreCompleteLoadingAvailable

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

This signal is emitted if

  • 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

Referenced by moreCompleteLoadingAvailable().

◆ signalSavingProgress

void Digikam::LoadSaveThread::signalSavingProgress ( const QString &  filePath,
float  progress 
)
signal

Referenced by savingProgress().

◆ signalThumbnailLoaded

void Digikam::LoadSaveThread::signalThumbnailLoaded ( const LoadingDescription loadingDescription,
const QImage &  img 
)
signal

Referenced by thumbnailLoaded().

◆ start [1/2]

◆ start() [2/2]

void Digikam::DynamicThread::start ( QMutexLocker &  locker)
protectedinherited

Doing the same as start(), stop() and wait above, provide it with a locked QMutexLocker on mutex(). Note the start() will unlock and relock for scheduling once, after state change.

References Digikam::ThreadManager::instance(), and Digikam::ThreadManager::schedule().

◆ starting

void Digikam::DynamicThread::starting ( )
signalinherited

Emitted if emitSignals is enabled

◆ state()

◆ stop [1/2]

◆ stop() [2/2]

void Digikam::DynamicThread::stop ( QMutexLocker &  locker)
protectedinherited

◆ taskHasFinished()

◆ threadMutex()

QMutex * Digikam::DynamicThread::threadMutex ( ) const
protectedinherited

◆ thumbnailLoaded()

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

◆ wait [1/2]

◆ wait() [2/2]

void Digikam::DynamicThread::wait ( QMutexLocker &  locker)
protectedinherited

Member Data Documentation

◆ m_currentTask

◆ m_mutex

QMutex Digikam::LoadSaveThread::m_mutex
protected

◆ m_notificationPolicy

NotificationPolicy Digikam::LoadSaveThread::m_notificationPolicy
protected

◆ m_todo


The documentation for this class was generated from the following files: