Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
CmdSettingsPointMatch.cpp
1 #include "CmdSettingsPointMatch.h"
2 #include "Document.h"
3 #include "DocumentSerialize.h"
4 #include "Logger.h"
5 #include "MainWindow.h"
6 #include <QXmlStreamReader>
7 
8 const QString CMD_DESCRIPTION ("Point Match settings");
9 
11  Document &document,
12  const DocumentModelPointMatch &modelPointMatchBefore,
13  const DocumentModelPointMatch &modelPointMatchAfter) :
14  CmdAbstract(mainWindow,
15  document,
16  CMD_DESCRIPTION),
17  m_modelPointMatchBefore (modelPointMatchBefore),
18  m_modelPointMatchAfter (modelPointMatchAfter)
19 {
20  LOG4CPP_INFO_S ((*mainCat)) << "CmdSettingsPointMatch::CmdSettingsPointMatch";
21 }
22 
24  Document &document,
25  const QString &cmdDescription,
26  QXmlStreamReader &reader) :
27  CmdAbstract (mainWindow,
28  document,
29  cmdDescription)
30 {
31  LOG4CPP_INFO_S ((*mainCat)) << "CmdSettingsPointMatch::CmdSettingsPointMatch";
32 
33  m_modelPointMatchBefore.loadXml (reader);
34  m_modelPointMatchAfter.loadXml (reader);
35 }
36 
37 CmdSettingsPointMatch::~CmdSettingsPointMatch ()
38 {
39 }
40 
42 {
43  LOG4CPP_INFO_S ((*mainCat)) << "CmdSettingsPointMatch::cmdRedo";
44 
45  mainWindow().updateSettingsPointMatch(m_modelPointMatchAfter);
47 }
48 
50 {
51  LOG4CPP_INFO_S ((*mainCat)) << "CmdSettingsPointMatch::cmdUndo";
52 
53  mainWindow().updateSettingsPointMatch(m_modelPointMatchBefore);
55 }
56 
57 void CmdSettingsPointMatch::saveXml (QXmlStreamWriter &writer) const
58 {
59  writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
60  writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_TYPE, DOCUMENT_SERIALIZE_CMD_SETTINGS_POINT_MATCH);
61  writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
62  m_modelPointMatchBefore.saveXml (writer);
63  m_modelPointMatchAfter.saveXml(writer);
64  writer.writeEndElement();
65 }
CmdSettingsPointMatch(MainWindow &mainWindow, Document &document, const DocumentModelPointMatch &modelPointMatchBefore, const DocumentModelPointMatch &modelPointMatchAfter)
Constructor for normal creation.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
virtual void saveXml(QXmlStreamWriter &writer) const
Save commands as xml for later uploading.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition: CmdAbstract.h:11
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void cmdUndo()
Undo method that is called when QUndoStack is moved one command backward.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
Definition: CmdAbstract.cpp:32
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
Storage of one imported image and the data attached to that image.
Definition: Document.h:29
void updateSettingsPointMatch(const DocumentModelPointMatch &modelPointMatch)
Update with new point match properties.
virtual void cmdRedo()
Redo method that is called when QUndoStack is moved one command forward.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition: MainWindow.h:66