digiKam
Digikam::Rule Class Referenceabstract
+ Inheritance diagram for Digikam::Rule:

Public Types

enum  IconType { Action = 0 , Dialog }
 

Signals

void signalTokenTriggered (const QString &)
 

Public Member Functions

QString description () const
 
QPixmap icon (Rule::IconType type=Rule::Action) const
 
bool isValid () const
 
ParseResults parse (ParseSettings &settings)
 
QRegularExpression & regExp () const
 
QPushButton * registerButton (QWidget *parent)
 
QAction * registerMenu (QMenu *parent)
 
virtual void reset ()
 
 Rule (const QString &name)
 
 Rule (const QString &name, const QString &icon)
 
TokenListtokens () const
 
bool useTokenMenu () const
 
 ~Rule () override
 

Static Public Member Functions

static QString escapeToken (const QString &token)
 

Protected Slots

virtual void slotTokenTriggered (const QString &)
 

Protected Member Functions

bool addToken (const QString &id, const QString &description, const QString &actionName=QString())
 
virtual QString parseOperation (ParseSettings &settings, const QRegularExpressionMatch &match)=0
 
void setDescription (const QString &desc)
 
void setIcon (const QString &pixmap)
 
void setRegExp (const QRegularExpression &regExp)
 
void setUseTokenMenu (bool value)
 

Member Enumeration Documentation

◆ IconType

Enumerator
Action 
Dialog 

Constructor & Destructor Documentation

◆ Rule() [1/2]

Digikam::Rule::Rule ( const QString &  name)
explicit

◆ Rule() [2/2]

Digikam::Rule::Rule ( const QString &  name,
const QString &  icon 
)

References icon(), and setIcon().

◆ ~Rule()

Digikam::Rule::~Rule ( )
override

Member Function Documentation

◆ addToken()

bool Digikam::Rule::addToken ( const QString &  id,
const QString &  description,
const QString &  actionName = QString() 
)
protected

◆ description()

◆ escapeToken()

QString Digikam::Rule::escapeToken ( const QString &  token)
static

Escape the token characters to make them work in regular expressions

Parameters
tokenthe token to be escaped
Returns
A token with escaped characters. This token can then be used in a regular expression

Referenced by Digikam::CameraNameOption::CameraNameOption(), Digikam::FilePropertiesOption::FilePropertiesOption(), and Digikam::TrimmedModifier::TrimmedModifier().

◆ icon()

◆ isValid()

bool Digikam::Rule::isValid ( ) const

Checks the validity of the parse object

Returns
true if valid

Referenced by Digikam::Parser::registerModifier(), and Digikam::Parser::registerOption().

◆ parse()

◆ parseOperation()

virtual QString Digikam::Rule::parseOperation ( ParseSettings settings,
const QRegularExpressionMatch &  match 
)
protectedpure virtual

◆ regExp()

QRegularExpression & Digikam::Rule::regExp ( ) const

TODO: This is probably not needed anymore. Find out. returns the currently assigned regExp object. Note that it is returned as a const ref, meaning that if you use it in your custom parse operation, the main parse method has already searched for the pattern and filled in the results of this search, so that you can use QRegularExpressionMatch::captured() immediately, you don't have to search on your own.

For example when implementing the Option::parseOperation() method, get the regExp object with

 const QRegularExpression& reg = regExp();

and immediately fetch possible matches with

 const QString& param1 = reg.captured(1);
See also
Option
Modifier
Returns
a const ref to the assigned regexp object

Referenced by Digikam::Parser::parse(), parse(), and setRegExp().

◆ registerButton()

QPushButton * Digikam::Rule::registerButton ( QWidget *  parent)

Register a button in the parent object. By calling this method, a new button for the parser object will be created and all necessary connections will be setup.

Parameters
parentthe parent object the button will be registered for
Returns
a pointer to the newly created button

References Digikam::Token::action(), and icon().

◆ registerMenu()

QAction * Digikam::Rule::registerMenu ( QMenu *  parent)

Register a menu action in the parent object. By calling this method, a new action for the parser object will be created and all necessary connections will be setup.

Parameters
parentthe parent object the action will be registered for
Returns
a pointer to the newly created action

References Digikam::Token::action(), and icon().

◆ reset()

void Digikam::Rule::reset ( )
virtual

Resets the parser to its initial state

Reimplemented in Digikam::UniqueModifier.

Referenced by Digikam::Parser::reset().

◆ setDescription()

void Digikam::Rule::setDescription ( const QString &  desc)
protected

◆ setIcon()

void Digikam::Rule::setIcon ( const QString &  pixmap)
protected

◆ setRegExp()

◆ setUseTokenMenu()

void Digikam::Rule::setUseTokenMenu ( bool  value)
protected

If multiple tokens have been assigned to a rule, a menu will be created. If you want to display a menu for every defined token, set this method to 'true' and re-implement the

See also
slotTokenTriggered method.
Parameters
valueboolean parameter to set token menu usage

References value.

Referenced by Digikam::CaseModifier::CaseModifier(), and Digikam::FilePropertiesOption::FilePropertiesOption().

◆ signalTokenTriggered

void Digikam::Rule::signalTokenTriggered ( const QString &  )
signal

Referenced by addToken(), and slotTokenTriggered().

◆ slotTokenTriggered

void Digikam::Rule::slotTokenTriggered ( const QString &  token)
protectedvirtualslot

References signalTokenTriggered().

Referenced by addToken().

◆ tokens()

TokenList & Digikam::Rule::tokens ( ) const
Returns
a list of all registered tokens

◆ useTokenMenu()

bool Digikam::Rule::useTokenMenu ( ) const

Returns true if a token menu is used.


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