1 #include "CmdMediator.h"
2 #include "DocumentModelCommon.h"
3 #include "DocumentSerialize.h"
6 #include "QtToString.h"
7 #include <QXmlStreamWriter>
10 const int DEFAULT_CURSOR_SIZE = 3;
11 const int DEFAULT_EXTRA_PRECISION = 1;
14 m_cursorSize (DEFAULT_CURSOR_SIZE),
15 m_extraPrecision (DEFAULT_EXTRA_PRECISION)
20 m_cursorSize (document.modelCommon().cursorSize()),
21 m_extraPrecision (document.modelCommon().extraPrecision())
26 m_cursorSize (other.cursorSize()),
27 m_extraPrecision (other.extraPrecision())
46 return m_extraPrecision;
51 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelCommon::loadXml";
55 QXmlStreamAttributes attributes = reader.attributes();
57 if (attributes.hasAttribute(DOCUMENT_SERIALIZE_COMMON_CURSOR_SIZE) &&
58 attributes.hasAttribute(DOCUMENT_SERIALIZE_COMMON_EXTRA_PRECISION)) {
60 setCursorSize (attributes.value(DOCUMENT_SERIALIZE_COMMON_CURSOR_SIZE).toInt());
61 setExtraPrecision (attributes.value(DOCUMENT_SERIALIZE_COMMON_EXTRA_PRECISION).toInt());
64 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
65 (reader.name() != DOCUMENT_SERIALIZE_COMMON)){
66 loadNextFromReader(reader);
75 reader.raiseError (
"Cannot read axes checker data");
80 QTextStream &str)
const
82 str << indentation <<
"DocumentModelCommon\n";
84 indentation += INDENTATION_DELTA;
86 str << indentation <<
"cursorSize=" << m_cursorSize <<
"\n";
87 str << indentation <<
"extraPrecision=" << m_extraPrecision <<
"\n";
92 LOG4CPP_INFO_S ((*mainCat)) <<
"DocumentModelCommon::saveXml";
94 writer.writeStartElement(DOCUMENT_SERIALIZE_COMMON);
95 writer.writeAttribute(DOCUMENT_SERIALIZE_COMMON_CURSOR_SIZE, QString::number (m_cursorSize));
96 writer.writeAttribute(DOCUMENT_SERIALIZE_COMMON_EXTRA_PRECISION, QString::number (m_extraPrecision));
97 writer.writeEndElement();
int extraPrecision() const
Get method for extra digits of precsion.
Model for DlgSettingsCommon and CmdSettingsCommon.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
DocumentModelCommon()
Default constructor.
int cursorSize() const
Get method for effective cursor size.
void setExtraPrecision(int extraPrecision)
Set method for extra digits of precision.
Storage of one imported image and the data attached to that image.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
void setCursorSize(int cursorSize)
Set method for effective cursor size.
DocumentModelCommon & operator=(const DocumentModelCommon &other)
Assignment constructor.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...