3 #include "macros/pirmacrocommanditem.h"
5 bool PIRMacro::macroRunning = false;
8 QTreeWidgetItem *parent,
11 : QTreeWidgetItem(parent),
18 QString PIRMacro::getName()
24 char PIRMacro::getKeyMapping()
30 void PIRMacro::appendCommand(
31 PIRMacroCommandItem *c)
33 commands.push_back(c);
37 void PIRMacro::populateList(
42 CommandSequence::const_iterator i = commands.begin();
44 while (i != commands.end())
52 // executeMacro() returns false if it was unable to start the macro running:
53 bool PIRMacro::executeMacro()
55 // Don't start a new macro if one is already running:
56 if (macroRunning) return false;
58 currentCommand = commands.begin();
60 // If this macro is empty, just return:
61 if (currentCommand == commands.end())
63 emit macroCompleted();
67 // Start running the list of commands:
72 SIGNAL(commandCompleted()),
74 SLOT(startNextCommand()));
76 (*currentCommand)->executeCommand();
84 void PIRMacro::startNextCommand()
87 if (currentCommand == commands.end())
91 emit macroCompleted();
95 // We are not done; run the next command.
98 SIGNAL(commandCompleted()),
100 SLOT(startNextCommand()));
102 (*currentCommand)->executeCommand();