mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Clean some code
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4263 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -74,9 +74,10 @@ QETProject::QETProject(int diagrams, QObject *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Construit un projet a partir du chemin d'un fichier.
|
* @brief QETProject::QETProject
|
||||||
@param path Chemin du fichier
|
* Construct a project from a .qet file
|
||||||
@param parent QObject parent
|
* @param path : path of the file
|
||||||
|
* @param parent : parent QObject
|
||||||
*/
|
*/
|
||||||
QETProject::QETProject(const QString &path, QObject *parent) :
|
QETProject::QETProject(const QString &path, QObject *parent) :
|
||||||
QObject (parent),
|
QObject (parent),
|
||||||
@@ -88,23 +89,25 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
|||||||
folioSheetsQuantity (0 ),
|
folioSheetsQuantity (0 ),
|
||||||
m_auto_conductor (true )
|
m_auto_conductor (true )
|
||||||
{
|
{
|
||||||
// ouvre le fichier
|
//Open the file
|
||||||
QFile project_file(path);
|
QFile project_file(path);
|
||||||
if (!project_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if (!project_file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
state_ = FileOpenFailed;
|
state_ = FileOpenFailed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setFilePath(path);
|
setFilePath(path);
|
||||||
|
|
||||||
// en extrait le contenu XML
|
//Extract the content of the xml
|
||||||
bool xml_parsing = document_root_.setContent(&project_file);
|
QDomDocument xml_project;
|
||||||
if (!xml_parsing) {
|
if (!xml_project.setContent(&project_file))
|
||||||
|
{
|
||||||
state_ = XmlParsingFailed;
|
state_ = XmlParsingFailed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// et construit le projet
|
//Build the project from the xml
|
||||||
readProjectXml();
|
readProjectXml(xml_project);
|
||||||
|
|
||||||
setupTitleBlockTemplatesCollection();
|
setupTitleBlockTemplatesCollection();
|
||||||
|
|
||||||
@@ -119,53 +122,13 @@ QETProject::QETProject(const QString &path, QObject *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Construit un projet a partir d'un element XML representant le projet.
|
* @brief QETProject::~QETProject
|
||||||
L'element XML fourni est copie et conserve dans la classe.
|
* Destructor
|
||||||
*/
|
*/
|
||||||
QETProject::QETProject(const QDomElement &xml_element, QObject *parent) :
|
QETProject::~QETProject()
|
||||||
QObject (parent),
|
|
||||||
collection_ (0 ),
|
|
||||||
project_qet_version_ (-1 ),
|
|
||||||
modified_ (false ),
|
|
||||||
read_only_ (false ),
|
|
||||||
titleblocks_ (this ),
|
|
||||||
folioSheetsQuantity (0 ),
|
|
||||||
m_auto_conductor (true )
|
|
||||||
{
|
{
|
||||||
// copie le contenu XML
|
if (collection_) delete collection_;
|
||||||
document_root_.appendChild(document_root_.importNode(xml_element, true));
|
qDeleteAll(diagrams_);
|
||||||
|
|
||||||
// et construit le projet
|
|
||||||
readProjectXml();
|
|
||||||
|
|
||||||
setupTitleBlockTemplatesCollection();
|
|
||||||
|
|
||||||
undo_stack_ = new QUndoStack();
|
|
||||||
connect(undo_stack_, SIGNAL(cleanChanged(bool)), this, SLOT(undoStackChanged(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Destructeur
|
|
||||||
*/
|
|
||||||
QETProject::~QETProject() {
|
|
||||||
// supprime les schemas
|
|
||||||
// qDebug() << "Suppression du projet" << ((void *)this);
|
|
||||||
|
|
||||||
// supprime la collection
|
|
||||||
// qDebug() << "Suppression de la collection du projet" << ((void *)this);
|
|
||||||
if (collection_) {
|
|
||||||
delete collection_;
|
|
||||||
}
|
|
||||||
// qDebug() << "Collection du projet" << ((void *)this) << "supprimee";
|
|
||||||
|
|
||||||
// qDebug() << diagrams_;
|
|
||||||
foreach (Diagram *diagram, diagrams_) {
|
|
||||||
diagrams_.removeAll(diagram);
|
|
||||||
delete diagram;
|
|
||||||
}
|
|
||||||
|
|
||||||
folioSheetsQuantity = 0;
|
|
||||||
// qDebug() << diagrams_;
|
|
||||||
delete undo_stack_;
|
delete undo_stack_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,32 +600,28 @@ bool QETProject::close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Enregistre le projet vers un fichier.
|
* @brief QETProject::write
|
||||||
@see filePath()
|
* Save the project in a file
|
||||||
@see setFilePath()
|
* @see filePath()
|
||||||
@return true si l'enregistrement a reussi, false sinon
|
* @see setFilePath()
|
||||||
|
* @return true if the project was successfully saved, else false
|
||||||
*/
|
*/
|
||||||
QETResult QETProject::write() {
|
QETResult QETProject::write()
|
||||||
|
{
|
||||||
// this operation requires a filepath
|
// this operation requires a filepath
|
||||||
if (file_path_.isEmpty()) {
|
if (file_path_.isEmpty())
|
||||||
return(QString("unable to save project to file: no filepath was specified"));
|
return(QString("unable to save project to file: no filepath was specified"));
|
||||||
}
|
|
||||||
|
|
||||||
// if the project was opened read-only and the file is still non-writable, do not save the project
|
// if the project was opened read-only and the file is still non-writable, do not save the project
|
||||||
if (isReadOnly() && !QFileInfo(file_path_).isWritable()) {
|
if (isReadOnly() && !QFileInfo(file_path_).isWritable())
|
||||||
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
|
return(QString("the file %1 was opened read-only and thus will not be written").arg(file_path_));
|
||||||
}
|
|
||||||
|
|
||||||
// realise l'export en XML du projet dans le document XML interne
|
|
||||||
document_root_.clear();
|
|
||||||
document_root_.appendChild(document_root_.importNode(toXml().documentElement(), true));
|
|
||||||
|
|
||||||
|
//Get the project in xml
|
||||||
|
QDomDocument xml_project;
|
||||||
|
xml_project.appendChild(xml_project.importNode(toXml().documentElement(), true));
|
||||||
|
|
||||||
QString error_message;
|
QString error_message;
|
||||||
bool writing = QET::writeXmlFile(document_root_, file_path_, &error_message);
|
if (!QET::writeXmlFile(xml_project, file_path_, &error_message)) return(error_message);
|
||||||
if (!writing) {
|
|
||||||
return(error_message);
|
|
||||||
}
|
|
||||||
|
|
||||||
setModified(false);
|
setModified(false);
|
||||||
return(QETResult());
|
return(QETResult());
|
||||||
@@ -1100,21 +1059,26 @@ ElementsCategory *QETProject::rootCategory() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
(Re)lit le projet depuis sa description XML
|
* @brief QETProject::readProjectXml
|
||||||
|
* Read and make the project from an xml description
|
||||||
|
* @param xml_project : the description of the project from an xml
|
||||||
*/
|
*/
|
||||||
void QETProject::readProjectXml() {
|
void QETProject::readProjectXml(QDomDocument &xml_project)
|
||||||
QDomElement root_elmt = document_root_.documentElement();
|
{
|
||||||
|
QDomElement root_elmt = xml_project.documentElement();
|
||||||
state_ = ProjectParsingRunning;
|
state_ = ProjectParsingRunning;
|
||||||
|
|
||||||
// la racine du document XML est sensee etre un element "project"
|
//The roots of the xml document must be a "project" element
|
||||||
if (root_elmt.tagName() == "project") {
|
if (root_elmt.tagName() == "project")
|
||||||
|
{
|
||||||
// mode d'ouverture normal
|
//Normal opening mode
|
||||||
if (root_elmt.hasAttribute("version")) {
|
if (root_elmt.hasAttribute("version"))
|
||||||
|
{
|
||||||
bool conv_ok;
|
bool conv_ok;
|
||||||
project_qet_version_ = root_elmt.attribute("version").toDouble(&conv_ok);
|
project_qet_version_ = root_elmt.attribute("version").toDouble(&conv_ok);
|
||||||
if (conv_ok && QET::version.toDouble() < project_qet_version_) {
|
|
||||||
|
|
||||||
|
if (conv_ok && QET::version.toDouble() < project_qet_version_)
|
||||||
|
{
|
||||||
int ret = QET::QetMessageBox::warning(
|
int ret = QET::QetMessageBox::warning(
|
||||||
0,
|
0,
|
||||||
tr("Avertissement", "message box title"),
|
tr("Avertissement", "message box title"),
|
||||||
@@ -1129,49 +1093,47 @@ void QETProject::readProjectXml() {
|
|||||||
QMessageBox::Open | QMessageBox::Cancel
|
QMessageBox::Open | QMessageBox::Cancel
|
||||||
);
|
);
|
||||||
|
|
||||||
if (ret == QMessageBox::Cancel) {
|
if (ret == QMessageBox::Cancel)
|
||||||
|
{
|
||||||
state_ = FileOpenDiscard;
|
state_ = FileOpenDiscard;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(root_elmt.attribute("title"));
|
setTitle(root_elmt.attribute("title"));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
state_ = ProjectParsingFailed;
|
state_ = ProjectParsingFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the project-wide properties
|
//Load the project-wide properties
|
||||||
readProjectPropertiesXml();
|
readProjectPropertiesXml(xml_project);
|
||||||
|
//Load the default properties for the new diagrams
|
||||||
// charge les proprietes par defaut pour les nouveaux schemas
|
readDefaultPropertiesXml(xml_project);
|
||||||
readDefaultPropertiesXml();
|
|
||||||
|
|
||||||
//load the embedded titleblock templates
|
//load the embedded titleblock templates
|
||||||
readEmbeddedTemplatesXml();
|
readEmbeddedTemplatesXml(xml_project);
|
||||||
|
//Load the embedded elements collection
|
||||||
// charge la collection embarquee
|
readElementsCollectionXml(xml_project);
|
||||||
readElementsCollectionXml();
|
//Load the diagrams
|
||||||
|
readDiagramsXml(xml_project);
|
||||||
// charge les schemas
|
|
||||||
readDiagramsXml();
|
|
||||||
|
|
||||||
// if there is an attribute for folioSheetQuantity, then set it accordingly.
|
// if there is an attribute for folioSheetQuantity, then set it accordingly.
|
||||||
// If not, then the value remains at the initial value of zero.
|
// If not, then the value remains at the initial value of zero.
|
||||||
if (root_elmt.attribute("folioSheetQuantity","0").toInt()) {
|
if (root_elmt.attribute("folioSheetQuantity","0").toInt())
|
||||||
addNewDiagramFolioList();
|
addNewDiagramFolioList();
|
||||||
}
|
|
||||||
|
|
||||||
state_ = Ok;
|
state_ = Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Charge les schemas depuis la description XML du projet.
|
* @brief QETProject::readDiagramsXml
|
||||||
A noter qu'un projet peut parfaitement ne pas avoir de schema.
|
* Load the diagrams from the xml description of the project.
|
||||||
|
* Note a project can have 0 diagram
|
||||||
|
* @param xml_project
|
||||||
*/
|
*/
|
||||||
void QETProject::readDiagramsXml() {
|
void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
||||||
// map destinee a accueillir les schemas
|
{
|
||||||
QMultiMap<int, Diagram *> loaded_diagrams;
|
QMultiMap<int, Diagram *> loaded_diagrams;
|
||||||
|
|
||||||
//@TODO try to solve a weird bug (dialog is black) since port to Qt5 with the DialogWaiting
|
//@TODO try to solve a weird bug (dialog is black) since port to Qt5 with the DialogWaiting
|
||||||
@@ -1181,8 +1143,8 @@ void QETProject::readDiagramsXml() {
|
|||||||
dlgWaiting -> show();
|
dlgWaiting -> show();
|
||||||
dlgWaiting -> setTitle( tr("<b>Ouverture du projet en cours...</b>") );
|
dlgWaiting -> setTitle( tr("<b>Ouverture du projet en cours...</b>") );
|
||||||
|
|
||||||
// recherche les schemas dans le projet
|
//Search the diagrams in the project
|
||||||
QDomNodeList diagram_nodes = document_root_.elementsByTagName("diagram");
|
QDomNodeList diagram_nodes = xml_project.elementsByTagName("diagram");
|
||||||
dlgWaiting->setProgressBarRange(0, diagram_nodes.length());
|
dlgWaiting->setProgressBarRange(0, diagram_nodes.length());
|
||||||
for (int i = 0 ; i < diagram_nodes.length() ; ++ i)
|
for (int i = 0 ; i < diagram_nodes.length() ; ++ i)
|
||||||
{
|
{
|
||||||
@@ -1195,7 +1157,7 @@ void QETProject::readDiagramsXml() {
|
|||||||
if (diagram_loading)
|
if (diagram_loading)
|
||||||
{
|
{
|
||||||
dlgWaiting->setDetail( diagram->title() );
|
dlgWaiting->setDetail( diagram->title() );
|
||||||
// recupere l'attribut order du schema
|
//Get the attribute "order" of the diagram
|
||||||
int diagram_order = -1;
|
int diagram_order = -1;
|
||||||
if (!QET::attributeIsAnInteger(diagram_xml_element, "order", &diagram_order)) diagram_order = 500000;
|
if (!QET::attributeIsAnInteger(diagram_xml_element, "order", &diagram_order)) diagram_order = 500000;
|
||||||
loaded_diagrams.insert(diagram_order, diagram);
|
loaded_diagrams.insert(diagram_order, diagram);
|
||||||
@@ -1207,75 +1169,74 @@ void QETProject::readDiagramsXml() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ajoute les schemas dans l'ordre indique par les attributs order
|
//Add the diagrams according to there "order" attribute
|
||||||
foreach(Diagram *diagram, loaded_diagrams.values()) {
|
foreach(Diagram *diagram, loaded_diagrams.values())
|
||||||
addDiagram(diagram);
|
addDiagram(diagram);
|
||||||
}
|
|
||||||
//Initialise links between elements in this project
|
//Initialise links between elements in this project
|
||||||
foreach (Diagram *d, diagrams()) {
|
foreach (Diagram *d, diagrams())
|
||||||
d->initElementsLinks();
|
d->initElementsLinks();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//delete dialog object
|
|
||||||
delete dlgWaiting;
|
delete dlgWaiting;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Loads the embedded template from the XML description of the project
|
* @brief QETProject::readEmbeddedTemplatesXml
|
||||||
|
* Loads the embedded template from the XML description of the project
|
||||||
|
* @param xml_project : the xml description of the project
|
||||||
*/
|
*/
|
||||||
void QETProject::readEmbeddedTemplatesXml() {
|
void QETProject::readEmbeddedTemplatesXml(QDomDocument &xml_project) {
|
||||||
titleblocks_.fromXml(document_root_.documentElement());
|
titleblocks_.fromXml(xml_project.documentElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Charge les schemas depuis la description XML du projet
|
* @brief QETProject::readElementsCollectionXml
|
||||||
|
* Load the diagrams from the xml description of the project
|
||||||
|
* @param xml_project : the xml description of the project
|
||||||
*/
|
*/
|
||||||
void QETProject::readElementsCollectionXml() {
|
void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
|
||||||
// recupere la collection d'elements integreee au projet
|
{
|
||||||
QDomNodeList collection_roots = document_root_.elementsByTagName("collection");
|
//Get the embedded elements collection of the project
|
||||||
|
QDomNodeList collection_roots = xml_project.elementsByTagName("collection");
|
||||||
QDomElement collection_root;
|
QDomElement collection_root;
|
||||||
if (!collection_roots.isEmpty()) {
|
|
||||||
// seule la premiere collection trouvee est prise en compte
|
if (!collection_roots.isEmpty())
|
||||||
|
{
|
||||||
|
//Only the first found collection is take
|
||||||
collection_root = collection_roots.at(0).toElement();
|
collection_root = collection_roots.at(0).toElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collection_root.isNull()) {
|
if (collection_root.isNull()) //Make an empty collection
|
||||||
// s'il n'y en a pas, cree une collection vide
|
|
||||||
collection_ = new XmlElementsCollection();
|
collection_ = new XmlElementsCollection();
|
||||||
} else {
|
else //Read the collection
|
||||||
// sinon lit cette collection
|
|
||||||
collection_ = new XmlElementsCollection(collection_root);
|
collection_ = new XmlElementsCollection(collection_root);
|
||||||
}
|
|
||||||
collection_ -> setProtocol("embed");
|
collection_ -> setProtocol("embed");
|
||||||
collection_ -> setProject(this);
|
collection_ -> setProject(this);
|
||||||
connect(collection_, SIGNAL(written()), this, SLOT(componentWritten()));
|
connect(collection_, SIGNAL(written()), this, SLOT(componentWritten()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load project properties from the XML description of the project
|
* @brief QETProject::readProjectPropertiesXml
|
||||||
|
* Load project properties from the XML description of the project
|
||||||
|
* @param xml_project : the xml description of the project
|
||||||
*/
|
*/
|
||||||
void QETProject::readProjectPropertiesXml() {
|
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
|
||||||
foreach (QDomElement e, QET::findInDomElement(document_root_.documentElement(), "properties")) {
|
{
|
||||||
|
foreach (QDomElement e, QET::findInDomElement(xml_project.documentElement(), "properties"))
|
||||||
project_properties_.fromXml(e);
|
project_properties_.fromXml(e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Export project properties under the \a xml_element XML element.
|
|
||||||
*/
|
|
||||||
void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) {
|
|
||||||
project_properties_.toXml(xml_element);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::readDefaultPropertiesXml
|
* @brief QETProject::readDefaultPropertiesXml
|
||||||
* load default properties for new diagram, found in the xml of this project
|
* load default properties for new diagram, found in the xml of this project
|
||||||
* or by default find in the QElectroTech global conf
|
* or by default find in the QElectroTech global conf
|
||||||
|
* @param xml_project : the xml description of the project
|
||||||
*/
|
*/
|
||||||
void QETProject::readDefaultPropertiesXml() {
|
void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
||||||
|
{
|
||||||
// Find xml element where is stored properties for new diagram
|
// Find xml element where is stored properties for new diagram
|
||||||
QDomNodeList newdiagrams_nodes = document_root_.elementsByTagName("newdiagrams");
|
QDomNodeList newdiagrams_nodes = xml_project.elementsByTagName("newdiagrams");
|
||||||
if (newdiagrams_nodes.isEmpty()) return;
|
if (newdiagrams_nodes.isEmpty()) return;
|
||||||
|
|
||||||
QDomElement newdiagrams_elmt = newdiagrams_nodes.at(0).toElement();
|
QDomElement newdiagrams_elmt = newdiagrams_nodes.at(0).toElement();
|
||||||
@@ -1290,38 +1251,43 @@ void QETProject::readDefaultPropertiesXml() {
|
|||||||
//Read values indicate in project
|
//Read values indicate in project
|
||||||
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
|
QDomElement border_elmt, titleblock_elmt, conductors_elmt, report_elmt, xref_elmt, conds_autonums;
|
||||||
|
|
||||||
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling()) {
|
for (QDomNode child = newdiagrams_elmt.firstChild() ; !child.isNull() ; child = child.nextSibling())
|
||||||
|
{
|
||||||
QDomElement child_elmt = child.toElement();
|
QDomElement child_elmt = child.toElement();
|
||||||
if (child_elmt.isNull()) continue;
|
if (child_elmt.isNull()) continue;
|
||||||
if (child_elmt.tagName() == "border") {
|
|
||||||
|
if (child_elmt.tagName() == "border")
|
||||||
border_elmt = child_elmt;
|
border_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "inset") {
|
else if (child_elmt.tagName() == "inset")
|
||||||
titleblock_elmt = child_elmt;
|
titleblock_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "conductors") {
|
else if (child_elmt.tagName() == "conductors")
|
||||||
conductors_elmt = child_elmt;
|
conductors_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "report") {
|
else if (child_elmt.tagName() == "report")
|
||||||
report_elmt = child_elmt;
|
report_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "xrefs") {
|
else if (child_elmt.tagName() == "xrefs")
|
||||||
xref_elmt = child_elmt;
|
xref_elmt = child_elmt;
|
||||||
} else if (child_elmt.tagName() == "conductors_autonums") {
|
else if (child_elmt.tagName() == "conductors_autonums")
|
||||||
conds_autonums = child_elmt;
|
conds_autonums = child_elmt;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// size, titleblock, conductor, report, conductor autonum
|
// size, titleblock, conductor, report, conductor autonum
|
||||||
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
if (!border_elmt.isNull()) default_border_properties_.fromXml(border_elmt);
|
||||||
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
if (!titleblock_elmt.isNull()) default_titleblock_properties_.fromXml(titleblock_elmt);
|
||||||
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
if (!conductors_elmt.isNull()) default_conductor_properties_.fromXml(conductors_elmt);
|
||||||
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
|
||||||
if (!xref_elmt.isNull()) {
|
if (!xref_elmt.isNull())
|
||||||
foreach(QDomElement elmt, QET::findInDomElement(xref_elmt, "xref")) {
|
{
|
||||||
|
foreach(QDomElement elmt, QET::findInDomElement(xref_elmt, "xref"))
|
||||||
|
{
|
||||||
XRefProperties xrp;
|
XRefProperties xrp;
|
||||||
xrp.fromXml(elmt);
|
xrp.fromXml(elmt);
|
||||||
m_default_xref_properties.insert(elmt.attribute("type"), xrp);
|
m_default_xref_properties.insert(elmt.attribute("type"), xrp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!conds_autonums.isNull()) {
|
if (!conds_autonums.isNull())
|
||||||
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum")) {
|
{
|
||||||
|
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum"))
|
||||||
|
{
|
||||||
NumerotationContext nc;
|
NumerotationContext nc;
|
||||||
nc.fromXml(elmt);
|
nc.fromXml(elmt);
|
||||||
m_conductor_autonum.insert(elmt.attribute("title"), nc);
|
m_conductor_autonum.insert(elmt.attribute("title"), nc);
|
||||||
@@ -1329,6 +1295,12 @@ void QETProject::readDefaultPropertiesXml() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Export project properties under the \a xml_element XML element.
|
||||||
|
*/
|
||||||
|
void QETProject::writeProjectPropertiesXml(QDomElement &xml_element) {
|
||||||
|
project_properties_.toXml(xml_element);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::writeDefaultPropertiesXml
|
* @brief QETProject::writeDefaultPropertiesXml
|
||||||
|
|||||||
@@ -17,8 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef QET_PROJECT_H
|
#ifndef QET_PROJECT_H
|
||||||
#define QET_PROJECT_H
|
#define QET_PROJECT_H
|
||||||
#include <QtCore>
|
|
||||||
#include <QtXml>
|
|
||||||
#include "nameslist.h"
|
#include "nameslist.h"
|
||||||
#include "elementslocation.h"
|
#include "elementslocation.h"
|
||||||
#include "borderproperties.h"
|
#include "borderproperties.h"
|
||||||
@@ -56,7 +55,6 @@ class QETProject : public QObject
|
|||||||
public:
|
public:
|
||||||
QETProject (int = 1, QObject * = 0);
|
QETProject (int = 1, QObject * = 0);
|
||||||
QETProject (const QString &, QObject * = 0);
|
QETProject (const QString &, QObject * = 0);
|
||||||
QETProject (const QDomElement &, QObject * = 0);
|
|
||||||
virtual ~QETProject();
|
virtual ~QETProject();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -183,13 +181,15 @@ class QETProject : public QObject
|
|||||||
private:
|
private:
|
||||||
void setupTitleBlockTemplatesCollection();
|
void setupTitleBlockTemplatesCollection();
|
||||||
ElementsCategory *rootCategory() const;
|
ElementsCategory *rootCategory() const;
|
||||||
void readProjectXml();
|
|
||||||
void readDiagramsXml();
|
void readProjectXml(QDomDocument &xml_project);
|
||||||
void readElementsCollectionXml();
|
void readDiagramsXml(QDomDocument &xml_project);
|
||||||
void readEmbeddedTemplatesXml();
|
void readEmbeddedTemplatesXml(QDomDocument &xml_project);
|
||||||
void readProjectPropertiesXml();
|
void readElementsCollectionXml(QDomDocument &xml_project);
|
||||||
|
void readProjectPropertiesXml(QDomDocument &xml_project);
|
||||||
|
void readDefaultPropertiesXml(QDomDocument &xml_project);
|
||||||
|
|
||||||
void writeProjectPropertiesXml(QDomElement &);
|
void writeProjectPropertiesXml(QDomElement &);
|
||||||
void readDefaultPropertiesXml();
|
|
||||||
void writeDefaultPropertiesXml(QDomElement &);
|
void writeDefaultPropertiesXml(QDomElement &);
|
||||||
void addDiagram(Diagram *);
|
void addDiagram(Diagram *);
|
||||||
NamesList namesListForIntegrationCategory();
|
NamesList namesListForIntegrationCategory();
|
||||||
@@ -201,8 +201,6 @@ class QETProject : public QObject
|
|||||||
QString file_path_;
|
QString file_path_;
|
||||||
/// Current state of the project
|
/// Current state of the project
|
||||||
ProjectState state_;
|
ProjectState state_;
|
||||||
/// XML document representing the project
|
|
||||||
QDomDocument document_root_;
|
|
||||||
/// Diagrams carried by the project
|
/// Diagrams carried by the project
|
||||||
QList<Diagram *> diagrams_;
|
QList<Diagram *> diagrams_;
|
||||||
/// Embedded elements collection
|
/// Embedded elements collection
|
||||||
|
|||||||
@@ -89,7 +89,5 @@ class XmlElementsCategory : public ElementsCategory {
|
|||||||
QHash<QString, XmlElementDefinition *> elements_;
|
QHash<QString, XmlElementDefinition *> elements_;
|
||||||
/// Nae of this category within the tree
|
/// Nae of this category within the tree
|
||||||
QString name_;
|
QString name_;
|
||||||
/// XML description of this category
|
|
||||||
QDomDocument xml_element_;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user