Engauge Digitizer  2
Public Member Functions | List of all members
DocumentModelAxesChecker Class Reference

Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker. More...

#include <DocumentModelAxesChecker.h>

Inheritance diagram for DocumentModelAxesChecker:
Inheritance graph
Collaboration diagram for DocumentModelAxesChecker:
Collaboration graph

Public Member Functions

 DocumentModelAxesChecker ()
 Default constructor. More...
 
 DocumentModelAxesChecker (const Document &document)
 Initial constructor from Document. More...
 
 DocumentModelAxesChecker (const DocumentModelAxesChecker &other)
 Copy constructor. More...
 
DocumentModelAxesChecker & operator= (const DocumentModelAxesChecker &other)
 Assignment constructor. More...
 
CheckerMode checkerMode () const
 Get method for checker lifetime mode. More...
 
int checkerSeconds () const
 Get method for checker lifetime in seconds. More...
 
ColorPalette lineColor () const
 Get method for line color. More...
 
virtual void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. More...
 
void printStream (QString indentation, QTextStream &str) const
 Debugging method that supports print method of this class and printStream method of some other class(es) More...
 
virtual void saveXml (QXmlStreamWriter &writer) const
 Save entire model as xml into stream. More...
 
void setCheckerMode (CheckerMode checkerMode)
 Set method for checker mode. More...
 
void setCheckerSeconds (int seconds)
 Set method for checker lifetime in seconds. More...
 
void setLineColor (ColorPalette lineColor)
 Set method for line color. More...
 
- Public Member Functions inherited from DocumentModelAbstractBase
 DocumentModelAbstractBase ()
 Single constructor. More...
 
virtual ~DocumentModelAbstractBase ()
 Single destructor. More...
 

Additional Inherited Members

Detailed Description

Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.

Definition at line 18 of file DocumentModelAxesChecker.h.

Constructor & Destructor Documentation

◆ DocumentModelAxesChecker() [1/3]

DocumentModelAxesChecker::DocumentModelAxesChecker ( )

Default constructor.

Definition at line 23 of file DocumentModelAxesChecker.cpp.

23  :
24  m_checkerMode (CHECKER_MODE_N_SECONDS),
25  m_checkerSeconds (DEFAULT_CHECKER_SECONDS),
26  m_lineColor (DEFAULT_LINE_COLOR)
27 {
28 }

◆ DocumentModelAxesChecker() [2/3]

DocumentModelAxesChecker::DocumentModelAxesChecker ( const Document &  document)

Initial constructor from Document.

Definition at line 30 of file DocumentModelAxesChecker.cpp.

30  :
31  m_checkerMode (document.modelAxesChecker().checkerMode()),
32  m_checkerSeconds (document.modelAxesChecker().checkerSeconds()),
33  m_lineColor (document.modelAxesChecker().lineColor())
34 {
35 }

◆ DocumentModelAxesChecker() [3/3]

DocumentModelAxesChecker::DocumentModelAxesChecker ( const DocumentModelAxesChecker &  other)

Copy constructor.

Definition at line 37 of file DocumentModelAxesChecker.cpp.

37  :
38  m_checkerMode (other.checkerMode()),
39  m_checkerSeconds (other.checkerSeconds()),
40  m_lineColor (other.lineColor())
41 {
42 }

Member Function Documentation

◆ checkerMode()

CheckerMode DocumentModelAxesChecker::checkerMode ( ) const

Get method for checker lifetime mode.

Definition at line 53 of file DocumentModelAxesChecker.cpp.

54 {
55  return m_checkerMode;
56 }

◆ checkerSeconds()

int DocumentModelAxesChecker::checkerSeconds ( ) const

Get method for checker lifetime in seconds.

Definition at line 58 of file DocumentModelAxesChecker.cpp.

59 {
60  return m_checkerSeconds;
61 }

◆ lineColor()

ColorPalette DocumentModelAxesChecker::lineColor ( ) const

Get method for line color.

Definition at line 63 of file DocumentModelAxesChecker.cpp.

64 {
65  return m_lineColor;
66 }

◆ loadXml()

void DocumentModelAxesChecker::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 68 of file DocumentModelAxesChecker.cpp.

69 {
70  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelAxesChecker::loadXml";
71 
72  bool success = true;
73 
74  QXmlStreamAttributes attributes = reader.attributes();
75 
76  if (attributes.hasAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_MODE) &&
77  attributes.hasAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_SECONDS) &&
78  attributes.hasAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_LINE_COLOR)) {
79 
80  setCheckerMode (static_cast<CheckerMode> (attributes.value(DOCUMENT_SERIALIZE_AXES_CHECKER_MODE).toInt()));
82  setLineColor (static_cast<ColorPalette> (attributes.value(DOCUMENT_SERIALIZE_AXES_CHECKER_LINE_COLOR).toInt()));
83 
84  // Read until end of this subtree
85  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
86  (reader.name() != DOCUMENT_SERIALIZE_AXES_CHECKER)){
87  loadNextFromReader(reader);
88  if (reader.atEnd()) {
89  success = false;
90  break;
91  }
92  }
93  }
94 
95  if (!success) {
96  reader.raiseError (QObject::tr ("Cannot read axes checker data"));
97  }
98 }

◆ operator=()

DocumentModelAxesChecker & DocumentModelAxesChecker::operator= ( const DocumentModelAxesChecker &  other)

Assignment constructor.

