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

Public Types

enum  State { Inactive , Scheduled , Running , Deactivating }
 

Public Slots

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

Signals

void finished ()
 
void finished (bool success)
 
void progress (int progress)
 
void started ()
 
void starting ()
 

Public Member Functions

void addFilterAction (const FilterAction &action)
 
void addFilterActions (const QList< FilterAction > &actions)
 
QList< FilterActionappliedFilterActions () const
 
virtual void cancelFilter ()
 
bool completelyApplied () const
 
FilterAction failedAction () const
 
int failedActionIndex () const
 
QString failedActionMessage () const
 
FilterAction filterAction () override
 
 FilterActionFilter (QObject *const parent=nullptr)
 
QList< FilterActionfilterActions () const
 
QString filterIdentifier () const override
 
const QString & filterName ()
 
int filterVersion () const
 
DImg getTargetImage ()
 
bool isComplexAction () const
 
bool isFinished () const
 
bool isReproducible () const
 
bool isRunning () const
 
bool isSupported () const
 
QList< int > multithreadedSteps (int stop, int start=0) const
 
virtual bool parametersSuccessfullyRead () const
 
QThread::Priority priority () const
 
void readParameters (const FilterAction &) override
 
virtual QString readParametersError (const FilterAction &actionThatFailed) const
 
void setContinueOnError (bool cont)
 
void setEmitSignals (bool emitThem)
 
void setFilterAction (const FilterAction &action)
 
void setFilterActions (const QList< FilterAction > &actions)
 
void setFilterName (const QString &name)
 
void setFilterVersion (int version)
 
void setOriginalImage (const DImg &orgImage)
 
void setPriority (QThread::Priority priority)
 
void setupAndStartDirectly (const DImg &orgImage, DImgThreadedFilter *const master, int progressBegin=0, int progressEnd=100)
 
void setupFilter (const DImg &orgImage)
 
virtual void startFilter ()
 
virtual void startFilterDirectly ()
 
State state () const
 
virtual QList< int > supportedVersions () const
 
 ~FilterActionFilter () override
 

Protected Member Functions

virtual void cleanupFilter ()
 
void filterImage () override
 
virtual void initFilter ()
 
void initMaster ()
 
void initSlave (DImgThreadedFilter *const master, int progressBegin=0, int progressEnd=100)
 
virtual int modulateProgress (int progress)
 
void postProgress (int progress)
 
virtual void prepareDestImage ()
 
void run () override
 
bool runningFlag () const volatile
 
void setSlave (DImgThreadedFilter *const slave)
 
void shutDown ()
 
void start (QMutexLocker &locker)
 
void stop (QMutexLocker &locker)
 
QMutex * threadMutex () const
 
void wait (QMutexLocker &locker)
 

Protected Attributes

DImg m_destImage
 
DImgThreadedFilterm_master
 
QString m_name
 
DImg m_orgImage
 
int m_progressBegin
 
int m_progressCurrent
 To prevent signals bombarding with progress indicator value in postProgress(). More...
 
int m_progressSpan
 
DImgThreadedFilterm_slave
 
int m_version
 
bool m_wasCancelled
 

Member Enumeration Documentation

◆ State

Enumerator
Inactive 
Scheduled 
Running 
Deactivating 

Constructor & Destructor Documentation

◆ FilterActionFilter()

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

A meta-filter applying other filter according to a list of FilterActions

References Digikam::DImgThreadedFilter::initFilter().

◆ ~FilterActionFilter()

Digikam::FilterActionFilter::~FilterActionFilter ( )
override

Member Function Documentation

◆ addFilterAction()

void Digikam::FilterActionFilter::addFilterAction ( const FilterAction action)

◆ addFilterActions()

void Digikam::FilterActionFilter::addFilterActions ( const QList< FilterAction > &  actions)

◆ appliedFilterActions()

QList< FilterAction > Digikam::FilterActionFilter::appliedFilterActions ( ) const

Returns the list of applied filter actions. This is probably identical to filterActions, but it can differ in some situations:

  • if completelyApplied() is false, it will contain only the successful actions
  • the list is regenerated by the filters. If filterActions contains actions with an older version, still supported by the filter, the filter will now possibly return the newer, current version

