digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::BatchTool Class Referenceabstract
+ Inheritance diagram for Digikam::BatchTool:

Public Types

enum  BatchToolGroup {
  BaseTool = 0 , CustomTool , ColorTool , EnhanceTool ,
  TransformTool , DecorateTool , FiltersTool , ConvertTool ,
  MetadataTool
}
 

Public Slots

virtual void slotResetSettingsToDefault ()
 
void slotSettingsChanged (const BatchToolSettings &settings)
 

Signals

void signalAssignSettings2Widget ()
 Only used internally.
 
void signalSettingsChanged (const BatchToolSettings &)
 
void signalVisible (bool)
 

Public Member Functions

 BatchTool (const QString &name, BatchToolGroup group, QObject *const parent=nullptr)
 Tool data and properties management.
 
bool apply ()
 Apply all change to perform by this tool.
 
virtual void cancel ()
 Re-implement this method is you want customize cancellation of tool, for ex.
 
virtual BatchToolclone (QObject *const parent=nullptr) const =0
 Clone this tool without to create settings widget.
 
virtual BatchToolSettings defaultSettings ()=0
 Re-implement this method to initialize Settings Widget value with default settings.
 
void deleteSettingsWidget ()
 Delete dedicated settings widget registered with registerSettingsWidget().
 
QString errorDescription () const
 Get description of an error which appear during apply() method.
 
bool getBranchHistory () const
 
bool getNeedResetExifOrientation () const
 Returns true if the Exif orientation tag should be reset after tool operation.
 
bool getResetExifOrientationAllowed () const
 Returns true if the Exif orientation tag is allowed to be reset after tool operation.
 
DImg imageData () const
 
ItemInfo imageInfo () const
 
QUrl inputUrl () const
 
IOFileSettings ioFileSettings () const
 Return IOFile settings used during tool operations.
 
bool isLastChainedTool () const
 
bool loadToDImg () const
 Load image data using input Url set by setInputUrl() to instance of internal DImg container.
 
virtual QString outputSuffix () const
 Re-implement this method if tool change file extension during batch process (ex: "png").
 
QUrl outputUrl () const
 
DPluginBqmplugin () const
 
DRawDecoderSettings rawDecodingSettings () const
 Return RAW decoding settings used during tool operations.
 
virtual void registerSettingsWidget ()
 Setup dedicated settings widget.
 
bool savefromDImg () const
 Save image data from instance of internal DImg container using :
 
void setBranchHistory (bool branch=true)
 Applies only when the file is actually saved on disk, and takes the history since the loading from disk to set the first added step as creating a branch.
 
void setDRawDecoderSettings (const DRawDecoderSettings &settings)
 Set-up RAW decoding settings no use during tool operations.
 
void setImageData (const DImg &img)
 Manage instance of current image data container loaded by this tool.
 
void setInputUrl (const QUrl &inputUrl)
 Manage current input url processed by this tool.
 
void setIOFileSettings (const IOFileSettings &settings)
 Set-up IOFile settings no use during tool operations.
 
void setItemInfo (const ItemInfo &info)
 Manage instance of current image info loaded by this tool.
 
void setLastChainedTool (bool last)
 Manage flag properties to indicate if this tool is last one to process on current item.
 
void setNeedResetExifOrientation (bool reset)
 Set that the Exif orientation flag should be reset to NORMAL after tool operation.
 
void setOutputUrl (const QUrl &outputUrl)
 Manage current output url processed by this tool.
 
void setOutputUrlFromInputUrl ()
 Set output url using input url content + annotation based on time stamp + file extension defined by outputSuffix().
 
void setPlugin (DPluginBqm *const plugin)
 
void setRawLoadingRules (QueueSettings::RawLoadingRule rule)
 Set that RAW files loading rule to use (demosaicing or JPEG embedded).
 
void setResetExifOrientationAllowed (bool reset)
 Set that the Exif orientation flag is allowed be reset to NORMAL after tool operation.
 
void setSaveAsNewVersion (bool fork=true)
 Sets if the history added by tools shall be made a branch (new version).
 
void setSettings (const BatchToolSettings &settings)
 Manage settings values to tool.
 
BatchToolSettings settings () const
 
QWidget * settingsWidget () const
 Settings widget management. NOTE: do not use these methods in multi-threading part (ActionThread), only in main thread (GUI)
 
void setToolDescription (const QString &toolDescription)
 Manage Tool description.
 
void setToolIcon (const QIcon &icon)
 
void setToolIconName (const QString &iconName)
 Manage Tool icon name.
 
void setToolTitle (const QString &toolTitle)
 Manage Tool title.
 
void setWorkingUrl (const QUrl &workingUrl)
 Manage current working url used by this tool to process items.
 
QString toolDescription () const
 
BatchToolGroup toolGroup () const
 Return group of tool.
 
QString toolGroupToString () const
 Return group of tool name as string.
 
