7#include "CmdAbstract.h"
9#include "CmdMediator.h"
10#include "CmdStackShadow.h"
12#include "DocumentSerialize.h"
14#include "MainWindow.h"
15#include <QUndoCommand>
16#include <QXmlStreamReader>
22 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::CmdStackShadow";
27 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::canRedo";
29 bool canRedo = (m_cmdList.count () > 0);
36 QXmlStreamReader &reader)
38 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::loadCommands";
41 m_mainWindow = &mainWindow;
45 while (!reader.atEnd() && !reader.hasError()) {
47 if ((loadNextFromReader (reader) == QXmlStreamReader::StartElement) &&
48 (reader.name() == DOCUMENT_SERIALIZE_CMD)) {
51 m_cmdList.push_back (factory.
createCmd (mainWindow,
60 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::slotRedo";
62 if (m_cmdList.count() > 0) {
64 QUndoCommand *cmd =
dynamic_cast<QUndoCommand*
> (m_cmdList.front());
66 m_cmdList.pop_front();
68 if (m_mainWindow != 0) {
76 LOG4CPP_INFO_S ((*mainCat)) <<
"CmdStackShadow::slotUndo";
78 CmdListInternal::iterator itr;
79 for (itr = m_cmdList.begin(); itr != m_cmdList.end(); itr++) {
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Factory for CmdAbstractBase objects.
CmdAbstract * createCmd(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Factory method. Input is the xml node from an error report file.
bool canRedo() const
Return true if there is a command available.
void slotRedo()
Move next command from list to CmdMediator. Noop if there are no more commands.
void loadCommands(MainWindow &mainWindow, Document &document, QXmlStreamReader &reader)
Load commands from serialized xml.
void slotUndo()
Throw away every command since trying to reconcile two different command stacks after an undo is too ...
CmdStackShadow()
Single constructor.
Storage of one imported image and the data attached to that image.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
CmdMediator * cmdMediator()
Accessor for commands to process the Document.