◆ cancelFilter()

void Digikam::DImgThreadedFilter::cancelFilter ( )
virtualinherited

Cancel the threaded computation.

Reimplemented in Digikam::GreycstorationFilter.

References Digikam::DImgThreadedFilter::cleanupFilter(), Digikam::DynamicThread::isRunning(), Digikam::DImgThreadedFilter::m_slave, Digikam::DImgThreadedFilter::m_wasCancelled, Digikam::DynamicThread::stop(), and Digikam::DynamicThread::wait().

Referenced by DigikamBqmRestorationPlugin::RedEyeCorrection::cancel(), Digikam::GreycstorationFilter::cancelFilter(), Digikam::EditorToolThreaded::slotAbort(), Digikam::PreviewThreadWrapper::stopFilters(), Digikam::AntiVignettingFilter::~AntiVignettingFilter(), Digikam::AutoLevelsFilter::~AutoLevelsFilter(), Digikam::BCGFilter::~BCGFilter(), Digikam::BlurFilter::~BlurFilter(), Digikam::BlurFXFilter::~BlurFXFilter(), Digikam::BorderFilter::~BorderFilter(), Digikam::BWSepiaFilter::~BWSepiaFilter(), Digikam::CBFilter::~CBFilter(), Digikam::CharcoalFilter::~CharcoalFilter(), Digikam::ColorFXFilter::~ColorFXFilter(), Digikam::CurvesFilter::~CurvesFilter(), Digikam::DImgThreadedFilter::~DImgThreadedFilter(), Digikam::DistortionFXFilter::~DistortionFXFilter(), Digikam::EmbossFilter::~EmbossFilter(), Digikam::FilmFilter::~FilmFilter(), Digikam::FilmGrainFilter::~FilmGrainFilter(), Digikam::FreeRotationFilter::~FreeRotationFilter(), Digikam::HotPixelFixer::~HotPixelFixer(), Digikam::HSLFilter::~HSLFilter(), Digikam::IccTransformFilter::~IccTransformFilter(), Digikam::InfraredFilter::~InfraredFilter(), Digikam::InvertFilter::~InvertFilter(), Digikam::LensDistortionFilter::~LensDistortionFilter(), Digikam::LensFunFilter::~LensFunFilter(), Digikam::LevelsFilter::~LevelsFilter(), Digikam::LocalContrastFilter::~LocalContrastFilter(), Digikam::MixerFilter::~MixerFilter(), Digikam::NormalizeFilter::~NormalizeFilter(), Digikam::NRFilter::~NRFilter(), Digikam::OilPaintFilter::~OilPaintFilter(), Digikam::RainDropFilter::~RainDropFilter(), DigikamRawImportNativePlugin::RawPostProcessing::~RawPostProcessing(), Digikam::RawProcessingFilter::~RawProcessingFilter(), Digikam::RedEyeCorrectionFilter::~RedEyeCorrectionFilter(), Digikam::RefocusFilter::~RefocusFilter(), Digikam::SharpenFilter::~SharpenFilter(), Digikam::ShearFilter::~ShearFilter(), Digikam::StretchFilter::~StretchFilter(), Digikam::TextureFilter::~TextureFilter(), Digikam::TonalityFilter::~TonalityFilter(), Digikam::UnsharpMaskFilter::~UnsharpMaskFilter(), and Digikam::WBFilter::~WBFilter().

◆ cleanupFilter()

virtual void Digikam::DImgThreadedFilter::cleanupFilter ( )
inlineprotectedvirtualinherited

Clean up filter data if necessary, called by stopComputation() method. Override in subclass.

Referenced by Digikam::DImgThreadedFilter::cancelFilter().

◆ completelyApplied()

bool Digikam::FilterActionFilter::completelyApplied ( ) const

