9 #include <QXmlStreamWriter>
18 #include "XmlStackedHandlerReader.h"
39 m_id =
new QUuid(QUuid::createUuid());
61 m_id =
new QUuid(QUuid::createUuid());
78 xmlReader->pushContentHandler(
new XmlHandler(
this, cnetFolder));
182 return m_id->toString().remove(QRegExp(
"[{}]"));
196 FileName newCnetFileName(project->
cnetRoot(newProjectRoot.toString()) +
"/" +
214 tr(
"Could not remove file [%1]").arg(
m_fileName),
235 original.dir().dirName() +
"/" + original.name());
250 stream.writeStartElement(
"controlNet");
251 stream.writeAttribute(
"id",
m_id->toString());
257 stream.writeEndElement();
287 const QString &qName,
const QXmlAttributes &atts) {
288 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
289 if (localName ==
"controlNet") {
290 QString
id = atts.value(
"id");
291 QString path = atts.value(
"path");
292 QString
fileName = atts.value(
"fileName");
295 delete m_xmlHandlerControl->m_id;
296 m_xmlHandlerControl->m_id = NULL;
297 m_xmlHandlerControl->m_id =
new QUuid(
id.toLatin1());
300 if (!fileName.isEmpty()) {
301 m_xmlHandlerControl->m_fileName = m_xmlHandlerCnetFolderName.expanded() +
"/" +
fileName;
302 m_xmlHandlerControl->openControlNet();
305 else if (localName ==
"displayProperties") {
This represents an ISIS control net in a project-based GUI interface.
The main project for cnetsuite.
void deleteFromDisk()
Delete the control net from disk.
File name manipulation and expansion.
Control(QString cnetFileName, QObject *parent=0)
Create a Control from control net located on disk.
ControlDisplayProperties * m_displayProperties
Contains the display properties for this Control object.
QUuid * m_id
A unique ID for this Control.
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copies the files of the given Project to the given location.
FileName m_xmlHandlerCnetFolderName
The name of the folder for the control xml.
Nested class used to write the Control object information to an XML file for the purpose of saving an...
QString id() const
Access the unique ID associated with this Control.
This error is for when a programmer made an API call that was illegal.
A type of error that occurred when performing an actual I/O operation.
static QString cnetRoot(QString projectRoot)
Appends the root directory name 'cnets' to the project.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Method to read the given XML formatted attribute for a Control object into the XmlHandler.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Method to write this Control object's member data to an XML stream.
void closeControlNet()
Cleans up the ControlNet pointer.
This is the GUI communication mechanism for cubes.
void openControlNet()
Sets the ControlNet from the control net file name provided in the constructor.
#define _FILEINFO_
Macro for the filename and line number.
~Control()
Destroys Control object.
QString fileName() const
Access the name of the control network file associated with this Control.
void updateFileName(Project *)
Change the on-disk file name for this control to be where the control ought to be in the given projec...
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
XmlHandler(Control *control, FileName cnetFolder)
Constructor for the Control object's XmlHandler.
ControlNet * m_controlNet
A pointer to the ControlNet object associated with this Control object.
QString m_fileName
File name of the control net associated with this control.
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
Control * m_xmlHandlerControl
A pointer to the Control object to be read or written.
his enables stack-based XML parsing of XML files.
QString projectRoot() const
Get the top-level folder of the project.
void Write(const QString &filename, bool pvl=false)
Writes out the control network.