Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CmdCopy Class Reference

Command for moving all selected Points by a specified translation. More...

#include <CmdCopy.h>

Inheritance diagram for CmdCopy:
Inheritance graph
Collaboration diagram for CmdCopy:
Collaboration graph

Public Member Functions

 CmdCopy (MainWindow &mainWindow, Document &document, const QStringList &selectedPointIdentifiers)
 Constructor for normal creation.
 
 CmdCopy (MainWindow &mainWindow, Document &document, const QString &cmdDescription, QXmlStreamReader &reader)
 Constructor for parsing error report file xml.
 
virtual ~CmdCopy ()
 
virtual void cmdRedo ()
 Redo method that is called when QUndoStack is moved one command forward.
 
virtual void cmdUndo ()
 Undo method that is called when QUndoStack is moved one command backward.
 
virtual void saveXml (QXmlStreamWriter &writer) const
 Save commands as xml for later uploading.
 
- Public Member Functions inherited from CmdAbstract
 CmdAbstract (MainWindow &mainWindow, Document &document, const QString &cmdDescription)
 Single constructor.
 
virtual ~CmdAbstract ()
 

Additional Inherited Members

- Protected Member Functions inherited from CmdAbstract
Documentdocument ()
 Return the Document that this command will modify during redo and undo.
 
const Documentdocument () const
 Return a const copy of the Document for non redo/undo interaction.
 
MainWindowmainWindow ()
 Return the MainWindow so it can be updated by this command as a last step.
 
void resetSelection (const PointIdentifiers &pointIdentifiersToSelect)
 Since the set of selected points has probably changed, changed that set back to the specified set.
 
void saveOrCheckPostCommandDocumentStateHash (const Document &document)
 Save, when called the first time, a hash value representing the state of the Document.
 
void saveOrCheckPreCommandDocumentStateHash (const Document &document)
 Save, when called the first time, a hash value representing the state of the Document.
 

Detailed Description

Command for moving all selected Points by a specified translation.

Definition at line 18 of file CmdCopy.h.

Constructor & Destructor Documentation

◆ CmdCopy() [1/2]

CmdCopy::CmdCopy ( MainWindow & mainWindow,
Document & document,
const QStringList & selectedPointIdentifiers )

Constructor for normal creation.

Definition at line 27 of file CmdCopy.cpp.

29 :
33 m_transformIsDefined (mainWindow.transformIsDefined())
34{
35 LOG4CPP_INFO_S ((*mainCat)) << "CmdCopy::CmdCopy"
36 << " selected=" << selectedPointIdentifiers.count ();
37
39 QTextStream strCsv (&m_csv), strHtml (&m_html);
40 exportStrategy.exportToClipboard (selectedPointIdentifiers,
42 strCsv,
43 strHtml,
46 m_curvesGraphs);
47}
const QString CMD_DESCRIPTION("Add axis point")
const int INNER_RADIUS_MIN
log4cpp::Category * mainCat
Definition Logger.cpp:14
Wrapper around QUndoCommand. This simplifies the more complicated feature set of QUndoCommand.
Definition CmdAbstract.h:20
Document & document()
Return the Document that this command will modify during redo and undo.
MainWindow & mainWindow()
Return the MainWindow so it can be updated by this command as a last step.
const Curve & curveAxes() const
Get method for axis curve.
Definition Document.cpp:321
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
Definition Document.cpp:342
Strategy class for exporting to the clipboard. This strategy is external to the Document class so tha...
bool transformIsDefined() const
Return true if all three axis points have been defined.
Transformation transformation() const
Return read-only copy of transformation.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18

◆ CmdCopy() [2/2]

CmdCopy::CmdCopy ( MainWindow & mainWindow,
Document & document,
const QString & cmdDescription,
QXmlStreamReader & reader )

Constructor for parsing error report file xml.

Definition at line 49 of file CmdCopy.cpp.

