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

Public Types

enum  AccessMode { AccessModeRead , AccessModeReadWrite }
 
enum  LoadingMode { LoadingModeNormal , LoadingModeShared }
 
enum  LoadingPolicy {
  LoadingPolicyFirstRemovePrevious , LoadingPolicyPrepend , LoadingPolicySimplePrepend , LoadingPolicyAppend ,
  LoadingPolicySimpleAppend , LoadingPolicyPreload
}
 
enum  LoadingTaskFilter { LoadingTaskFilterAll , LoadingTaskFilterPreloading }
 
enum  NotificationPolicy { NotificationPolicyDirect , NotificationPolicyTimeLimited }
 
enum  State { Inactive , Scheduled , Running , Deactivating }
 
enum  TerminationPolicy { TerminationPolicyTerminateLoading , TerminationPolicyTerminatePreloading , TerminationPolicyWait , TerminationPolicyTerminateAll }
 

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 load (const LoadingDescription &description, AccessMode mode, LoadingPolicy policy=LoadingPolicyAppend)
 
void load (const LoadingDescription &description, LoadingPolicy policy)
 
LoadingPolicy loadingPolicy () const
 
void loadingProgress (const LoadingDescription &loadingDescription, float progress) override
 
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 save (DImg &image, const QString &filePath, const QString &format)
 
void savingProgress (const QString &filePath, float progress) override
 
void setEmitSignals (bool emitThem)
 
void setLoadingPolicy (LoadingPolicy policy)
 
void setNotificationPolicy (NotificationPolicy notificationPolicy)
 
void setPriority (QThread::Priority priority)
 
void setTerminationPolicy (TerminationPolicy terminationPolicy)
 
 SharedLoadSaveThread (QObject *const parent=nullptr)
 
State state () const
 
void stopAllTasks ()
 
void stopLoading (const LoadingDescription &desc, LoadingTaskFilter filter=LoadingTaskFilterAll)
 
void stopLoading (const QString &filePath=QString(), LoadingTaskFilter filter=LoadingTaskFilterAll)
 
void stopSaving (const QString &filePath=QString())
 
virtual void taskHasFinished ()
 
TerminationPolicy terminationPolicy () const
 
void thumbnailLoaded (const LoadingDescription &loadingDescription, const QImage &img) override
 
 ~SharedLoadSaveThread () 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 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 notificationReceived ()
 
void preloadThumbnail (const LoadingDescription &description)
 
void preloadThumbnailGroup (const QList< LoadingDescription > &descriptions)
 
void prependThumbnailGroup (const QList< LoadingDescription > &descriptions)
 
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
 
LoadingPolicy m_loadingPolicy
 
QMutex m_mutex
 
NotificationPolicy m_notificationPolicy
 
TerminationPolicy m_terminationPolicy
 
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

◆ LoadingMode

used by SharedLoadSaveThread only

Enumerator
LoadingModeNormal 

no sharing of loading process, no caching of image

LoadingModeShared 

loading process is shared, image is cached

◆ LoadingPolicy

Enumerator
LoadingPolicyFirstRemovePrevious 

Load image immediately, remove and stop all previous loading tasks.

LoadingPolicyPrepend 

Prepend loading in front of all other tasks, but wait for the current task to finish. No other tasks will be removed, preloading tasks will be stopped and postponed.

LoadingPolicySimplePrepend 

Prepend in front of all other tasks (not touching the current task). Do not check for duplicate tasks, do not check for preloading tasks.

LoadingPolicyAppend 

Append loading task to the end of the list, but in front of all preloading tasks. No other tasks will be removed, preloading tasks will be stopped and postponed. This is similar to the simple load() operation from LoadSaveThread, except for the special care taken for preloading.

LoadingPolicySimpleAppend 

Append to the lists of tasks. Do not check for duplicate tasks, do not check for preloading tasks.

LoadingPolicyPreload 

Preload image, i.e. load it with low priority when no other tasks are scheduled. All other tasks will take precedence, and preloading tasks will be stopped and postponed when another task is added. No progress info will be sent for preloaded images

◆ LoadingTaskFilter

Enumerator
LoadingTaskFilterAll 

filter all loading tasks

LoadingTaskFilterPreloading 

filter only tasks with preloading policy

◆ 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 

◆ TerminationPolicy

Enumerator
TerminationPolicyTerminateLoading 

Wait for saving tasks, stop and remove loading tasks This is the default.

TerminationPolicyTerminatePreloading 

Wait for loading and saving tasks, stop and remove preloading tasks

TerminationPolicyWait 

Wait for all pending tasks

TerminationPolicyTerminateAll 

Stop all pending tasks

Constructor & Destructor Documentation

◆ SharedLoadSaveThread()

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

◆ ~SharedLoadSaveThread()

Digikam::SharedLoadSaveThread::~SharedLoadSaveThread ( )
override

Member Function Documentation

◆ exifOrientation()

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

◆ finished

◆ imageLoaded()

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

◆ imageSaved()

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

◆ imageStartedLoading()

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

◆ imageStartedSaving()

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

◆ infoProvider()

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