QIcon toolIcon () const
 
QString toolTitle () const
 
virtual int toolVersion () const
 Return version of tool.
 
QUrl workingUrl () const
 

Protected Slots

virtual void slotAssignSettings2Widget ()=0
 Re-implement this method to customize how all settings values must be assigned to settings widget.
 
virtual void slotSettingsChanged ()=0
 

Protected Member Functions

void applyFilter (DImgBuiltinFilter *const filter)
 
void applyFilter (DImgThreadedFilter *const filter)
 Use this if you have a filter ready to run.
 
void applyFilterChangedProperties (DImgThreadedFilter *const filter)
 
DImgimage () const
 Return a reference of internal DImg container used to modify image data.
 
bool isCancelled () const
 Return true if cancel() have been called.
 
bool isRawFile (const QUrl &url) const
 Method to check if file pointed by url is a RAW image.
 
void setErrorDescription (const QString &errmsg)
 Set string to describe an error which appear during apply() method.
 
virtual bool toolOperations ()=0
 Re-implement this method to customize all batch operations done by this tool.
 

Protected Attributes

QWidget * m_settingsWidget = nullptr
 Host settings widget instance.
 

Member Enumeration Documentation

◆ BatchToolGroup

Enumerator
BaseTool 

digiKam core tools.

CustomTool 

List of tools grouped and customized by users.

ColorTool 

Tools to manage image colors (Curves, BCG, etc...)

EnhanceTool 

Tools to enhance images (NR, sharp, etc...)

TransformTool 

Tools to transform images geometry (resize, rotate, flip, etc...)

DecorateTool 

Tools to decorate images (Border, watermark, etc...)

FiltersTool 

Tools to apply filters and special effects (film grain, BlurFx, etc...)

ConvertTool 

Tools to convert images format (PNG, JPEG, TIFF, etc...)

MetadataTool 

Tools to play with metadata.

Constructor & Destructor Documentation

◆ BatchTool()

Digikam::BatchTool::BatchTool ( const QString &  name,
BatchToolGroup  group,
QObject *const  parent = nullptr 
)
explicit

NOTE: these methods can be used safely in multi-threading part (ActionThread).

Member Function Documentation

◆ apply()

bool Digikam::BatchTool::apply ( )

This method call customized toolOperations().

◆ applyFilter()

void Digikam::BatchTool::applyFilter ( DImgThreadedFilter *const  filter)
protected

Will call startFilterDirectly and apply the result to image().

◆ cancel()

void Digikam::BatchTool::cancel ( )
virtual

to call a dedicated method to kill sub-threads parented to this tool instance. Unforget to call parent BatchTool::cancel() method in your customized implementation.

◆ clone()

virtual BatchTool * Digikam::BatchTool::clone ( QObject *const  parent = nullptr) const
pure virtual

It's a safe construction of tools instance used in multithreading (ActionThread) to process items in parallel.

◆ isCancelled()

bool Digikam::BatchTool::isCancelled ( ) const
protected

Use this method to stop loop in your toolOperations() implementation.

◆ outputSuffix()

QString Digikam::BatchTool::outputSuffix ( ) const
virtual

Typically, this is used with tool which convert to new file format. This method return and empty string by default.

◆ registerSettingsWidget()

void Digikam::BatchTool::registerSettingsWidget ( )
virtual

Default implementation assign no settings view (a message label is just displayed). You need to call default implementation in your child class to init default signals and slots connections, after to have instanced your dedicated settings widget.

◆ savefromDImg()

bool Digikam::BatchTool::savefromDImg ( ) const

◆ setOutputUrlFromInputUrl()

void Digikam::BatchTool::setOutputUrlFromInputUrl ( )

if outputSuffix() return null, file extension is the same than original.

◆ setSettings()

void Digikam::BatchTool::setSettings ( const BatchToolSettings settings)

See BatchToolSettings container for details.

◆ settingsWidget()

QWidget * Digikam::BatchTool::settingsWidget ( ) const

Return dedicated settings widget registered with registerSettingsWidget().

◆ signalAssignSettings2Widget

void Digikam::BatchTool::signalAssignSettings2Widget ( )
signal

See registerSettingsWidget() implementation.

◆ slotAssignSettings2Widget

virtual void Digikam::BatchTool::slotAssignSettings2Widget ( )
protectedpure virtualslot

This method is called by setSettings() through signalAssignSettings2Widget().

◆ toolGroup()

BatchTool::BatchToolGroup Digikam::BatchTool::toolGroup ( ) const

See BatchToolGroup enum for details.

◆ toolOperations()

virtual bool Digikam::BatchTool::toolOperations ( )
protectedpure virtual

This method is called by apply().

◆ toolVersion()

virtual int Digikam::BatchTool::toolVersion ( ) const
inlinevirtual

By default, ID is 1. Re-implement this method and increase this ID when tool settings change.