52 :
55 cmdDescription)
56{
57 LOG4CPP_INFO_S ((*mainCat)) << "CmdCopy::CmdCopy";
58
60
62 !attributes.hasAttribute(DOCUMENT_SERIALIZE_CSV) ||
63 !attributes.hasAttribute(DOCUMENT_SERIALIZE_HTML)) {
65 QString ("%1 %2, %3 %4 %5")
66 .arg (QObject::tr ("Missing attribute(s)"))
69 .arg (QObject::tr ("and/or"))
71 }
72
74
75 m_transformIsDefined = (defined == DOCUMENT_SERIALIZE_BOOL_TRUE);
76 m_csv = attributes.value(DOCUMENT_SERIALIZE_CSV).toString();
77 m_html = attributes.value(DOCUMENT_SERIALIZE_HTML).toString();
78 m_curvesGraphs.loadXml(reader);
79}
const QString DOCUMENT_SERIALIZE_TRANSFORM_DEFINED
const QString DOCUMENT_SERIALIZE_HTML
const QString DOCUMENT_SERIALIZE_CSV
const QString DOCUMENT_SERIALIZE_BOOL_TRUE
void xmlExitWithError(QXmlStreamReader &reader, const QString &message)
Show specified message for an error while reading xml, then quit.
Definition Xml.cpp:25
void loadXml(QXmlStreamReader &reader)
Load from serialized xml post-version 5 file.

◆ ~CmdCopy()

CmdCopy::~CmdCopy ( )
virtual

Definition at line 81 of file CmdCopy.cpp.

82{
83}

Member Function Documentation

◆ cmdRedo()

void CmdCopy::cmdRedo ( )
virtual

Redo method that is called when QUndoStack is moved one command forward.

Implements CmdAbstract.

Definition at line 85 of file CmdCopy.cpp.

86{
87 LOG4CPP_INFO_S ((*mainCat)) << "CmdCopy::cmdRedo";
88
90 if (m_transformIsDefined) {
92 m_html);
93 } else {
95 }
96
97 QClipboard *clipboard = QApplication::clipboard();
98 clipboard->setMimeData (mimePointsExport, QClipboard::Clipboard);
99
101 document().updatePointOrdinals (mainWindow().transformation());
104}
void saveOrCheckPostCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void saveOrCheckPreCommandDocumentStateHash(const Document &document)
Save, when called the first time, a hash value representing the state of the Document.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void updateAfterCommand()
See GraphicsScene::updateAfterCommand.
Custom mime type for separate treatment of graph coordinates and, when there is no transform,...

◆ cmdUndo()

void CmdCopy::cmdUndo ( )
virtual

Undo method that is called when QUndoStack is moved one command backward.

Implements CmdAbstract.

Definition at line 106 of file CmdCopy.cpp.

◆ saveXml()

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

Save commands as xml for later uploading.

Implements CmdAbstract.

Definition at line 116 of file CmdCopy.cpp.

117{
118 writer.writeStartElement(DOCUMENT_SERIALIZE_CMD);
120 writer.writeAttribute(DOCUMENT_SERIALIZE_CMD_DESCRIPTION, QUndoCommand::text ());
123 writer.writeAttribute(DOCUMENT_SERIALIZE_CSV, m_csv);
124 writer.writeAttribute(DOCUMENT_SERIALIZE_HTML, m_html);
125 m_curvesGraphs.saveXml(writer);
126 writer.writeEndElement();
127}
const QString DOCUMENT_SERIALIZE_CMD
const QString DOCUMENT_SERIALIZE_CMD_TYPE
const QString DOCUMENT_SERIALIZE_CMD_DESCRIPTION
const QString DOCUMENT_SERIALIZE_CMD_COPY
const QString DOCUMENT_SERIALIZE_BOOL_FALSE
void saveXml(QXmlStreamWriter &writer) const
Serialize curves.

The documentation for this class was generated from the following files: