1 #include "CmdAbstract.h"
2 #include "CmdFactory.h"
3 #include "CmdMediator.h"
4 #include "CmdStackShadow.h"
6 #include "DocumentSerialize.h"
8 #include "MainWindow.h"
9 #include <QUndoCommand>
10 #include <QXmlStreamReader>
16 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::CmdStackShadow";
21 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::canRedo";
23 bool canRedo = (m_cmdList.count () > 0);
30 QXmlStreamReader &reader)
32 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::loadCommands";
35 m_mainWindow = &mainWindow;
39 while (!reader.atEnd() && !reader.hasError()) {
41 if ((loadNextFromReader (reader) == QXmlStreamReader::StartElement) &&
42 (reader.name() == DOCUMENT_SERIALIZE_CMD)) {
45 m_cmdList.push_back (factory.
createCmd (mainWindow,
54 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::slotRedo";
56 if (m_cmdList.count() > 0) {
58 QUndoCommand *cmd =
dynamic_cast<QUndoCommand*
> (m_cmdList.front());
60 m_cmdList.pop_front();
62 if (m_mainWindow != 0) {
70 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::slotUndo";
72 CmdListInternal::iterator itr;
73 for (itr = m_cmdList.begin(); itr != m_cmdList.end(); itr++) {
Factory for CmdAbstractBase objects.
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
CmdMediator & cmdMediator()
Accessor for commands to process the Document.
CmdStackShadow()
Single constructor.
bool canRedo() const
Return true if there is a command available.
void slotUndo()
Throw away every command since trying to reconcile two different command stacks after an undo is too ...
Storage of one imported image and the data attached to that image.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
CmdAbstract * createCmd(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Factory method. Input is the xml node from an error report file.