◆ isFinished()

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

◆ isRunning()

◆ load() [1/5]

void Digikam::ManagedLoadSaveThread::load ( const LoadingDescription description)
inherited

Append a task to load the given file to the task list. If there is already a task for the given file, it will possibly be rescheduled, but no second task will be added. Only loading tasks will - if required by the policy - be stopped or removed, saving tasks will not be touched.

References Digikam::ManagedLoadSaveThread::LoadingModeNormal, and Digikam::ManagedLoadSaveThread::m_loadingPolicy.

Referenced by load(), Digikam::ManagedLoadSaveThread::load(), Digikam::ManagedLoadSaveThread::loadPreview(), and Digikam::ManagedLoadSaveThread::save().

◆ load() [2/5]

void Digikam::SharedLoadSaveThread::load ( const LoadingDescription description,
AccessMode  mode,
LoadingPolicy  policy = LoadingPolicyAppend 
)

◆ load() [3/5]

void Digikam::ManagedLoadSaveThread::load ( const LoadingDescription description,
LoadingMode  loadingMode,
AccessMode  mode = AccessModeReadWrite 
)
protectedinherited

◆ load() [4/5]

◆ load() [5/5]

void Digikam::ManagedLoadSaveThread::load ( const LoadingDescription description,
LoadingPolicy  policy 
)
inherited

◆ loadingPolicy()

ManagedLoadSaveThread::LoadingPolicy Digikam::ManagedLoadSaveThread::loadingPolicy ( ) const
inherited

◆ loadingProgress()

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

◆ loadPreview()

void Digikam::ManagedLoadSaveThread::loadPreview ( const LoadingDescription description,
LoadingPolicy  policy 
)
protectedinherited

◆ loadThumbnail()

◆ moreCompleteLoadingAvailable()

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

◆ notificationReceived()

◆ preloadThumbnail()

◆ preloadThumbnailGroup()

◆ prependThumbnailGroup()

void Digikam::ManagedLoadSaveThread::prependThumbnailGroup ( const QList< LoadingDescription > &  descriptions)
protectedinherited

◆ priority()

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

◆ querySendNotifyEvent()

◆ run()

◆ runningFlag()

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

◆ save() [1/2]

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

Append a task to save the image to the task list

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

◆ save() [2/2]

◆ savingProgress()

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

◆ setEmitSignals()

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

◆ setInfoProvider()

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

◆ setLoadingPolicy()

void Digikam::ManagedLoadSaveThread::setLoadingPolicy ( LoadingPolicy  policy)
inherited

Set the loading policy. Default is LoadingPolicyAppend. You can override the default value for each operation.

References Digikam::ManagedLoadSaveThread::m_loadingPolicy.

Referenced by Digikam::FacePreviewLoader::FacePreviewLoader().

◆ setNotificationPolicy()

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

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

◆ setTerminationPolicy()

void Digikam::ManagedLoadSaveThread::setTerminationPolicy ( TerminationPolicy  terminationPolicy)
inherited

◆ shutDown()

◆ signalImageLoaded

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

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

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

◆ signalImageSaved

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

◆ signalImageStartedLoading

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

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 Digikam::LoadSaveThread::imageStartedLoading().

◆ signalImageStartedSaving

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

◆ signalLoadingProgress

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

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 Digikam::LoadSaveThread::loadingProgress().

◆ signalMoreCompleteLoadingAvailable

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

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 Digikam::LoadSaveThread::moreCompleteLoadingAvailable().

◆ signalSavingProgress

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

◆ signalThumbnailLoaded

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

◆ 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

◆ stopAllTasks()

◆ stopLoading() [1/2]

void Digikam::ManagedLoadSaveThread::stopLoading ( const LoadingDescription desc,
LoadingTaskFilter  filter = LoadingTaskFilterAll 
)
inherited

Same than previous method, but Stop and remove tasks filtered by LoadingDescription.

References Digikam::DynamicThread::threadMutex().

◆ stopLoading() [2/2]

void Digikam::ManagedLoadSaveThread::stopLoading ( const QString &  filePath = QString(),
LoadingTaskFilter  filter = LoadingTaskFilterAll 
)
inherited

Stop and remove tasks filtered by filePath and policy. If filePath isNull, applies to all file paths.

References Digikam::DynamicThread::threadMutex().

Referenced by Digikam::EditorCore::load().

◆ stopSaving()

void Digikam::ManagedLoadSaveThread::stopSaving ( const QString &  filePath = QString())
inherited

◆ taskHasFinished()

◆ terminationPolicy()

ManagedLoadSaveThread::TerminationPolicy Digikam::ManagedLoadSaveThread::terminationPolicy ( ) const
inherited

◆ threadMutex()

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

◆ thumbnailLoaded()

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

◆ wait [1/2]

◆ wait() [2/2]

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

Member Data Documentation

◆ m_currentTask

◆ m_loadingPolicy

◆ m_mutex

QMutex Digikam::LoadSaveThread::m_mutex
protectedinherited

◆ m_notificationPolicy

◆ m_terminationPolicy

◆ m_todo


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