After the thread was run, you can find out if application was successful. A precondition is that at least isComplexAction() and isSupported() returns true. If all filters applied cleanly, completelyApplied() returns true. appliedActions() returns all applied actions, if completelyApplied(), the same as filterActions(). If not completelyApplied, failedAction() returns the action that failed, failedActionIndex its index in filterActions(), and failedActionMessage an optional error message. Note that finished(true) does not mean that completelyApplied() is also true.

◆ failedAction()

FilterAction Digikam::FilterActionFilter::failedAction ( ) const

◆ failedActionIndex()

int Digikam::FilterActionFilter::failedActionIndex ( ) const

◆ failedActionMessage()

QString Digikam::FilterActionFilter::failedActionMessage ( ) const

◆ filterAction()

FilterAction Digikam::FilterActionFilter::filterAction ( )
inlineoverridevirtual

These methods do not make sense here. Use filterActions.

Implements Digikam::DImgThreadedFilter.

◆ filterActions()

QList< FilterAction > Digikam::FilterActionFilter::filterActions ( ) const

◆ filterIdentifier()

QString Digikam::FilterActionFilter::filterIdentifier ( ) const
inlineoverridevirtual

Return the identifier for this filter in the image history.

Implements Digikam::DImgThreadedFilter.

◆ filterImage()

◆ filterName()

const QString& Digikam::DImgThreadedFilter::filterName ( )
inlineinherited

◆ filterVersion()

int Digikam::DImgThreadedFilter::filterVersion ( ) const
inherited

◆ finished [1/2]

◆ finished [2/2]

void Digikam::DImgThreadedFilter::finished ( bool  success)
signalinherited

Emitted when the computation has completed.

Parameters
successTrue if computation finished without interruption on valid data False if the thread was canceled, or no data is available.

◆ getTargetImage()

◆ initFilter()

void Digikam::DImgThreadedFilter::initFilter ( )
protectedvirtualinherited

Start filter operation before threaded method. Must be called by your constructor.

References Digikam::DImgThreadedFilter::m_master, Digikam::DImgThreadedFilter::prepareDestImage(), and Digikam::DImgThreadedFilter::startFilterDirectly().

Referenced by Digikam::AntiVignettingFilter::AntiVignettingFilter(), Digikam::AutoExpoFilter::AutoExpoFilter(), Digikam::AutoLevelsFilter::AutoLevelsFilter(), Digikam::BCGFilter::BCGFilter(), Digikam::BlurFilter::BlurFilter(), Digikam::BlurFXFilter::BlurFXFilter(), Digikam::BorderFilter::BorderFilter(), Digikam::BWSepiaFilter::BWSepiaFilter(), Digikam::CBFilter::CBFilter(), Digikam::CharcoalFilter::CharcoalFilter(), Digikam::ColorFXFilter::ColorFXFilter(), Digikam::ContentAwareFilter::ContentAwareFilter(), Digikam::CurvesFilter::CurvesFilter(), Digikam::DistortionFXFilter::DistortionFXFilter(), Digikam::EmbossFilter::EmbossFilter(), Digikam::EqualizeFilter::EqualizeFilter(), Digikam::FilmFilter::FilmFilter(), Digikam::FilmGrainFilter::FilmGrainFilter(), FilterActionFilter(), Digikam::FreeRotationFilter::FreeRotationFilter(), Digikam::HotPixelFixer::HotPixelFixer(), Digikam::HSLFilter::HSLFilter(), Digikam::IccTransformFilter::IccTransformFilter(), Digikam::InfraredFilter::InfraredFilter(), Digikam::InvertFilter::InvertFilter(), Digikam::LensDistortionFilter::LensDistortionFilter(), Digikam::LensFunFilter::LensFunFilter(), Digikam::LevelsFilter::LevelsFilter(), Digikam::LocalContrastFilter::LocalContrastFilter(), Digikam::MixerFilter::MixerFilter(), Digikam::NormalizeFilter::NormalizeFilter(), Digikam::NRFilter::NRFilter(), Digikam::OilPaintFilter::OilPaintFilter(), Digikam::RainDropFilter::RainDropFilter(), DigikamRawImportNativePlugin::RawPostProcessing::RawPostProcessing(), Digikam::RawProcessingFilter::RawProcessingFilter(), Digikam::RedEyeCorrectionFilter::RedEyeCorrectionFilter(), Digikam::RefocusFilter::RefocusFilter(), Digikam::DImgThreadedFilter::setupFilter(), Digikam::SharpenFilter::SharpenFilter(), Digikam::ShearFilter::ShearFilter(), Digikam::StretchFilter::StretchFilter(), Digikam::TextureFilter::TextureFilter(), Digikam::TonalityFilter::TonalityFilter(), Digikam::UnsharpMaskFilter::UnsharpMaskFilter(), and Digikam::WBFilter::WBFilter().