Definition at line 44 of file DocumentModelAxesChecker.cpp.

45 {
46  m_checkerMode = other.checkerMode();
47  m_checkerSeconds = other.checkerSeconds();
48  m_lineColor = other.lineColor();
49 
50  return *this;
51 }

◆ printStream()

void DocumentModelAxesChecker::printStream ( QString  indentation,
QTextStream &  str 
) const

Debugging method that supports print method of this class and printStream method of some other class(es)

Definition at line 100 of file DocumentModelAxesChecker.cpp.

102 {
103  str << indentation << "DocumentModelAxesChecker\n";
104 
105  indentation += INDENTATION_DELTA;
106 
107  str << indentation << "checkerMode=" << checkerModeToString (m_checkerMode) << "\n";
108  str << indentation << "checkerSeconds=" << m_checkerSeconds << "\n";
109  str << indentation << "color=" << colorPaletteToString (m_lineColor) << "\n";
110 }

◆ saveXml()

void DocumentModelAxesChecker::saveXml ( QXmlStreamWriter &  writer) const
virtual

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 112 of file DocumentModelAxesChecker.cpp.

113 {
114  LOG4CPP_INFO_S ((*mainCat)) << "DocumentModelAxesChecker::saveXml";
115 
116  writer.writeStartElement(DOCUMENT_SERIALIZE_AXES_CHECKER);
117  writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_MODE, QString::number (m_checkerMode));
118  writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_SECONDS, QString::number (m_checkerSeconds));
119  writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_CHECKER_LINE_COLOR, QString::number (m_lineColor));
120  writer.writeEndElement();
121 }

◆ setCheckerMode()

void DocumentModelAxesChecker::setCheckerMode ( CheckerMode  checkerMode)

Set method for checker mode.

Definition at line 123 of file DocumentModelAxesChecker.cpp.

124 {
125  m_checkerMode = checkerMode;
126 }

◆ setCheckerSeconds()

void DocumentModelAxesChecker::setCheckerSeconds ( int  seconds)

Set method for checker lifetime in seconds.

Definition at line 128 of file DocumentModelAxesChecker.cpp.

129 {
130  m_checkerSeconds = seconds;
131 }

◆ setLineColor()

void DocumentModelAxesChecker::setLineColor ( ColorPalette  lineColor)

Set method for line color.

Definition at line 133 of file DocumentModelAxesChecker.cpp.

134 {
135  m_lineColor = lineColor;
136 }

The documentation for this class was generated from the following files:
DocumentModelAxesChecker::setCheckerSeconds
void setCheckerSeconds(int seconds)
Set method for checker lifetime in seconds.
Definition: DocumentModelAxesChecker.cpp:128
DocumentModelAxesChecker::checkerMode
CheckerMode checkerMode() const
Get method for checker lifetime mode.
Definition: DocumentModelAxesChecker.cpp:53
DOCUMENT_SERIALIZE_AXES_CHECKER_SECONDS
const QString DOCUMENT_SERIALIZE_AXES_CHECKER_SECONDS
ColorPalette
ColorPalette
Definition: ColorPalette.h:12
checkerModeToString
QString checkerModeToString(CheckerMode checkerMode)
Definition: CheckerMode.cpp:10
DOCUMENT_SERIALIZE_AXES_CHECKER
const QString DOCUMENT_SERIALIZE_AXES_CHECKER
DocumentModelAxesChecker::lineColor
ColorPalette lineColor() const
Get method for line color.
Definition: DocumentModelAxesChecker.cpp:63
DocumentModelAxesChecker::setLineColor
void setLineColor(ColorPalette lineColor)
Set method for line color.
Definition: DocumentModelAxesChecker.cpp:133
LOG4CPP_INFO_S
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
CheckerMode
CheckerMode
Options for axes checker mode. Specifically, how long the checker is displayed after a change.
Definition: CheckerMode.h:13
DEFAULT_LINE_COLOR
const ColorPalette DEFAULT_LINE_COLOR
Definition: DocumentModelAxesChecker.cpp:21
mainCat
log4cpp::Category * mainCat
Definition: Logger.cpp:14
DocumentModelAxesChecker::setCheckerMode
void setCheckerMode(CheckerMode checkerMode)
Set method for checker mode.
Definition: DocumentModelAxesChecker.cpp:123
DEFAULT_CHECKER_SECONDS
const int DEFAULT_CHECKER_SECONDS
Definition: DocumentModelAxesChecker.cpp:17
colorPaletteToString
QString colorPaletteToString(ColorPalette colorPalette)
Definition: ColorPalette.cpp:9
DocumentModelAxesChecker::checkerSeconds
int checkerSeconds() const
Get method for checker lifetime in seconds.
Definition: DocumentModelAxesChecker.cpp:58
INDENTATION_DELTA
const QString INDENTATION_DELTA
Document::modelAxesChecker
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
Definition: Document.cpp:681
CHECKER_MODE_N_SECONDS
@ CHECKER_MODE_N_SECONDS
Definition: CheckerMode.h:20
DOCUMENT_SERIALIZE_AXES_CHECKER_MODE
const QString DOCUMENT_SERIALIZE_AXES_CHECKER_MODE
loadNextFromReader
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
DOCUMENT_SERIALIZE_AXES_CHECKER_LINE_COLOR
const QString DOCUMENT_SERIALIZE_AXES_CHECKER_LINE_COLOR