![]() |
digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
|
Public Types | |
enum | IconType { Action = 0 , Dialog } |
Signals | |
void | signalTokenTriggered (const QString &) |
Public Member Functions | |
Rule (const QString &name) | |
Rule (const QString &name, const QString &icon) | |
QString | description () const |
QPixmap | icon (Rule::IconType type=Rule::Action) const |
bool | isValid () const |
Checks the validity of the parse object. | |
ParseResults | parse (ParseSettings &settings) |
QRegularExpression & | regExp () const |
TODO: This is probably not needed anymore. | |
QPushButton * | registerButton (QWidget *parent) |
Register a button in the parent object. | |
QAction * | registerMenu (QMenu *parent) |
Register a menu action in the parent object. | |
virtual void | reset () |
Resets the parser to its initial state. | |
TokenList & | tokens () const |
bool | useTokenMenu () const |
Returns true if a token menu is used. | |
Static Public Member Functions | |
static QString | escapeToken (const QString &token) |
Escape the token characters to make them work in regular expressions. | |
Protected Slots | |
virtual void | slotTokenTriggered (const QString &) |
Protected Member Functions | |
bool | addToken (const QString &id, const QString &description, const QString &actionName=QString()) |
add a token to the parser, every parser should at least assign one token object | |
virtual QString | parseOperation (ParseSettings &settings, const QRegularExpressionMatch &match)=0 |
TODO: describe me. | |
void | setDescription (const QString &desc) |
void | setIcon (const QString &pixmap) |
void | setRegExp (const QRegularExpression ®Exp) |
void | setUseTokenMenu (bool value) |
If multiple tokens have been assigned to a rule, a menu will be created. | |
|
protected |
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) |
|
static |
token | the token to be escaped |
bool Digikam::Rule::isValid | ( | ) | const |
|
protectedpure virtual |
settings | contains settings |
match | result of the regular expression match done in Option::parse() |
Implemented in Digikam::CaseModifier, Digikam::DefaultValueModifier, Digikam::RangeModifier, Digikam::RemoveDoublesModifier, Digikam::ReplaceModifier, Digikam::TrimmedModifier, Digikam::UniqueModifier, Digikam::CameraNameOption, Digikam::DatabaseOption, Digikam::DateOption, Digikam::DirectoryNameOption, Digikam::FilePropertiesOption, Digikam::MetadataOption, Digikam::SequenceNumberOption, Digikam::Modifier, and Digikam::Option.
QRegularExpression & Digikam::Rule::regExp | ( | ) | const |
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);
QPushButton * Digikam::Rule::registerButton | ( | QWidget * | parent | ) |
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 |
QAction * Digikam::Rule::registerMenu | ( | QMenu * | parent | ) |
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 |
|
virtual |
Reimplemented in Digikam::UniqueModifier.
|
protected |
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 |
TokenList & Digikam::Rule::tokens | ( | ) | const |