New element panel can read the embedded collection of project (only at opening, other fonctionnality isn't created yet)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4287 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-12-16 17:16:15 +00:00
parent 593f8eb4f1
commit 4f222d2843
14 changed files with 644 additions and 31 deletions

View File

@@ -32,6 +32,7 @@
#include "numerotationcontext.h"
#include "reportproperties.h"
#include "integrationmovetemplateshandler.h"
#include "xmlelementcollection.h"
#include <QStandardPaths>
@@ -51,7 +52,8 @@ QETProject::QETProject(int diagrams, QObject *parent) :
read_only_ (false ),
titleblocks_ (this ),
folioSheetsQuantity (0 ),
m_auto_conductor (true )
m_auto_conductor (true ),
m_elements_collection (nullptr)
{
// 0 a n schema(s) vide(s)
int diagrams_count = qMax(0, diagrams);
@@ -64,6 +66,8 @@ QETProject::QETProject(int diagrams, QObject *parent) :
collection_ -> setProtocol("embed");
collection_ -> setProject(this);
connect(collection_, SIGNAL(written()), this, SLOT(componentWritten()));
m_elements_collection = new XmlElementCollection(this);
// une categorie dediee aux elements integres automatiquement
ensureIntegrationCategoryExists();
@@ -87,7 +91,8 @@ QETProject::QETProject(const QString &path, QObject *parent) :
read_only_ (false ),
titleblocks_ (this ),
folioSheetsQuantity (0 ),
m_auto_conductor (true )
m_auto_conductor (true ),
m_elements_collection (nullptr)
{
//Open the file
QFile project_file(path);
@@ -204,6 +209,14 @@ ElementsCollection *QETProject::embeddedCollection() const {
return(collection_);
}
/**
* @brief QETProject::embeddedCollection
* @return The embedded collection
*/
XmlElementCollection *QETProject::embeddedElementCollection() const {
return m_elements_collection;
}
/**
@return the title block templates collection enbeedded within this project
*/
@@ -1141,9 +1154,15 @@ void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
}
if (collection_root.isNull()) //Make an empty collection
{
collection_ = new XmlElementsCollection();
m_elements_collection = new XmlElementCollection(this);
}
else //Read the collection
{
collection_ = new XmlElementsCollection(collection_root);
m_elements_collection = new XmlElementCollection(collection_root, this);
}
collection_ -> setProtocol("embed");
collection_ -> setProject(this);