◆ initMaster()

◆ initSlave()

void Digikam::DImgThreadedFilter::initSlave ( DImgThreadedFilter *const  master,
int  progressBegin = 0,
int  progressEnd = 100 
)
protectedinherited

◆ isComplexAction()

bool Digikam::FilterActionFilter::isComplexAction ( ) const

Returns true if all FilterActions are reproducible or are ComplexFilters. That means the identical result may not be reproducible, but a sufficiently similar result may be available and apply will probably complete.

References Digikam::FilterAction::category(), Digikam::FilterAction::ComplexFilter, Digikam::FilterAction::isNull(), and Digikam::FilterAction::ReproducibleFilter.

◆ isFinished()

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

◆ isReproducible()

bool Digikam::FilterActionFilter::isReproducible ( ) const

Returns true if all FilterActions are reproducible

References Digikam::FilterAction::category(), Digikam::FilterAction::isNull(), and Digikam::FilterAction::ReproducibleFilter.

◆ isRunning()

◆ isSupported()

bool Digikam::FilterActionFilter::isSupported ( ) const

◆ modulateProgress()

int Digikam::DImgThreadedFilter::modulateProgress ( int  progress)
protectedvirtualinherited

This method modulates the progress value from the 0..100 span to the span of this slave. Called by postProgress if master is not null.

References Digikam::DImgThreadedFilter::m_progressBegin, Digikam::DImgThreadedFilter::m_progressSpan, and Digikam::DImgThreadedFilter::progress().

Referenced by Digikam::DImgThreadedFilter::postProgress(), and Digikam::RawProcessingFilter::postProgress().

◆ multithreadedSteps()

QList< int > Digikam::DImgThreadedFilter::multithreadedSteps ( int  stop,
int  start = 0 
) const
inherited

This method return a list of steps to process parallelized operation in filter using QtConcurrents API. Usually, start and stop are rows or columns from image to process. By default, whole image will be processed and start value is 0. In this case stop will be last row or column to process. Between range [start,stop], this method will divide by equal steps depending of number of CPU cores available. To be sure that all values will be processed, in case of CPU core division give rest, the last step compensate the difference. See Blur filter loop implementation for example to see how to use this method with QtConcurrents API.

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

◆ parametersSuccessfullyRead()

bool Digikam::DImgThreadedFilter::parametersSuccessfullyRead ( ) const
virtualinherited

Optional: error handling for readParameters. When readParameters() has been called, this method will return true if the call was successful, and false if not. If returning false, readParametersError() will give an error message. The default implementation always returns success. You only need to reimplement when a filter is likely to fail in a different environment, e.g. depending on availability of installed files. These methods have an undefined return value if readParameters() was not called previously.

Reimplemented in Digikam::IccTransformFilter.

◆ postProgress()

◆ prepareDestImage()

◆ priority()

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

◆ progress

void Digikam::DImgThreadedFilter::progress ( int  progress)
signalinherited

◆ readParameters()

void Digikam::FilterActionFilter::readParameters ( const FilterAction )
inlineoverridevirtual

◆ readParametersError()

QString Digikam::DImgThreadedFilter::readParametersError ( const FilterAction actionThatFailed) const
virtualinherited

Reimplemented in Digikam::IccTransformFilter.

◆ run()

void Digikam::DImgThreadedFilter::run ( )
overrideprotectedvirtualinherited

List of threaded operations by filter.

Implements Digikam::DynamicThread.

References Digikam::DImgThreadedFilter::startFilterDirectly().

