|
Relacs
0.9.8
|
#include <macros.h>


Public Types | |
| enum | CommandType { UnknownCom, ReProCom, MacroCom, FilterCom, DetectorCom, ControlCom, SwitchCom, StartSessionCom, StopSessionCom, ShutdownCom, ShellCom, MessageCom, BrowseCom } |
Public Slots | |
| void | start (void) |
| void | run (void) |
| void | view (void) |
| void | reload (void) |
| void | help (void) |
| void | enable (void) |
| void | dialog (void) |
| void | acceptDialog (void) |
| void | dialogAction (int r) |
| void | dialogClosed (int r) |
Public Member Functions | |
| MacroCommand (void) | |
| MacroCommand (const string &line, Macros *mcs, Macro *mc) | |
| MacroCommand (RePro *repro, const string ¶ms, Macros *mcs, Macro *mc) | |
| MacroCommand (const MacroCommand &com) | |
| CommandType | command (void) const |
| string | name (void) const |
| void | setName (const string &name) |
| string | parameter (void) const |
| void | setParameter (const string ¶meter) |
| void | addParameter (const string &s, bool addsep) |
| bool | enabled (void) const |
| void | clearIcon (void) |
| void | setRunIcon (void) |
| RePro * | repro (void) |
| void | setReProCommand (void) |
| void | setMacroIndex (int index) |
| void | init (int macronum, int commandnum) |
| QMenu * | menu (void) |
| void | addMenu (QMenu *menu) |
| bool | check (string &warning) |
| void | checkOptions (string &warning) |
| bool | execute (bool saving) |
| void | reloadRePro (RePro *repro) |
Static Public Member Functions | |
| static void | createIcons (int size) |
| static void | destroyIcons (void) |
Friends | |
| ostream & | operator<< (ostream &str, const MacroCommand &command) |
A single command of a macro.
This class is used in the private list of macros of the Macros class. It describes the function (repro, message, shell, macro) of the command.
| enum CommandType |
The different types of commands.
| Enumerator | |
|---|---|
| UnknownCom |
This command does nothing. |
| ReProCom |
The command executes a RePro. |
| MacroCom |
The command executes another macro. |
| FilterCom |
The command executes a function of a filter . |
| DetectorCom |
The command executes a function of a detector. |
| ControlCom |
The command sets a parameter of a control. |
| SwitchCom |
The command switches the macro file. |
| StartSessionCom |
The command starts a session. |
| StopSessionCom |
The command stops a session without launching the dialog. |
| ShutdownCom |
The command shuts down relacs. |
| ShellCom |
The command executes a shell command. |
| MessageCom |
The command opens a message box with some text. |
| BrowseCom |
The command opens a browser for looking at a text. |
| MacroCommand | ( | void | ) |
| MacroCommand | ( | const string & | line, |
| Macros * | mcs, | ||
| Macro * | mc | ||
| ) |
Create a MacroCommand from line.
References MacroCommand::BrowseCom, MacroCommand::ControlCom, MacroCommand::DetectorCom, Str::erase(), Str::eraseFirst(), MacroCommand::FilterCom, relacs::line(), MacroCommand::MacroCom, MacroCommand::MessageCom, Str::number(), MacroCommand::ReProCom, MacroCommand::ShellCom, MacroCommand::ShutdownCom, MacroCommand::StartSessionCom, MacroCommand::StopSessionCom, Str::strip(), Str::substr(), MacroCommand::SwitchCom, and Str::WhiteSpace.
| MacroCommand | ( | RePro * | repro, |
| const string & | params, | ||
| Macros * | mcs, | ||
| Macro * | mc | ||
| ) |
Create a MacroCommand for a RePro.
| MacroCommand | ( | const MacroCommand & | com | ) |
Copy constructor.
| MacroCommand::CommandType command | ( | void | ) | const |
Referenced by Macro::load().
| string name | ( | void | ) | const |
Referenced by MacroCommand::check(), Macro::load(), and MacroCommand::setName().
| void setName | ( | const string & | name | ) |
Set the name of the MacroCommand to name.
References MacroCommand::name().
Referenced by MacroCommand::check().
| string parameter | ( | void | ) | const |
Referenced by MacroCommand::check(), MacroCommand::checkOptions(), Macro::load(), and MacroCommand::setParameter().
| void setParameter | ( | const string & | parameter | ) |
Set the parameter of the MacroCommand to parameter.
References MacroCommand::parameter().
Referenced by Macro::check(), and MacroCommand::check().
| void addParameter | ( | const string & | s, |
| bool | addsep | ||
| ) |
Add s to the command's parameter string. Add a semicolon beforehand if addsep is true.
References Str::empty(), and Str::provideLast().
| bool enabled | ( | void | ) | const |
| void clearIcon | ( | void | ) |
Set the command's icon to enabled or disabled.
| void setRunIcon | ( | void | ) |
Set the command's icon to running.
Referenced by MacroCommand::execute().
| RePro * repro | ( | void | ) |
The RePro of this MacroCommand.
Referenced by MacroCommand::check().
| void setReProCommand | ( | void | ) |
Set the CommandType of the MacroCommand to ReProCom .
References MacroCommand::ReProCom.
Referenced by Macro::load().
| void setMacroIndex | ( | int | index | ) |
Set the index of the Macro of this MacroCommand to index.
| void init | ( | int | macronum, |
| int | commandnum | ||
| ) |
Initialize the number of the parent macro and the command number.
| QMenu * menu | ( | void | ) |
The menu offering various actions for the command.
| void addMenu | ( | QMenu * | menu | ) |
Adds the submenu for this command to menu.
References MacroCommand::BrowseCom, MacroCommand::ControlCom, MacroCommand::DetectorCom, MacroCommand::dialog(), Str::empty(), MacroCommand::enable(), Str::erase(), Str::eraseMarkup(), MacroCommand::FilterCom, Str::find(), MacroCommand::help(), MacroCommand::MacroCom, MacroCommand::MessageCom, Str::mid(), Str::preventedLast(), MacroCommand::reload(), MacroCommand::ReProCom, MacroCommand::run(), MacroCommand::ShellCom, MacroCommand::ShutdownCom, Macro::size(), Str::size(), MacroCommand::start(), MacroCommand::StartSessionCom, MacroCommand::StopSessionCom, Str::stripped(), Str::substr(), MacroCommand::SwitchCom, and MacroCommand::view().
| bool check | ( | string & | warning | ) |
Check the command except for validity of the Options. Returns true on success. Otherwise, a warning message is added, and false is returned.
References MacroCommand::BrowseCom, ControlTabs::control(), MacroCommand::ControlCom, Macros::CTs, MacroCommand::DetectorCom, FilterDetectors::exist(), MacroCommand::FilterCom, RELACSWidget::filterDetectors(), Macros::index(), MacroCommand::MacroCom, MacroCommand::MessageCom, Macro::name(), MacroCommand::name(), RePros::nameRepro(), MacroCommand::parameter(), MacroCommand::repro(), MacroCommand::ReProCom, Macros::RPs, Macros::RW, MacroCommand::setName(), MacroCommand::setParameter(), MacroCommand::ShellCom, MacroCommand::ShutdownCom, MacroCommand::StartSessionCom, MacroCommand::StopSessionCom, MacroCommand::SwitchCom, and RELACSPlugin::uniqueName().
| void checkOptions | ( | string & | warning | ) |
Check the command options. Returns true on success. Otherwise, a warning message is added, and false is returned.
References RePro::checkOptions(), Macro::expandParameter(), ConfigDialog::name(), MacroCommand::parameter(), and MacroCommand::ReProCom.
| bool execute | ( | bool | saving | ) |
Execute the command. Returns true if a RePro was executed.
References Macro::action(), OptDialog::addButton(), OptDialog::addWidget(), FilterDetectors::autoConfigure(), Options::boolean(), MacroCommand::BrowseCom, FilterDetectors::detector(), MacroCommand::DetectorCom, Str::dir(), Session::doStopTheSession(), Str::empty(), Str::eraseMarkup(), OptDialog::exec(), Macros::executeMacro(), Macro::expandParameter(), Str::expandPath(), FilterDetectors::filter(), MacroCommand::FilterCom, RELACSWidget::filterDetectors(), Str::find(), Str::findBracket(), Filter::ident(), MessageBox::information(), Macros::loadMacros(), MacroCommand::MacroCom, MacroCommand::MessageCom, Str::notdir(), RePro::overwriteOptions(), RELACSWidget::printlog(), Str::replace(), Macros::RW, Filter::save(), RELACSWidget::session(), OptDialog::setCaption(), MacroCommand::setRunIcon(), MacroCommand::ShellCom, RELACSWidget::shutdown(), MacroCommand::ShutdownCom, Str::size(), RELACSWidget::startRePro(), MacroCommand::StartSessionCom, Session::startTheSession(), MacroCommand::StopSessionCom, Str::substr(), and MacroCommand::SwitchCom.
| void reloadRePro | ( | RePro * | repro | ) |
Update the macro command for the reloaded repro repro.
References ConfigDialog::name(), and MacroCommand::ReProCom.
|
static |
|
static |
|
slot |
Start macro at this command.
References Options::setDefaults(), Macros::startMacro(), and Macro::variables().
Referenced by MacroCommand::addMenu().
|
slot |
Run only this command.
References MacroCommand::MacroCom, Options::setDefaults(), Macros::setThisOnly(), Macros::startMacro(), and Macro::variables().
Referenced by MacroCommand::addMenu().
|
slot |
|
slot |
Reload the RePro plugin.
References RePros::reload(), and Macros::RPs.
Referenced by MacroCommand::addMenu().
|
slot |
Display the RePro's help text.
References RePros::help(), and Macros::RPs.
Referenced by MacroCommand::addMenu().
|
slot |
Enable/disable the command.
Referenced by MacroCommand::addMenu().
|
slot |
Launch the dialog of the command.
References OptDialog::Accept, MacroCommand::acceptDialog(), OptDialog::addButton(), OptDialog::addOptions(), OptDialog::addSeparator(), RePro::CurrentFlag, RePro::dialog(), MacroCommand::dialogAction(), MacroCommand::dialogClosed(), ConfigDialog::dialogOpen(), RePros::dialogOptions(), OptDialog::exec(), relacs::exp(), Macro::expandParameter(), MacroCommand::MacroCom, RePro::MacroFlag, RePro::OverwriteFlag, RePro::overwriteOptions(), Options::read(), MacroCommand::ReProCom, Macros::RPs, OptDialog::setCaption(), Options::setDefaults(), OptDialog::setRejectCode(), OptDialog::setVerticalSpacing(), Options::size(), and Macro::variables().
Referenced by MacroCommand::addMenu().
|
slot |
Accept the edited input from the dialog.
References Options::assign(), Options::boolean(), OptDialog::changedFlag(), Str::empty(), Macro::expandParameter(), Str::find(), MacroCommand::MacroCom, Options::NonDefault, RePro::overwriteOptions(), Options::read(), Options::readAppend(), Str::size(), and Str::substr().
Referenced by MacroCommand::dialog(), and MacroCommand::dialogClosed().
|
slot |
Runs the macro for r==2 and set the options to default for r==3.
References Options::clear(), and Macros::startMacro().
Referenced by MacroCommand::dialog(), and MacroCommand::dialogClosed().
|
slot |
Unsets the DialogOpen flag and disconnects signals.
References MacroCommand::acceptDialog(), MacroCommand::dialogAction(), and MacroCommand::ReProCom.
Referenced by MacroCommand::dialog().
|
friend |
Write information of the MacroCommand to str.
1.8.6