digiKam
|
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) | |
TokenList & | tokens () 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 ®Exp) |
void | setUseTokenMenu (bool value) |
|
explicit |
Digikam::Rule::Rule | ( | const QString & | name, |
const QString & | icon | ||
) |
|
override |
|
protected |
add a token to the parser, every parser should at least assign one token object
id | the token id string (used for parsing) |
description | the description of the token (used for example in the tooltip) |
actionName | [optional] the name of the token action (only used when the token menu is displayed) |
References Digikam::Token::action(), description(), signalTokenTriggered(), and slotTokenTriggered().
Referenced by Digikam::CameraNameOption::CameraNameOption(), Digikam::CaseModifier::CaseModifier(), Digikam::DatabaseOption::DatabaseOption(), Digikam::DateOption::DateOption(), Digikam::DefaultValueModifier::DefaultValueModifier(), Digikam::DirectoryNameOption::DirectoryNameOption(), Digikam::FilePropertiesOption::FilePropertiesOption(), Digikam::MetadataOption::MetadataOption(), Digikam::RangeModifier::RangeModifier(), Digikam::RemoveDoublesModifier::RemoveDoublesModifier(), Digikam::ReplaceModifier::ReplaceModifier(), Digikam::SequenceNumberOption::SequenceNumberOption(), Digikam::TrimmedModifier::TrimmedModifier(), and Digikam::UniqueModifier::UniqueModifier().
QString Digikam::Rule::description | ( | ) | const |
Referenced by addToken(), Digikam::DefaultValueModifier::DefaultValueModifier(), Digikam::MetadataOption::MetadataOption(), Digikam::Modifier::Modifier(), Digikam::Option::Option(), Digikam::RemoveDoublesModifier::RemoveDoublesModifier(), Digikam::RuleDialog::RuleDialog(), Digikam::TrimmedModifier::TrimmedModifier(), and Digikam::UniqueModifier::UniqueModifier().
|
static |
Escape the token characters to make them work in regular expressions
token | the token to be escaped |
Referenced by Digikam::CameraNameOption::CameraNameOption(), Digikam::FilePropertiesOption::FilePropertiesOption(), and Digikam::TrimmedModifier::TrimmedModifier().
QPixmap Digikam::Rule::icon | ( | Rule::IconType | type = Rule::Action | ) | const |
References Dialog.
Referenced by Digikam::MetadataOption::MetadataOption(), registerButton(), registerMenu(), Rule(), and Digikam::RuleDialog::RuleDialog().
bool Digikam::Rule::isValid | ( | ) | const |
Checks the validity of the parse object
Referenced by Digikam::Parser::registerModifier(), and Digikam::Parser::registerOption().
ParseResults Digikam::Rule::parse | ( | ParseSettings & | settings | ) |
References Digikam::ParseResults::addEntry(), parseOperation(), Digikam::ParseSettings::parseString, and regExp().
Referenced by Digikam::Parser::parse().
|
protectedpure virtual |
TODO: describe me
settings | contains settings |
match | result of the regular expression match done in Option::parse() |
Implemented in Digikam::Option, Digikam::Modifier, Digikam::SequenceNumberOption, Digikam::MetadataOption, Digikam::FilePropertiesOption, Digikam::DirectoryNameOption, Digikam::DateOption, Digikam::DatabaseOption, Digikam::CameraNameOption, Digikam::UniqueModifier, Digikam::TrimmedModifier, Digikam::ReplaceModifier, Digikam::RemoveDoublesModifier, Digikam::RangeModifier, Digikam::DefaultValueModifier, and Digikam::CaseModifier.
Referenced by parse().
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);
Referenced by Digikam::Parser::parse(), parse(), and setRegExp().
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.
parent | the parent object the button will be registered for |
References Digikam::Token::action(), and icon().
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.
parent | the parent object the action will be registered for |
References Digikam::Token::action(), and icon().
|
virtual |
Resets the parser to its initial state
Reimplemented in Digikam::UniqueModifier.
Referenced by Digikam::Parser::reset().
|
protected |
Referenced by Digikam::Modifier::Modifier(), and Digikam::Option::Option().
|
protected |
Referenced by Digikam::MetadataOption::MetadataOption(), and Rule().
|
protected |
References regExp().
Referenced by Digikam::CameraNameOption::CameraNameOption(), Digikam::CaseModifier::CaseModifier(), Digikam::DatabaseOption::DatabaseOption(), Digikam::DateOption::DateOption(), Digikam::DefaultValueModifier::DefaultValueModifier(), Digikam::DirectoryNameOption::DirectoryNameOption(), Digikam::FilePropertiesOption::FilePropertiesOption(), Digikam::MetadataOption::MetadataOption(), Digikam::RangeModifier::RangeModifier(), Digikam::RemoveDoublesModifier::RemoveDoublesModifier(), Digikam::ReplaceModifier::ReplaceModifier(), Digikam::SequenceNumberOption::SequenceNumberOption(), Digikam::TrimmedModifier::TrimmedModifier(), and Digikam::UniqueModifier::UniqueModifier().
|
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
value | boolean parameter to set token menu usage |
References value.
Referenced by Digikam::CaseModifier::CaseModifier(), and Digikam::FilePropertiesOption::FilePropertiesOption().
|
signal |
Referenced by addToken(), and slotTokenTriggered().
|
protectedvirtualslot |
References signalTokenTriggered().
Referenced by addToken().
TokenList & Digikam::Rule::tokens | ( | ) | const |
bool Digikam::Rule::useTokenMenu | ( | ) | const |
Returns true if a token menu is used.