◆ runningFlag()

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

◆ setContinueOnError()

void Digikam::FilterActionFilter::setContinueOnError ( bool  cont)

Per default, the filter will stop when it encounters an unsupported action. If you want it to continue, set this to true. Only the last occurred error will then be reported.

◆ setEmitSignals()

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

◆ setFilterAction()

void Digikam::FilterActionFilter::setFilterAction ( const FilterAction action)

◆ setFilterActions()

void Digikam::FilterActionFilter::setFilterActions ( const QList< FilterAction > &  actions)

Set - or add to existing list - the given filter actions

◆ setFilterName()

void Digikam::DImgThreadedFilter::setFilterName ( const QString &  name)
inherited

◆ setFilterVersion()

void Digikam::DImgThreadedFilter::setFilterVersion ( int  version)
inherited

Replaying a filter action: Set the filter version. A filter may implement different versions, to preserve image history when the algorithm is changed. Any value set here must be contained in supportedVersions, otherwise this call will be ignored. Default value is 1. (Note: If you intend to record a filter action, please look at FilterAction's m_version)

References Digikam::DImgThreadedFilter::m_version, and Digikam::DImgThreadedFilter::supportedVersions().

◆ setOriginalImage()

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

◆ setSlave()

void Digikam::DImgThreadedFilter::setSlave ( DImgThreadedFilter *const  slave)
protectedinherited

Inform the master that there is currently a slave. At destruction of the slave, call with slave=0.

References Digikam::DImgThreadedFilter::m_slave.

Referenced by Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::~DImgThreadedFilter().

◆ setupAndStartDirectly()

void Digikam::DImgThreadedFilter::setupAndStartDirectly ( const DImg orgImage,
DImgThreadedFilter *const  master,
int  progressBegin = 0,
int  progressEnd = 100 
)
inherited

Initializes the filter for use as a slave and directly starts computation (in-thread)

References Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::setupFilter().

◆ setupFilter()

void Digikam::DImgThreadedFilter::setupFilter ( const DImg orgImage)
inherited

You need to call this and then start filter of you used the constructor not setting an original image. The original image's data will not be copied.

References Digikam::DImgThreadedFilter::initFilter(), and Digikam::DImgThreadedFilter::setOriginalImage().

Referenced by DigikamRAWDImgPlugin::DImgRAWLoader::postProcess(), and Digikam::DImgThreadedFilter::setupAndStartDirectly().

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

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

◆ started

void Digikam::DImgThreadedFilter::started ( )
signalinherited

This signal is emitted when image data is available and the computation has started.

Referenced by Digikam::DImgThreadedFilter::startFilterDirectly().

◆ startFilter()

◆ startFilterDirectly()

◆ 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

◆ supportedVersions()

QList< int > Digikam::DImgThreadedFilter::supportedVersions ( ) const
virtualinherited

◆ threadMutex()

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

◆ wait [1/2]

◆ wait() [2/2]

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

Member Data Documentation

◆ m_destImage

◆ m_master

DImgThreadedFilter* Digikam::DImgThreadedFilter::m_master
protectedinherited

◆ m_name

QString Digikam::DImgThreadedFilter::m_name
protectedinherited

◆ m_orgImage

◆ m_progressBegin

int Digikam::DImgThreadedFilter::m_progressBegin
protectedinherited

The progress span that a slave filter uses in the parent filter's progress.

Referenced by Digikam::DImgThreadedFilter::initMaster(), Digikam::DImgThreadedFilter::initSlave(), and Digikam::DImgThreadedFilter::modulateProgress().

◆ m_progressCurrent

int Digikam::DImgThreadedFilter::m_progressCurrent
protectedinherited

◆ m_progressSpan

int Digikam::DImgThreadedFilter::m_progressSpan
protectedinherited

◆ m_slave

DImgThreadedFilter* Digikam::DImgThreadedFilter::m_slave
protectedinherited

◆ m_version

int Digikam::DImgThreadedFilter::m_version
protectedinherited

◆ m_wasCancelled

bool Digikam::DImgThreadedFilter::m_wasCancelled
protectedinherited

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