mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 16:20:52 +01:00
Conductor Autonum now works with variables. Folio Autonumberings added to conductor autonum
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4674 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -121,6 +121,5 @@ void ConductorAutoNumerotation::numerateNewConductor() {
|
|||||||
if (context.isEmpty()) return;
|
if (context.isEmpty()) return;
|
||||||
|
|
||||||
NumerotationContextCommands ncc (context, m_diagram);
|
NumerotationContextCommands ncc (context, m_diagram);
|
||||||
applyText(ncc.toRepresentedString());
|
applyText(m_diagram->project()->conductorAutoNumCurrentFormula());
|
||||||
m_diagram->project()->addConductorAutoNum(m_diagram -> conductorsAutonumName(), ncc.next());
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,6 +367,15 @@ QString ConductorProperties::typeToString(ConductorType t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ConductorProperties::setText
|
||||||
|
* This method sets the current conductor text
|
||||||
|
* @param text to be setted
|
||||||
|
*/
|
||||||
|
void ConductorProperties::setText(QString text) {
|
||||||
|
text = text;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ConductorProperties::defaultProperties
|
* @brief ConductorProperties::defaultProperties
|
||||||
* @return the default properties stored in the setting file
|
* @return the default properties stored in the setting file
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class ConductorProperties
|
|||||||
void toSettings(QSettings &, const QString & = QString()) const;
|
void toSettings(QSettings &, const QString & = QString()) const;
|
||||||
void fromSettings(QSettings &, const QString & = QString());
|
void fromSettings(QSettings &, const QString & = QString());
|
||||||
static QString typeToString(ConductorType);
|
static QString typeToString(ConductorType);
|
||||||
|
void setText(QString);
|
||||||
|
|
||||||
static ConductorProperties defaultProperties();
|
static ConductorProperties defaultProperties();
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ Diagram::Diagram(QETProject *project) :
|
|||||||
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
|
connect(&border_and_titleblock, SIGNAL(borderChanged(QRectF,QRectF)), this, SLOT(adjustSceneRect()));
|
||||||
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged(const QString &)), this, SLOT(updateLabels()));
|
connect(&border_and_titleblock, SIGNAL(titleBlockFolioChanged(const QString &)), this, SLOT(updateLabels()));
|
||||||
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadElmtFolioSeq()));
|
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadElmtFolioSeq()));
|
||||||
|
connect(this, SIGNAL (diagramActivated()), this, SLOT(loadCndFolioSeq()));
|
||||||
adjustSceneRect();
|
adjustSceneRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,25 +478,46 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
//Default New Element
|
//Default New Element
|
||||||
racine.setAttribute("freezeNewElement", m_freeze_new_elements_ ? "true" : "false");
|
racine.setAttribute("freezeNewElement", m_freeze_new_elements_ ? "true" : "false");
|
||||||
|
|
||||||
//Folio Sequential Variables
|
//Element Folio Sequential Variables
|
||||||
if (!m_elmt_unitfolio_max.isEmpty() || !m_elmt_tenfolio_max.isEmpty() || !m_elmt_hundredfolio_max.isEmpty()) {
|
if (!m_elmt_unitfolio_max.isEmpty() || !m_elmt_tenfolio_max.isEmpty() || !m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement folioContainedAutonum = document.createElement("elementautonumfoliosequentials");
|
QDomElement elmtfoliosequential = document.createElement("elementautonumfoliosequentials");
|
||||||
if (!m_elmt_unitfolio_max.isEmpty()) {
|
if (!m_elmt_unitfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq = document.createElement("elementunitfolioseq");
|
QDomElement elmtfolioseq = document.createElement("elementunitfolioseq");
|
||||||
elementFolioSequentialsToXml(&m_elmt_unitfolio_max, &elmtfolioseq, "sequf_", "unitfolioseq", &document);
|
folioSequentialsToXml(&m_elmt_unitfolio_max, &elmtfolioseq, "sequf_", "unitfolioseq", &document);
|
||||||
folioContainedAutonum.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_elmt_tenfolio_max.isEmpty()) {
|
if (!m_elmt_tenfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq = document.createElement("elementtenfolioseq");
|
QDomElement elmtfolioseq = document.createElement("elementtenfolioseq");
|
||||||
elementFolioSequentialsToXml(&m_elmt_tenfolio_max, &elmtfolioseq, "seqtf_", "tenfolioseq", &document);
|
folioSequentialsToXml(&m_elmt_tenfolio_max, &elmtfolioseq, "seqtf_", "tenfolioseq", &document);
|
||||||
folioContainedAutonum.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
if (!m_elmt_hundredfolio_max.isEmpty()) {
|
if (!m_elmt_hundredfolio_max.isEmpty()) {
|
||||||
QDomElement elmtfolioseq = document.createElement("elementhundredfolioseq");
|
QDomElement elmtfolioseq = document.createElement("elementhundredfolioseq");
|
||||||
elementFolioSequentialsToXml(&m_elmt_hundredfolio_max, &elmtfolioseq, "seqhf_", "hundredfolioseq", &document);
|
folioSequentialsToXml(&m_elmt_hundredfolio_max, &elmtfolioseq, "seqhf_", "hundredfolioseq", &document);
|
||||||
folioContainedAutonum.appendChild(elmtfolioseq);
|
elmtfoliosequential.appendChild(elmtfolioseq);
|
||||||
}
|
}
|
||||||
racine.appendChild(folioContainedAutonum);
|
racine.appendChild(elmtfoliosequential);
|
||||||
|
}
|
||||||
|
//Conductor Folio Sequential Variables
|
||||||
|
if (!m_cnd_unitfolio_max.isEmpty() || !m_cnd_tenfolio_max.isEmpty() || !m_cnd_hundredfolio_max.isEmpty()) {
|
||||||
|
QDomElement cndfoliosequential = document.createElement("conductorautonumfoliosequentials");
|
||||||
|
QHash<QString, QStringList>::iterator i;
|
||||||
|
if (!m_cnd_unitfolio_max.isEmpty()) {
|
||||||
|
QDomElement cndfolioseq = document.createElement("conductorunitfolioseq");
|
||||||
|
folioSequentialsToXml(&m_cnd_unitfolio_max, &cndfolioseq, "sequf_", "unitfolioseq", &document);
|
||||||
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
|
}
|
||||||
|
if (!m_cnd_tenfolio_max.isEmpty()) {
|
||||||
|
QDomElement cndfolioseq = document.createElement("conductortenfolioseq");
|
||||||
|
folioSequentialsToXml(&m_cnd_tenfolio_max, &cndfolioseq, "seqtf_", "tenfolioseq", &document);
|
||||||
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
|
}
|
||||||
|
if (!m_cnd_hundredfolio_max.isEmpty()) {
|
||||||
|
QDomElement cndfolioseq = document.createElement("conductorhundredfolioseq");
|
||||||
|
folioSequentialsToXml(&m_cnd_hundredfolio_max, &cndfolioseq, "seqhf_", "hundredfolioseq", &document);
|
||||||
|
cndfoliosequential.appendChild(cndfolioseq);
|
||||||
|
}
|
||||||
|
racine.appendChild(cndfoliosequential);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -594,13 +616,13 @@ QDomDocument Diagram::toXml(bool whole_content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+ * @brief Diagram::elementFolioSequentialsToXml
|
+ * @brief Diagram::folioSequentialsToXml
|
||||||
+ * Add element folio sequential to QDomElement
|
+ * Add folio sequential to QDomElement
|
||||||
+ * @param domElement to add attributes
|
+ * @param domElement to add attributes
|
||||||
+ * @param hash to retrieve content with content
|
+ * @param hash to retrieve content with content
|
||||||
+ * @param sequential type
|
+ * @param sequential type
|
||||||
+ */
|
+ */
|
||||||
void Diagram::elementFolioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) {
|
void Diagram::folioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) {
|
||||||
QHash<QString, QStringList>::iterator i;
|
QHash<QString, QStringList>::iterator i;
|
||||||
for (i = hash->begin(); i != hash->end(); i++) {
|
for (i = hash->begin(); i != hash->end(); i++) {
|
||||||
QDomElement folioseq = doc->createElement(type);
|
QDomElement folioseq = doc->createElement(type);
|
||||||
@@ -702,9 +724,15 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
// Load Freeze New Element
|
// Load Freeze New Element
|
||||||
m_freeze_new_elements_ = root.attribute("freezeNewElement").toInt();
|
m_freeze_new_elements_ = root.attribute("freezeNewElement").toInt();
|
||||||
|
|
||||||
elementFolioSequentialsFromXml(root, &m_elmt_unitfolio_max, "elementunitfolioseq","sequf_","unitfolioseq");
|
//Load Element Folio Sequential
|
||||||
elementFolioSequentialsFromXml(root, &m_elmt_tenfolio_max, "elementtenfolioseq","seqtf_", "tenfolioseq");
|
folioSequentialsFromXml(root, &m_elmt_unitfolio_max, "elementunitfolioseq","sequf_","unitfolioseq", "elementautonumfoliosequentials");
|
||||||
elementFolioSequentialsFromXml(root, &m_elmt_hundredfolio_max, "elementhundredfolioseq","seqhf_", "hundredfolioseq");
|
folioSequentialsFromXml(root, &m_elmt_tenfolio_max, "elementtenfolioseq","seqtf_", "tenfolioseq", "elementautonumfoliosequentials");
|
||||||
|
folioSequentialsFromXml(root, &m_elmt_hundredfolio_max, "elementhundredfolioseq","seqhf_", "hundredfolioseq", "elementautonumfoliosequentials");
|
||||||
|
|
||||||
|
//Load Conductor Folio Sequential
|
||||||
|
folioSequentialsFromXml(root, &m_cnd_unitfolio_max, "conductorunitfolioseq","sequf_","unitfolioseq", "conductorautonumfoliosequentials");
|
||||||
|
folioSequentialsFromXml(root, &m_cnd_tenfolio_max, "conductortenfolioseq","seqtf_","tenfolioseq", "conductorautonumfoliosequentials");
|
||||||
|
folioSequentialsFromXml(root, &m_cnd_hundredfolio_max, "conductorhundredfolioseq","seqhf_","hundredfolioseq", "conductorautonumfoliosequentials");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if child haven't got a child, loading is finish (diagram is empty)
|
// if child haven't got a child, loading is finish (diagram is empty)
|
||||||
@@ -879,16 +907,16 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Diagram::elementFolioSequentialsFromXml
|
* @brief Diagram::folioSequentialsFromXml
|
||||||
* Load element folio sequential from QDomElement
|
* Load folio sequential from QDomElement
|
||||||
* @param root containing all folio sequentials
|
* @param root containing all folio sequentials
|
||||||
* @param hash to be loaded with content
|
* @param hash to be loaded with content
|
||||||
* @param folioSeq type
|
* @param folioSeq type
|
||||||
* @param seq type
|
* @param seq type
|
||||||
* @param type of sequential
|
* @param type of sequential
|
||||||
*/
|
*/
|
||||||
void Diagram::elementFolioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type) {
|
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) {
|
||||||
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, "elementautonumfoliosequentials", folioSeq)) {
|
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
|
||||||
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
|
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
|
||||||
QString title = folioseq.attribute("title");
|
QString title = folioseq.attribute("title");
|
||||||
QStringList list;
|
QStringList list;
|
||||||
@@ -1154,8 +1182,7 @@ void Diagram::updateLabels() {
|
|||||||
* @param type to be treated
|
* @param type to be treated
|
||||||
* @param Numerotation Context to be manipulated
|
* @param Numerotation Context to be manipulated
|
||||||
*/
|
*/
|
||||||
void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
|
void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) {
|
||||||
if (project()->elementAutoNumFormula().contains(seq)) {
|
|
||||||
QStringList max;
|
QStringList max;
|
||||||
for (int i = 0; i < nc->size(); i++) {
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
if (nc->itemAt(i).at(0) == type) {
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
@@ -1164,12 +1191,10 @@ void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString titl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
hash->insert(title,max);
|
hash->insert(title,max);
|
||||||
project()->addElementAutoNum(title,*nc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Diagram::loadElmtFolioSeqHash
|
* @brief Diagram::loadFolioSeqHash
|
||||||
* This class loads all folio sequential variables
|
* This class loads all folio sequential variables
|
||||||
* related to the current autonum
|
* related to the current autonum
|
||||||
* @param Hash to be accessed
|
* @param Hash to be accessed
|
||||||
@@ -1178,8 +1203,7 @@ void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString titl
|
|||||||
* @param type to be treated
|
* @param type to be treated
|
||||||
* @param Numerotation Context to be manipulated
|
* @param Numerotation Context to be manipulated
|
||||||
*/
|
*/
|
||||||
void Diagram::loadElmtFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc) {
|
void Diagram::loadFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) {
|
||||||
if (project()->elementAutoNumFormula().contains(seq)) {
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < nc->size(); i++) {
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
if (nc->itemAt(i).at(0) == type) {
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
@@ -1189,8 +1213,6 @@ void Diagram::loadElmtFolioSeqHash(QHash<QString, QStringList> *hash, QString ti
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
project()->addElementAutoNum(title,*nc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1199,35 +1221,114 @@ void Diagram::loadElmtFolioSeqHash(QHash<QString, QStringList> *hash, QString ti
|
|||||||
* to the current autonum
|
* to the current autonum
|
||||||
*/
|
*/
|
||||||
void Diagram::loadElmtFolioSeq() {
|
void Diagram::loadElmtFolioSeq() {
|
||||||
//Element
|
|
||||||
QString title = project()->elementCurrentAutoNum();
|
QString title = project()->elementCurrentAutoNum();
|
||||||
NumerotationContext nc = project()->elementAutoNum(title);
|
NumerotationContext nc = project()->elementAutoNum(title);
|
||||||
|
|
||||||
//Unit Folio
|
//Unit Folio
|
||||||
if (m_elmt_unitfolio_max.isEmpty() || !m_elmt_unitfolio_max.contains(title)) {
|
if (m_elmt_unitfolio_max.isEmpty() || !m_elmt_unitfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
insertFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%sequf_")) {
|
||||||
|
insertFolioSeqHash(&m_elmt_unitfolio_max,title,"unitfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_elmt_unitfolio_max.contains(title)) {
|
else if (m_elmt_unitfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
loadElmtFolioSeqHash(&m_elmt_unitfolio_max,title,"%sequf_","unitfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%sequf_")) {
|
||||||
|
loadFolioSeqHash(&m_elmt_unitfolio_max,title,"unitfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Ten Folio
|
//Ten Folio
|
||||||
if (m_elmt_tenfolio_max.isEmpty() || !m_elmt_tenfolio_max.contains(title)) {
|
if (m_elmt_tenfolio_max.isEmpty() || !m_elmt_tenfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
insertFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%seqtf_")) {
|
||||||
|
insertFolioSeqHash(&m_elmt_tenfolio_max,title,"tenfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_elmt_tenfolio_max.contains(title)) {
|
else if (m_elmt_tenfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
loadElmtFolioSeqHash(&m_elmt_tenfolio_max,title,"%seqtf_","tenfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%seqtf_")) {
|
||||||
|
loadFolioSeqHash(&m_elmt_tenfolio_max,title,"tenfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Hundred Folio
|
//Hundred Folio
|
||||||
if (m_elmt_hundredfolio_max.isEmpty() || !m_elmt_hundredfolio_max.contains(title)) {
|
if (m_elmt_hundredfolio_max.isEmpty() || !m_elmt_hundredfolio_max.contains(title)) {
|
||||||
//Insert Initial Value
|
//Insert Initial Value
|
||||||
insertFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%seqhf_")) {
|
||||||
|
insertFolioSeqHash(&m_elmt_hundredfolio_max,title,"hundredfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (m_elmt_hundredfolio_max.contains(title)) {
|
else if (m_elmt_hundredfolio_max.contains(title)) {
|
||||||
//Load Folio Current Value
|
//Load Folio Current Value
|
||||||
loadElmtFolioSeqHash(&m_elmt_hundredfolio_max,title,"%seqhf_","hundredfolio",&nc);
|
if (project()->elementAutoNumCurrentFormula().contains("%seqhf_")) {
|
||||||
|
loadFolioSeqHash(&m_elmt_hundredfolio_max,title,"hundredfolio",&nc);
|
||||||
|
project()->addElementAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Diagram::loadCndFolioSeq
|
||||||
|
* This class loads all conductor folio sequential variables related
|
||||||
|
* to the current autonum
|
||||||
|
*/
|
||||||
|
void Diagram::loadCndFolioSeq() {
|
||||||
|
//Conductor
|
||||||
|
QString title = project()->conductorCurrentAutoNum();
|
||||||
|
NumerotationContext nc = project()->conductorAutoNum(title);
|
||||||
|
|
||||||
|
//Unit Folio
|
||||||
|
if (m_cnd_unitfolio_max.isEmpty() || !m_cnd_unitfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%sequf_")) {
|
||||||
|
insertFolioSeqHash(&m_cnd_unitfolio_max,title,"unitfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_cnd_unitfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%sequf_")) {
|
||||||
|
loadFolioSeqHash(&m_cnd_unitfolio_max,title,"unitfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ten Folio
|
||||||
|
if (m_cnd_tenfolio_max.isEmpty() || !m_cnd_tenfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%seqtf_")) {
|
||||||
|
insertFolioSeqHash(&m_cnd_tenfolio_max,title,"tenfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_cnd_tenfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%seqtf_")) {
|
||||||
|
loadFolioSeqHash(&m_cnd_tenfolio_max,title,"tenfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Hundred Folio
|
||||||
|
if (m_cnd_hundredfolio_max.isEmpty() || !m_cnd_hundredfolio_max.contains(title)) {
|
||||||
|
//Insert Initial Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%seqhf_")) {
|
||||||
|
insertFolioSeqHash(&m_cnd_hundredfolio_max,title,"hundredfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (m_cnd_hundredfolio_max.contains(title)) {
|
||||||
|
//Load Folio Current Value
|
||||||
|
if (project()->conductorAutoNumCurrentFormula().contains("%seqhf_")) {
|
||||||
|
loadFolioSeqHash(&m_cnd_hundredfolio_max,title,"hundredfolio",&nc);
|
||||||
|
project()->addConductorAutoNum(title,nc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ class Diagram : public QGraphicsScene
|
|||||||
QHash <QString, QStringList> m_elmt_unitfolio_max;
|
QHash <QString, QStringList> m_elmt_unitfolio_max;
|
||||||
QHash <QString, QStringList> m_elmt_tenfolio_max;
|
QHash <QString, QStringList> m_elmt_tenfolio_max;
|
||||||
QHash <QString, QStringList> m_elmt_hundredfolio_max;
|
QHash <QString, QStringList> m_elmt_hundredfolio_max;
|
||||||
|
/// Hash containing max values for folio sequential autonums in this diagram
|
||||||
|
QHash <QString, QStringList> m_cnd_unitfolio_max;
|
||||||
|
QHash <QString, QStringList> m_cnd_tenfolio_max;
|
||||||
|
QHash <QString, QStringList> m_cnd_hundredfolio_max;
|
||||||
bool item_paste;
|
bool item_paste;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -158,8 +162,8 @@ class Diagram : public QGraphicsScene
|
|||||||
void write(const QDomElement &);
|
void write(const QDomElement &);
|
||||||
bool wasWritten() const;
|
bool wasWritten() const;
|
||||||
QDomElement writeXml(QDomDocument &) const;
|
QDomElement writeXml(QDomDocument &) const;
|
||||||
void elementFolioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString, QString, QDomDocument *);
|
void folioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString, QString, QDomDocument *);
|
||||||
void elementFolioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString);
|
void folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString, QString);
|
||||||
|
|
||||||
// methods related to graphics items addition/removal on the diagram
|
// methods related to graphics items addition/removal on the diagram
|
||||||
void initElementsLinks();
|
void initElementsLinks();
|
||||||
@@ -216,9 +220,10 @@ class Diagram : public QGraphicsScene
|
|||||||
void unfreezeNew();
|
void unfreezeNew();
|
||||||
bool freezeNewElements();
|
bool freezeNewElements();
|
||||||
|
|
||||||
//methods related to insertion and loading of element folio sequential
|
//methods related to insertion and loading of folio sequential
|
||||||
void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
|
void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc);
|
||||||
void loadElmtFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, QString type, NumerotationContext *nc);
|
void loadFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void adjustSceneRect ();
|
void adjustSceneRect ();
|
||||||
@@ -229,6 +234,7 @@ class Diagram : public QGraphicsScene
|
|||||||
void setTitleBlockTemplate(const QString &);
|
void setTitleBlockTemplate(const QString &);
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
void loadElmtFolioSeq();
|
void loadElmtFolioSeq();
|
||||||
|
void loadCndFolioSeq();
|
||||||
|
|
||||||
// methods related to graphics items selection
|
// methods related to graphics items selection
|
||||||
void selectAll();
|
void selectAll();
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ void DiagramEventAddElement::addElement()
|
|||||||
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
||||||
ConductorAutoNumerotation can (conductor, m_diagram, undo_object);
|
ConductorAutoNumerotation can (conductor, m_diagram, undo_object);
|
||||||
can.numerate();
|
can.numerate();
|
||||||
|
conductor->setSeq = true;
|
||||||
};
|
};
|
||||||
m_diagram -> undoStack().push(undo_object);
|
m_diagram -> undoStack().push(undo_object);
|
||||||
element->setSequential();
|
element->setSequential();
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ DiagramView::DiagramView(Diagram *diagram, QWidget *parent) :
|
|||||||
adjustSceneRect();
|
adjustSceneRect();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
scene->loadElmtFolioSeq();
|
scene->loadElmtFolioSeq();
|
||||||
|
scene->loadCndFolioSeq();
|
||||||
|
|
||||||
context_menu = new QMenu(this);
|
context_menu = new QMenu(this);
|
||||||
paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this);
|
paste_here = new QAction(QET::Icons::EditPaste, tr("Coller ici", "context menu action"), this);
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ void ElementsMover::endMovement()
|
|||||||
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
|
||||||
ConductorAutoNumerotation can (conductor, diagram_, undo_object);
|
ConductorAutoNumerotation can (conductor, diagram_, undo_object);
|
||||||
can.numerate();
|
can.numerate();
|
||||||
|
conductor->setSeq = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ IdFolioNum::IdFolioNum (Diagram *d):
|
|||||||
*/
|
*/
|
||||||
QString IdFolioNum::toRepresentedString(const QString str) const {
|
QString IdFolioNum::toRepresentedString(const QString str) const {
|
||||||
Q_UNUSED(str);
|
Q_UNUSED(str);
|
||||||
return (QString::number(diagram_ -> folioIndex() + 1));
|
return ("%id");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "selectautonumw.h"
|
#include "selectautonumw.h"
|
||||||
#include "numerotationcontext.h"
|
#include "numerotationcontext.h"
|
||||||
#include "folioautonumbering.h"
|
#include "folioautonumbering.h"
|
||||||
#include "elementautonumberingw.h"
|
#include "formulaautonumberingw.h"
|
||||||
#include "autonumberingmanagementw.h"
|
#include "autonumberingmanagementw.h"
|
||||||
#include "ui_autonumberingmanagementw.h"
|
#include "ui_autonumberingmanagementw.h"
|
||||||
|
|
||||||
@@ -483,15 +483,21 @@ void ProjectAutoNumConfigPage::saveContext_conductor() {
|
|||||||
// With the the name "No name"
|
// With the the name "No name"
|
||||||
if (m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation")) {
|
if (m_context_cb_conductor-> currentText() == tr("Nom de la nouvelle numérotation")) {
|
||||||
project_->addConductorAutoNum (tr("Sans nom"), m_saw_conductor -> toNumContext());
|
project_->addConductorAutoNum (tr("Sans nom"), m_saw_conductor -> toNumContext());
|
||||||
|
project()->addConductorAutoNumFormula (tr("Sans nom"), m_saw_conductor->formula()); //add hash <title, formula>
|
||||||
|
project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(),tr("Sans nom")); //add last added conductor formula to current formula
|
||||||
m_context_cb_conductor-> addItem(tr("Sans nom"));
|
m_context_cb_conductor-> addItem(tr("Sans nom"));
|
||||||
}
|
}
|
||||||
// If the text isn't yet to the autonum of the project, add this new item to the combo box.
|
// If the text isn't yet to the autonum of the project, add this new item to the combo box.
|
||||||
else if ( !project_ -> conductorAutoNum().keys().contains( m_context_cb_conductor->currentText())) {
|
else if ( !project_ -> conductorAutoNum().keys().contains( m_context_cb_conductor->currentText())) {
|
||||||
project()->addConductorAutoNum(m_context_cb_conductor->currentText(), m_saw_conductor->toNumContext());
|
project()->addConductorAutoNum(m_context_cb_conductor->currentText(), m_saw_conductor->toNumContext());
|
||||||
|
project()->addConductorAutoNumFormula (m_context_cb_conductor->currentText(), m_saw_conductor->formula()); //add hash <title, formula>
|
||||||
|
project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(),m_context_cb_conductor->currentText()); //add last added conductor formula to current formula
|
||||||
m_context_cb_conductor-> addItem(m_context_cb_conductor->currentText());
|
m_context_cb_conductor-> addItem(m_context_cb_conductor->currentText());
|
||||||
}
|
}
|
||||||
// Else, the text already exist in the autonum of the project, just update the context
|
// Else, the text already exist in the autonum of the project, just update the context
|
||||||
else {
|
else {
|
||||||
|
project()->addConductorAutoNumFormula (m_context_cb_conductor->currentText(), m_saw_conductor->formula()); //add hash <title, formula>
|
||||||
|
project()->setConductorAutoNumCurrentFormula (m_saw_conductor->formula(), m_context_cb_conductor->currentText()); //add last added conductor formula to current formula
|
||||||
project_->addConductorAutoNum (m_context_cb_conductor-> currentText(), m_saw_conductor -> toNumContext());
|
project_->addConductorAutoNum (m_context_cb_conductor-> currentText(), m_saw_conductor -> toNumContext());
|
||||||
}
|
}
|
||||||
project()->conductorAutoNumAdded();
|
project()->conductorAutoNumAdded();
|
||||||
@@ -530,22 +536,22 @@ void ProjectAutoNumConfigPage::saveContext_element() {
|
|||||||
// With the the name "No name"
|
// With the the name "No name"
|
||||||
if (m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
if (m_context_cb_element -> currentText() == tr("Nom de la nouvelle numérotation")) {
|
||||||
project_->addElementAutoNum (tr("Sans nom"), m_saw_element -> toNumContext());
|
project_->addElementAutoNum (tr("Sans nom"), m_saw_element -> toNumContext());
|
||||||
project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->elementFormula()); //add hash <title, formula>
|
project()->addElementAutoNumFormula (tr("Sans nom"), m_saw_element->formula()); //add hash <title, formula>
|
||||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(),tr("Sans nom")); //add last added element formula to current formula
|
project()->setElementAutoNumCurrentFormula (m_saw_element->formula(),tr("Sans nom")); //add last added element formula to current formula
|
||||||
m_context_cb_element -> addItem(tr("Sans nom"));
|
m_context_cb_element -> addItem(tr("Sans nom"));
|
||||||
}
|
}
|
||||||
// If the text isn't yet to the autonum of the project, add this new item to the combo box.
|
// If the text isn't yet to the autonum of the project, add this new item to the combo box.
|
||||||
else if ( !project_ -> elementAutoNum().keys().contains( m_context_cb_element->currentText())) {
|
else if ( !project_ -> elementAutoNum().keys().contains( m_context_cb_element->currentText())) {
|
||||||
project()->addElementAutoNum(m_context_cb_element->currentText(), m_saw_element->toNumContext()); //add hash <title, numcontext>
|
project()->addElementAutoNum(m_context_cb_element->currentText(), m_saw_element->toNumContext()); //add hash <title, numcontext>
|
||||||
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
|
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->formula()); //add hash <title, formula>
|
||||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(),m_context_cb_element->currentText()); //add last added element formula to current formula
|
project()->setElementAutoNumCurrentFormula (m_saw_element->formula(),m_context_cb_element->currentText()); //add last added element formula to current formula
|
||||||
m_context_cb_element -> addItem(m_context_cb_element->currentText());
|
m_context_cb_element -> addItem(m_context_cb_element->currentText());
|
||||||
}
|
}
|
||||||
// Else, the text already exist in the autonum of the project, just update the context
|
// Else, the text already exist in the autonum of the project, just update the context
|
||||||
else {
|
else {
|
||||||
project_->addElementAutoNum (m_context_cb_element -> currentText(), m_saw_element -> toNumContext()); //add hash <title, numcontext>
|
project_->addElementAutoNum (m_context_cb_element -> currentText(), m_saw_element -> toNumContext()); //add hash <title, numcontext>
|
||||||
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->elementFormula()); //add hash <title, formula>
|
project()->addElementAutoNumFormula (m_context_cb_element->currentText(), m_saw_element->formula()); //add hash <title, formula>
|
||||||
project()->setElementAutoNumCurrentFormula (m_saw_element->elementFormula(), m_context_cb_element->currentText()); //add last added element formula to current formula
|
project()->setElementAutoNumCurrentFormula (m_saw_element->formula(), m_context_cb_element->currentText()); //add last added element formula to current formula
|
||||||
}
|
}
|
||||||
project()->elementAutoNumAdded();
|
project()->elementAutoNumAdded();
|
||||||
}
|
}
|
||||||
@@ -705,11 +711,12 @@ void ProjectAutoNumConfigPage::changeToTab(int i){
|
|||||||
void ProjectAutoNumConfigPage::tabChanged(int i){
|
void ProjectAutoNumConfigPage::tabChanged(int i){
|
||||||
if (i>=1){
|
if (i>=1){
|
||||||
if (tab_widget->currentIndex() == 4){
|
if (tab_widget->currentIndex() == 4){
|
||||||
tab_widget->resize(480,tab_widget->height());
|
tab_widget->resize(520,tab_widget->height());
|
||||||
}
|
}
|
||||||
else {
|
else if (tab_widget->currentIndex() == 1 || tab_widget->currentIndex() == 2 ){
|
||||||
tab_widget->resize(475,tab_widget->height());
|
tab_widget->resize(495,tab_widget->height());
|
||||||
}
|
}
|
||||||
|
else tab_widget->resize(475,tab_widget->height());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tab_widget->resize(850,tab_widget->height());
|
tab_widget->resize(850,tab_widget->height());
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class SelectAutonumW;
|
|||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class FolioAutonumberingW;
|
class FolioAutonumberingW;
|
||||||
class ElementAutonumberingW;
|
class FormulaAutonumberingW;
|
||||||
class AutoNumberingManagementW;
|
class AutoNumberingManagementW;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
|
|||||||
@@ -898,6 +898,7 @@ void ProjectView::loadDiagrams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->currentDiagram()->diagram()->loadElmtFolioSeq();
|
this->currentDiagram()->diagram()->loadElmtFolioSeq();
|
||||||
|
this->currentDiagram()->diagram()->loadCndFolioSeq();
|
||||||
|
|
||||||
// If project have the folios list, move it at the beginning of the project
|
// If project have the folios list, move it at the beginning of the project
|
||||||
if (m_project -> getFolioSheetsQuantity()) {
|
if (m_project -> getFolioSheetsQuantity()) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
#include "conductorpropertiesdialog.h"
|
#include "conductorpropertiesdialog.h"
|
||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
|
#include "numerotationcontextcommands.h"
|
||||||
|
|
||||||
#define PR(x) qDebug() << #x " = " << x;
|
#define PR(x) qDebug() << #x " = " << x;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ Conductor::Conductor(Terminal *p1, Terminal* p2) :
|
|||||||
QGraphicsPathItem(0),
|
QGraphicsPathItem(0),
|
||||||
terminal1(p1),
|
terminal1(p1),
|
||||||
terminal2(p2),
|
terminal2(p2),
|
||||||
|
setSeq(true),
|
||||||
bMouseOver(false),
|
bMouseOver(false),
|
||||||
m_handler(10),
|
m_handler(10),
|
||||||
text_item(0),
|
text_item(0),
|
||||||
@@ -509,7 +511,7 @@ Diagram *Conductor::diagram() const {
|
|||||||
return(qobject_cast<Diagram *>(scene()));
|
return(qobject_cast<Diagram *>(scene()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**4
|
||||||
@return le champ de texte associe a ce conducteur
|
@return le champ de texte associe a ce conducteur
|
||||||
*/
|
*/
|
||||||
ConductorTextItem *Conductor::textItem() const {
|
ConductorTextItem *Conductor::textItem() const {
|
||||||
@@ -815,11 +817,36 @@ bool Conductor::fromXml(QDomElement &e) {
|
|||||||
text_item -> fromXml(e);
|
text_item -> fromXml(e);
|
||||||
ConductorProperties pr;
|
ConductorProperties pr;
|
||||||
pr.fromXml(e);
|
pr.fromXml(e);
|
||||||
|
|
||||||
|
//Load Sequential Values
|
||||||
|
loadSequential(&e,"sequ_",&seq_unit);
|
||||||
|
loadSequential(&e,"sequf_",&seq_unitfolio);
|
||||||
|
loadSequential(&e,"seqt_",&seq_ten);
|
||||||
|
loadSequential(&e,"seqtf_",&seq_tenfolio);
|
||||||
|
loadSequential(&e,"seqh_",&seq_hundred);
|
||||||
|
loadSequential(&e,"seqhf_",&seq_hundredfolio);
|
||||||
|
|
||||||
setProperties(pr);
|
setProperties(pr);
|
||||||
|
|
||||||
return return_;
|
return return_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Load Sequentials to display on conductor label
|
||||||
|
@param QDomElement to set Attributes
|
||||||
|
@param Qstring seq to be retrieved
|
||||||
|
@param QStringList list to be inserted values
|
||||||
|
*/
|
||||||
|
void Conductor::loadSequential(QDomElement* e, QString seq, QStringList* list) {
|
||||||
|
//Load Sequential Values
|
||||||
|
int i = 0;
|
||||||
|
while (!e->attribute(seq + QString::number(i+1)).isEmpty()) {
|
||||||
|
list->append(e->attribute(seq + QString::number(i+1)));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
setSeq = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Exporte les caracteristiques du conducteur sous forme d'une element XML.
|
Exporte les caracteristiques du conducteur sous forme d'une element XML.
|
||||||
@param d Le document XML a utiliser pour creer l'element XML
|
@param d Le document XML a utiliser pour creer l'element XML
|
||||||
@@ -848,6 +875,37 @@ QDomElement Conductor::toXml(QDomDocument &d, QHash<Terminal *, int> &table_adr_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save Conductor sequential values to Xml
|
||||||
|
// Save Unit Sequential Values
|
||||||
|
for (int i = 0; i < seq_unit.size(); i++) {
|
||||||
|
e.setAttribute("sequ_" + QString::number(i+1),seq_unit.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save UnitFolio Sequential Values
|
||||||
|
for (int i = 0; i < seq_unitfolio.size(); i++) {
|
||||||
|
e.setAttribute("sequf_" + QString::number(i+1),seq_unitfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Ten Sequential Values
|
||||||
|
for (int i = 0; i < seq_ten.size(); i++) {
|
||||||
|
e.setAttribute("seqt_" + QString::number(i+1),seq_ten.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save TenFolio Sequential Values
|
||||||
|
for (int i = 0; i < seq_tenfolio.size(); i++) {
|
||||||
|
e.setAttribute("seqtf_" + QString::number(i+1),seq_tenfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Hundred Sequential Values
|
||||||
|
for (int i = 0; i < seq_hundred.size(); i++) {
|
||||||
|
e.setAttribute("seqh_" + QString::number(i+1),seq_hundred.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save Hundred Sequential Values
|
||||||
|
for (int i = 0; i < seq_hundredfolio.size(); i++) {
|
||||||
|
e.setAttribute("seqhf_" + QString::number(i+1),seq_hundredfolio.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
// Export the properties and text
|
// Export the properties and text
|
||||||
properties_. toXml(e);
|
properties_. toXml(e);
|
||||||
text_item -> toXml(e);
|
text_item -> toXml(e);
|
||||||
@@ -1205,6 +1263,7 @@ QString Conductor::assignVariables(QString label) {
|
|||||||
//The check below was introduced to avoid crash caused by the addition of terminal elements
|
//The check below was introduced to avoid crash caused by the addition of terminal elements
|
||||||
//Needs further debbugging.
|
//Needs further debbugging.
|
||||||
if (diagram() == NULL) return label;
|
if (diagram() == NULL) return label;
|
||||||
|
|
||||||
//Titleblock Variables
|
//Titleblock Variables
|
||||||
for (int i = 0; i < diagram()->border_and_titleblock.additionalFields().count(); i++)
|
for (int i = 0; i < diagram()->border_and_titleblock.additionalFields().count(); i++)
|
||||||
{
|
{
|
||||||
@@ -1234,9 +1293,138 @@ QString Conductor::assignVariables(QString label) {
|
|||||||
label.replace("%F", diagram() -> border_and_titleblock.folio());
|
label.replace("%F", diagram() -> border_and_titleblock.folio());
|
||||||
label.replace("%id", QString::number(diagram()->folioIndex()+1));
|
label.replace("%id", QString::number(diagram()->folioIndex()+1));
|
||||||
label.replace("%total", QString::number(diagram()->border_and_titleblock.folioTotal()));
|
label.replace("%total", QString::number(diagram()->border_and_titleblock.folioTotal()));
|
||||||
|
label = assignSeq(label, this);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::setSequential
|
||||||
|
* Set sequential values to conductor
|
||||||
|
*/
|
||||||
|
void Conductor::setSequential() {
|
||||||
|
if (diagram()==NULL) return;
|
||||||
|
QString conductor_currentAutoNum = diagram()->project()->conductorCurrentAutoNum();
|
||||||
|
QString formula = diagram()->project()->conductorAutoNumCurrentFormula();
|
||||||
|
QString label = this->text();
|
||||||
|
NumerotationContext nc = diagram()->project()->conductorAutoNum(conductor_currentAutoNum);
|
||||||
|
NumerotationContextCommands ncc (nc);
|
||||||
|
if (!nc.isEmpty()) {
|
||||||
|
if (label.contains("%sequ_"))
|
||||||
|
setSequentialToList(&seq_unit,&nc,"unit");
|
||||||
|
if (label.contains("%sequf_")) {
|
||||||
|
setSequentialToList(&seq_unitfolio,&nc,"unitfolio");
|
||||||
|
setFolioSequentialToHash(&seq_unitfolio,&diagram()->m_cnd_unitfolio_max,conductor_currentAutoNum);
|
||||||
|
}
|
||||||
|
if (label.contains("%seqt_"))
|
||||||
|
setSequentialToList(&seq_ten,&nc,"ten");
|
||||||
|
if (label.contains("%seqtf_")) {
|
||||||
|
setSequentialToList(&seq_tenfolio,&nc,"tenfolio");
|
||||||
|
setFolioSequentialToHash(&seq_tenfolio,&diagram()->m_cnd_tenfolio_max,conductor_currentAutoNum);
|
||||||
|
}
|
||||||
|
if (label.contains("%seqh_"))
|
||||||
|
setSequentialToList(&seq_hundred,&nc,"hundred");
|
||||||
|
if (label.contains("%seqhf_")) {
|
||||||
|
setSequentialToList(&seq_hundredfolio,&nc,"hundredfolio");
|
||||||
|
setFolioSequentialToHash(&seq_hundredfolio,&diagram()->m_cnd_hundredfolio_max,conductor_currentAutoNum);
|
||||||
|
}
|
||||||
|
this->diagram()->project()->addConductorAutoNum(conductor_currentAutoNum,ncc.next());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::setSequentialToList
|
||||||
|
* This class appends all sequential to selected list
|
||||||
|
* @param list to have values inserted
|
||||||
|
* @param nc to retrieve values from
|
||||||
|
* @param sequential type
|
||||||
|
*/
|
||||||
|
void Conductor::setSequentialToList(QStringList* list, NumerotationContext* nc, QString type) {
|
||||||
|
for (int i = 0; i < nc->size(); i++) {
|
||||||
|
if (nc->itemAt(i).at(0) == type) {
|
||||||
|
QString number;
|
||||||
|
if (type == "ten" || type == "tenfolio")
|
||||||
|
number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 2, 10, QChar('0'));
|
||||||
|
else if (type == "hundred" || type == "hundredfolio")
|
||||||
|
number = QString("%1").arg(nc->itemAt(i).at(1).toInt(), 3, 10, QChar('0'));
|
||||||
|
else number = QString::number(nc->itemAt(i).at(1).toInt());
|
||||||
|
list->append(number);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::setFolioSequentialToHash
|
||||||
|
* This class inserts all conductors from list to hash
|
||||||
|
* @param list to retrieve values from
|
||||||
|
* @param hash to have values inserted
|
||||||
|
* @param current element autonum to insert on hash
|
||||||
|
*/
|
||||||
|
void Conductor::setFolioSequentialToHash(QStringList* list, QHash<QString, QStringList> *hash, QString conductor_currentAutoNum) {
|
||||||
|
if (hash->isEmpty() || (!(hash->contains(conductor_currentAutoNum)))) {
|
||||||
|
QStringList max;
|
||||||
|
for (int i = 0; i < list->size(); i++) {
|
||||||
|
max.append(list->at(i));
|
||||||
|
}
|
||||||
|
hash->insert(conductor_currentAutoNum,max);
|
||||||
|
}
|
||||||
|
else if (hash->contains(conductor_currentAutoNum)) {
|
||||||
|
//Load the String List and update it
|
||||||
|
QStringList max = hash->value(conductor_currentAutoNum);
|
||||||
|
for (int i = 0; i < list->size(); i++) {
|
||||||
|
if ((list->at(i).toInt()) > max.at(i).toInt()) {
|
||||||
|
max.replace(i,list->at(i));
|
||||||
|
hash->remove(conductor_currentAutoNum);
|
||||||
|
hash->insert(conductor_currentAutoNum,max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::assignSeq
|
||||||
|
* Replace sequential values to conductor label
|
||||||
|
* @param label to be replaced
|
||||||
|
* @return replaced label
|
||||||
|
*/
|
||||||
|
QString Conductor::assignSeq(QString label, Conductor* cnd) {
|
||||||
|
for (int i = 1; i <= qMax(qMax(qMax(cnd->seq_unitfolio.size(), cnd->seq_tenfolio.size()),qMax(cnd->seq_hundredfolio.size(),cnd->seq_unit.size())),qMax(cnd->seq_hundred.size(),cnd->seq_ten.size())); i++) {
|
||||||
|
if (label.contains("%sequ_" + QString::number(i)) && !cnd->seq_unit.isEmpty()) {
|
||||||
|
label.replace("%sequ_" + QString::number(i),cnd->seq_unit.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqt_" + QString::number(i)) && !cnd->seq_ten.isEmpty()) {
|
||||||
|
label.replace("%seqt_" + QString::number(i),cnd->seq_ten.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqh_" + QString::number(i)) && !cnd->seq_hundred.isEmpty()) {
|
||||||
|
label.replace("%seqh_" + QString::number(i),cnd->seq_hundred.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%sequf_" + QString::number(i)) && !cnd->seq_unitfolio.isEmpty()) {
|
||||||
|
label.replace("%sequf_" + QString::number(i),cnd->seq_unitfolio.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqtf_" + QString::number(i)) && !cnd->seq_tenfolio.isEmpty()) {
|
||||||
|
label.replace("%seqtf_" + QString::number(i),cnd->seq_tenfolio.at(i-1));
|
||||||
|
}
|
||||||
|
if (label.contains("%seqhf_" + QString::number(i)) && !cnd->seq_hundredfolio.isEmpty()) {
|
||||||
|
label.replace("%seqhf_" + QString::number(i),cnd->seq_hundredfolio.at(i-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Conductor::setOthersSequential
|
||||||
|
* Copy sequentials from conductor in argument to this conductor
|
||||||
|
* @param conductor to copy sequentials from
|
||||||
|
*/
|
||||||
|
void Conductor::setOthersSequential(Conductor *other) {
|
||||||
|
QString conductor_currentAutoNum = other->diagram()->project()->conductorCurrentAutoNum();
|
||||||
|
NumerotationContext nc = other->diagram()->project()->conductorAutoNum(conductor_currentAutoNum);
|
||||||
|
seq_unit = other->seq_unit;
|
||||||
|
seq_unitfolio = other->seq_unitfolio;
|
||||||
|
seq_ten = other->seq_ten;
|
||||||
|
seq_tenfolio = other->seq_tenfolio;
|
||||||
|
seq_hundred = other->seq_hundred;
|
||||||
|
seq_hundredfolio = other->seq_hundredfolio;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Conductor::setText
|
* @brief Conductor::setText
|
||||||
@@ -1244,6 +1432,11 @@ QString Conductor::assignVariables(QString label) {
|
|||||||
* @param t
|
* @param t
|
||||||
*/
|
*/
|
||||||
void Conductor::setText(const QString &t) {
|
void Conductor::setText(const QString &t) {
|
||||||
|
text_item->setPlainText(t);
|
||||||
|
if (setSeq) {
|
||||||
|
setSequential();
|
||||||
|
setSeq = false;
|
||||||
|
}
|
||||||
QString label = assignVariables(t);
|
QString label = assignVariables(t);
|
||||||
text_item -> setPlainText(label);
|
text_item -> setPlainText(label);
|
||||||
}
|
}
|
||||||
@@ -1271,7 +1464,6 @@ void Conductor::setProperties(const ConductorProperties &properties)
|
|||||||
other_properties.m_tension_protocol = properties_.m_tension_protocol;
|
other_properties.m_tension_protocol = properties_.m_tension_protocol;
|
||||||
other_conductor->setProperties(other_properties);
|
other_conductor->setProperties(other_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(properties_.text);
|
setText(properties_.text);
|
||||||
text_item -> setFontSize(properties_.text_size);
|
text_item -> setFontSize(properties_.text_size);
|
||||||
if (properties_.type != ConductorProperties::Multi)
|
if (properties_.type != ConductorProperties::Multi)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class ConductorSegment;
|
|||||||
class ConductorTextItem;
|
class ConductorTextItem;
|
||||||
class Element;
|
class Element;
|
||||||
class QETDiagramEditor;
|
class QETDiagramEditor;
|
||||||
|
class NumerotationContext;
|
||||||
typedef QPair<QPointF, Qt::Corner> ConductorBend;
|
typedef QPair<QPointF, Qt::Corner> ConductorBend;
|
||||||
typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
|
typedef QHash<Qt::Corner, ConductorProfile> ConductorProfilesGroup;
|
||||||
/**
|
/**
|
||||||
@@ -94,6 +95,11 @@ class Conductor : public QObject, public QGraphicsPathItem
|
|||||||
QString text() const;
|
QString text() const;
|
||||||
QString assignVariables(QString) ;
|
QString assignVariables(QString) ;
|
||||||
void setText(const QString &);
|
void setText(const QString &);
|
||||||
|
QString assignSeq (QString, Conductor*);
|
||||||
|
void setSequential ();
|
||||||
|
void setOthersSequential (Conductor *);
|
||||||
|
void setSequentialToList(QStringList*, NumerotationContext*, QString);
|
||||||
|
void setFolioSequentialToHash(QStringList*, QHash<QString, QStringList>*, QString);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool valideXml (QDomElement &);
|
static bool valideXml (QDomElement &);
|
||||||
@@ -117,6 +123,14 @@ class Conductor : public QObject, public QGraphicsPathItem
|
|||||||
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=0);
|
QSet<Conductor *> relatedPotentialConductors(const bool all_diagram = true, QList <Terminal *> *t_list=0);
|
||||||
QETDiagramEditor* diagramEditor() const;
|
QETDiagramEditor* diagramEditor() const;
|
||||||
void editProperty ();
|
void editProperty ();
|
||||||
|
// Lists containing Sequentials
|
||||||
|
QStringList seq_unit;
|
||||||
|
QStringList seq_unitfolio;
|
||||||
|
QStringList seq_ten;
|
||||||
|
QStringList seq_tenfolio;
|
||||||
|
QStringList seq_hundred;
|
||||||
|
QStringList seq_hundredfolio;
|
||||||
|
bool setSeq;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void displayedTextChanged();
|
void displayedTextChanged();
|
||||||
@@ -180,6 +194,7 @@ class Conductor : public QObject, public QGraphicsPathItem
|
|||||||
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 9.0);
|
static QPointF extendTerminal(const QPointF &, Qet::Orientation, qreal = 9.0);
|
||||||
static Qt::Corner movementType(const QPointF &, const QPointF &);
|
static Qt::Corner movementType(const QPointF &, const QPointF &);
|
||||||
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
|
static QPointF movePointIntoPolygon(const QPointF &, const QPainterPath &);
|
||||||
|
void loadSequential(QDomElement* e, QString seq, QStringList* list);
|
||||||
};
|
};
|
||||||
|
|
||||||
Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false);
|
Conductor * longuestConductorInPotential (Conductor *conductor, bool all_diagram = false);
|
||||||
|
|||||||
@@ -309,9 +309,9 @@ void CustomElement::parseLabels() {
|
|||||||
prefix = rxml.readElementText();
|
prefix = rxml.readElementText();
|
||||||
DiagramContext &dc = this->rElementInformations();
|
DiagramContext &dc = this->rElementInformations();
|
||||||
//if there is a formula to assign, assign it
|
//if there is a formula to assign, assign it
|
||||||
if (!(location().project()->elementAutoNumFormula().isEmpty()) && (location().project()->elementAutoNumFormula() != "") &&
|
if (!(location().project()->elementAutoNumCurrentFormula().isEmpty()) && (location().project()->elementAutoNumCurrentFormula() != "") &&
|
||||||
(this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale)) {
|
(this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale)) {
|
||||||
QString formula = location().project()->elementAutoNumFormula();
|
QString formula = location().project()->elementAutoNumCurrentFormula();
|
||||||
this->setPrefix(prefix);
|
this->setPrefix(prefix);
|
||||||
dc.addValue("label", formula);
|
dc.addValue("label", formula);
|
||||||
this->setTaggedText("label",formula);
|
this->setTaggedText("label",formula);
|
||||||
@@ -340,10 +340,10 @@ void CustomElement::parseLabels() {
|
|||||||
//that are already specified in the element label (inside .elmt file). This method is not called if elements
|
//that are already specified in the element label (inside .elmt file). This method is not called if elements
|
||||||
//are being loaded at first time or being pasted
|
//are being loaded at first time or being pasted
|
||||||
else if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) &&
|
else if ((this->taggedText("label")!= NULL) && (location().projectId()!=-1) &&
|
||||||
(!location().project()->elementAutoNumFormula().isEmpty()) &&
|
(!location().project()->elementAutoNumCurrentFormula().isEmpty()) &&
|
||||||
(this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale) &&
|
(this->linkType()!=Element::Slave) && (this->linkType()!=Element::Terminale) &&
|
||||||
!this->diagram()->item_paste) {
|
!this->diagram()->item_paste) {
|
||||||
QString formula = location().project()->elementAutoNumFormula();
|
QString formula = location().project()->elementAutoNumCurrentFormula();
|
||||||
DiagramContext &dc = this->rElementInformations();
|
DiagramContext &dc = this->rElementInformations();
|
||||||
QString prefix = this->taggedText("label")->toPlainText();
|
QString prefix = this->taggedText("label")->toPlainText();
|
||||||
this->setPrefix(prefix);
|
this->setPrefix(prefix);
|
||||||
|
|||||||
@@ -772,7 +772,7 @@ QString Element::assignVariables(QString label, Element *elmt){
|
|||||||
void Element::setSequential() {
|
void Element::setSequential() {
|
||||||
DiagramContext &dc = this->rElementInformations();
|
DiagramContext &dc = this->rElementInformations();
|
||||||
QString element_currentAutoNum = diagram()->project()->elementCurrentAutoNum();
|
QString element_currentAutoNum = diagram()->project()->elementCurrentAutoNum();
|
||||||
QString formula = diagram()->project()->elementAutoNumFormula();
|
QString formula = diagram()->project()->elementAutoNumCurrentFormula();
|
||||||
QString label = dc["label"].toString();
|
QString label = dc["label"].toString();
|
||||||
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
NumerotationContext nc = diagram()->project()->elementAutoNum(element_currentAutoNum);
|
||||||
NumerotationContextCommands ncc (nc);
|
NumerotationContextCommands ncc (nc);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "qetgraphicsitem/conductor.h"
|
#include "qetgraphicsitem/conductor.h"
|
||||||
#include "diagramcommands.h"
|
#include "diagramcommands.h"
|
||||||
#include "conductorautonumerotation.h"
|
#include "conductorautonumerotation.h"
|
||||||
|
#include "conductortextitem.h"
|
||||||
|
|
||||||
QColor Terminal::neutralColor = QColor(Qt::blue);
|
QColor Terminal::neutralColor = QColor(Qt::blue);
|
||||||
QColor Terminal::allowedColor = QColor(Qt::darkGreen);
|
QColor Terminal::allowedColor = QColor(Qt::darkGreen);
|
||||||
@@ -594,25 +595,35 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
|
|||||||
{
|
{
|
||||||
use_properties = true;
|
use_properties = true;
|
||||||
others_properties = (*conductors_list.begin())->properties();
|
others_properties = (*conductors_list.begin())->properties();
|
||||||
foreach (Conductor *conductor, conductors_list)
|
foreach (Conductor *conductor, conductors_list) {
|
||||||
if (conductor->properties() != others_properties)
|
if (conductor->properties() != others_properties)
|
||||||
use_properties = false;
|
use_properties = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QUndoCommand *undo = new AddItemCommand<Conductor *>(new_conductor, diagram());
|
QUndoCommand *undo = new AddItemCommand<Conductor *>(new_conductor, diagram());
|
||||||
|
|
||||||
if (use_properties)
|
if (use_properties) {
|
||||||
|
Conductor *other = conductors_list.toList().first();
|
||||||
|
new_conductor->setSeq = false;
|
||||||
|
new_conductor->setOthersSequential(other);
|
||||||
new_conductor->setProperties(others_properties);
|
new_conductor->setProperties(others_properties);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Autonum it
|
//Autonum it
|
||||||
ConductorAutoNumerotation can (new_conductor, diagram(), undo);
|
ConductorAutoNumerotation can (new_conductor, diagram(), undo);
|
||||||
can.numerate();
|
can.numerate();
|
||||||
|
new_conductor->setSeq = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add undo command to the parent diagram
|
//Add undo command to the parent diagram
|
||||||
diagram() -> undoStack().push(undo);
|
diagram() -> undoStack().push(undo);
|
||||||
|
if (use_properties) {
|
||||||
|
Conductor *other = conductors_list.toList().first();
|
||||||
|
new_conductor->setText("");
|
||||||
|
new_conductor->setText(other->properties().text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -424,6 +424,14 @@ QHash <QString, QString> QETProject::elementAutoNumHash() {
|
|||||||
return m_element_autonum_formula;
|
return m_element_autonum_formula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::conductorAutoNumHash
|
||||||
|
* @return Title and Formula Hash
|
||||||
|
*/
|
||||||
|
QHash <QString, QString> QETProject::conductorAutoNumHash() {
|
||||||
|
return m_conductor_autonum_formula;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::elementAutoNumFormula
|
* @brief QETProject::elementAutoNumFormula
|
||||||
* @param element autonum title
|
* @param element autonum title
|
||||||
@@ -436,13 +444,32 @@ QString QETProject::elementAutoNumFormula (QString key) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::elementAutoNumFormula
|
* @brief QETProject::conductorAutoNumFormula
|
||||||
|
* @param conductor autonum title
|
||||||
|
* @return Formula of element autonum stored in conductor autonum
|
||||||
|
*/
|
||||||
|
QString QETProject::conductorAutoNumFormula (QString key) const {
|
||||||
|
if (m_conductor_autonum.contains(key))
|
||||||
|
return m_conductor_autonum_formula[key];
|
||||||
|
else return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::elementAutoNumCurrentFormula
|
||||||
* @return current formula being used by project
|
* @return current formula being used by project
|
||||||
*/
|
*/
|
||||||
QString QETProject::elementAutoNumFormula () const {
|
QString QETProject::elementAutoNumCurrentFormula() const {
|
||||||
return m_current_element_formula;
|
return m_current_element_formula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::conductorAutoNumCurrentFormula
|
||||||
|
* @return current formula being used by project
|
||||||
|
*/
|
||||||
|
QString QETProject::conductorAutoNumCurrentFormula() const {
|
||||||
|
return m_current_conductor_formula;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::elementCurrentAutoNum
|
* @brief QETProject::elementCurrentAutoNum
|
||||||
* @return current element autonum title
|
* @return current element autonum title
|
||||||
@@ -451,6 +478,14 @@ QString QETProject::elementCurrentAutoNum () const {
|
|||||||
return m_current_element_autonum;
|
return m_current_element_autonum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::conductorCurrentAutoNum
|
||||||
|
* @return current element autonum title
|
||||||
|
*/
|
||||||
|
QString QETProject::conductorCurrentAutoNum () const {
|
||||||
|
return m_current_conductor_autonum;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::folioAutoNum
|
* @brief QETProject::folioAutoNum
|
||||||
* @return All value of folio autonum stored in project
|
* @return All value of folio autonum stored in project
|
||||||
@@ -470,6 +505,26 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) {
|
|||||||
m_conductor_autonum.insert(key, context);
|
m_conductor_autonum.insert(key, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::addConductorAutoNumFormula
|
||||||
|
* Add the new formula
|
||||||
|
* @param formula
|
||||||
|
*/
|
||||||
|
void QETProject::addConductorAutoNumFormula(QString key, QString formula) {
|
||||||
|
m_conductor_autonum_formula.insert(key, formula);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETProject::setConductorAutoNumCurrentFormula
|
||||||
|
* Add the formula and title to the current formula and current autonum
|
||||||
|
* @param formula
|
||||||
|
* @param title
|
||||||
|
*/
|
||||||
|
void QETProject::setConductorAutoNumCurrentFormula(QString formula, QString title) {
|
||||||
|
m_current_conductor_formula = formula;
|
||||||
|
m_current_conductor_autonum = title;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETProject::addElementAutoNumFormula
|
* @brief QETProject::addElementAutoNumFormula
|
||||||
* Add the new formula
|
* Add the new formula
|
||||||
@@ -1353,11 +1408,14 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
|
|||||||
}
|
}
|
||||||
if (!conds_autonums.isNull())
|
if (!conds_autonums.isNull())
|
||||||
{
|
{
|
||||||
|
m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
|
||||||
|
m_current_conductor_formula = conds_autonums.attribute("current_formula");
|
||||||
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);
|
||||||
|
m_conductor_autonum_formula.insert(elmt.attribute("title"),elmt.attribute("formula"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!folio_autonums.isNull())
|
if (!folio_autonums.isNull())
|
||||||
@@ -1434,14 +1492,19 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
|
|||||||
}
|
}
|
||||||
xml_element.appendChild(xrefs_elmt);
|
xml_element.appendChild(xrefs_elmt);
|
||||||
|
|
||||||
//Export conductors autonums
|
//Export Conductor Autonums
|
||||||
QDomElement conds_autonums = xml_document.createElement("conductors_autonums");
|
QDomElement conductor_autonums = xml_document.createElement("conductors_autonums");
|
||||||
|
conductor_autonums.setAttribute("current_autonum", m_current_conductor_autonum);
|
||||||
|
conductor_autonums.setAttribute("current_formula", m_current_conductor_formula);
|
||||||
foreach (QString key, conductorAutoNum().keys()) {
|
foreach (QString key, conductorAutoNum().keys()) {
|
||||||
QDomElement cond_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
|
QDomElement conductor_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
|
||||||
cond_autonum.setAttribute("title", key);
|
if (key != "" && conductorAutoNumFormula(key) != "") {
|
||||||
conds_autonums.appendChild(cond_autonum);
|
conductor_autonum.setAttribute("title", key);
|
||||||
|
conductor_autonum.setAttribute("formula", conductorAutoNumFormula(key));
|
||||||
|
conductor_autonums.appendChild(conductor_autonum);
|
||||||
}
|
}
|
||||||
xml_element.appendChild(conds_autonums);
|
}
|
||||||
|
xml_element.appendChild(conductor_autonums);
|
||||||
|
|
||||||
//Export Folio Autonums
|
//Export Folio Autonums
|
||||||
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
|
||||||
|
|||||||
@@ -109,8 +109,11 @@ class QETProject : public QObject
|
|||||||
QHash <QString, NumerotationContext> conductorAutoNum() const;
|
QHash <QString, NumerotationContext> conductorAutoNum() const;
|
||||||
QHash <QString, NumerotationContext> elementAutoNum() const;
|
QHash <QString, NumerotationContext> elementAutoNum() const;
|
||||||
QHash <QString, QString> elementAutoNumHash();
|
QHash <QString, QString> elementAutoNumHash();
|
||||||
|
QHash <QString, QString> conductorAutoNumHash();
|
||||||
QHash <QString, NumerotationContext> folioAutoNum() const;
|
QHash <QString, NumerotationContext> folioAutoNum() const;
|
||||||
void addConductorAutoNum (QString key, NumerotationContext context);
|
void addConductorAutoNum (QString key, NumerotationContext context);
|
||||||
|
void addConductorAutoNumFormula (QString key, QString formula);
|
||||||
|
void setConductorAutoNumCurrentFormula (QString formula, QString title);
|
||||||
void addElementAutoNum (QString key, NumerotationContext context);
|
void addElementAutoNum (QString key, NumerotationContext context);
|
||||||
void addElementAutoNumFormula (QString key, QString formula);
|
void addElementAutoNumFormula (QString key, QString formula);
|
||||||
void setElementAutoNumCurrentFormula (QString formula, QString title);
|
void setElementAutoNumCurrentFormula (QString formula, QString title);
|
||||||
@@ -121,8 +124,13 @@ class QETProject : public QObject
|
|||||||
NumerotationContext conductorAutoNum(const QString &key) const;
|
NumerotationContext conductorAutoNum(const QString &key) const;
|
||||||
NumerotationContext folioAutoNum(const QString &key) const;
|
NumerotationContext folioAutoNum(const QString &key) const;
|
||||||
NumerotationContext elementAutoNum(const QString &key);
|
NumerotationContext elementAutoNum(const QString &key);
|
||||||
|
|
||||||
|
QString conductorAutoNumFormula(const QString key) const; //returns Formula
|
||||||
|
QString conductorAutoNumCurrentFormula() const;
|
||||||
|
QString conductorCurrentAutoNum() const;
|
||||||
|
|
||||||
QString elementAutoNumFormula(const QString key) const; //returns Formula
|
QString elementAutoNumFormula(const QString key) const; //returns Formula
|
||||||
QString elementAutoNumFormula() const;
|
QString elementAutoNumCurrentFormula() const;
|
||||||
QString elementCurrentAutoNum() const;
|
QString elementCurrentAutoNum() const;
|
||||||
|
|
||||||
void freezeExistentElementLabel(int,int);
|
void freezeExistentElementLabel(int,int);
|
||||||
@@ -244,12 +252,15 @@ class QETProject : public QObject
|
|||||||
/// undo stack for this project
|
/// undo stack for this project
|
||||||
QUndoStack *undo_stack_;
|
QUndoStack *undo_stack_;
|
||||||
/// Conductor auto numerotation
|
/// Conductor auto numerotation
|
||||||
QHash <QString, NumerotationContext> m_conductor_autonum;
|
QHash <QString, NumerotationContext> m_conductor_autonum;//Title and NumContext hash
|
||||||
|
QHash <QString, QString> m_conductor_autonum_formula;//Title and Formula hash
|
||||||
|
QString m_current_conductor_formula;
|
||||||
|
QString m_current_conductor_autonum;
|
||||||
/// Folio auto numbering
|
/// Folio auto numbering
|
||||||
QHash <QString, NumerotationContext> m_folio_autonum;
|
QHash <QString, NumerotationContext> m_folio_autonum;
|
||||||
/// Element Auto Numbering
|
/// Element Auto Numbering
|
||||||
QHash <QString, QString> m_element_autonum_formula; //Title and Formula hash
|
|
||||||
QHash <QString, NumerotationContext> m_element_autonum; //Title and NumContext hash
|
QHash <QString, NumerotationContext> m_element_autonum; //Title and NumContext hash
|
||||||
|
QHash <QString, QString> m_element_autonum_formula; //Title and Formula hash
|
||||||
QString m_current_element_formula;
|
QString m_current_element_formula;
|
||||||
QString m_current_element_autonum;
|
QString m_current_element_autonum;
|
||||||
/// Folio List Sheets quantity for this project.
|
/// Folio List Sheets quantity for this project.
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ void AutoNumberingDockWidget::setActive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Element
|
//Element
|
||||||
QString element_formula = project_->elementAutoNumFormula();
|
QString element_formula = project_->elementAutoNumCurrentFormula();
|
||||||
QString active_element_autonum = project_->elementCurrentAutoNum();
|
QString active_element_autonum = project_->elementCurrentAutoNum();
|
||||||
int el_index = ui->m_element_cb->findText(active_element_autonum);
|
int el_index = ui->m_element_cb->findText(active_element_autonum);
|
||||||
ui->m_element_cb->setCurrentIndex(el_index);
|
ui->m_element_cb->setCurrentIndex(el_index);
|
||||||
@@ -191,7 +191,14 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
|
|||||||
*/
|
*/
|
||||||
void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) {
|
void AutoNumberingDockWidget::on_m_conductor_cb_activated(int) {
|
||||||
QString current_autonum = ui->m_conductor_cb->currentText();
|
QString current_autonum = ui->m_conductor_cb->currentText();
|
||||||
|
QString current_formula = project_->conductorAutoNumFormula(current_autonum);
|
||||||
|
if (current_autonum != "") {
|
||||||
|
project_->setConductorAutoNumCurrentFormula(current_formula, current_autonum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
project_->setConductorAutoNumCurrentFormula("","");
|
||||||
projectview_->currentDiagram()->diagram()->setConductorsAutonumName(current_autonum);
|
projectview_->currentDiagram()->diagram()->setConductorsAutonumName(current_autonum);
|
||||||
|
projectview_->currentDiagram()->diagram()->loadCndFolioSeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include "numparteditorw.h"
|
#include "numparteditorw.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
#include "elementautonumberingw.h"
|
#include "formulaautonumberingw.h"
|
||||||
#include "ui_elementautonumberingw.h"
|
#include "ui_formulaautonumberingw.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>467</width>
|
<width>524</width>
|
||||||
<height>550</height>
|
<height>550</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -75,8 +75,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>448</width>
|
<width>504</width>
|
||||||
<height>498</height>
|
<height>495</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="m_to_cb">
|
<widget class="QComboBox" name="m_to_cb">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="m_from_cb">
|
<widget class="QComboBox" name="m_from_cb">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="m_new_tabs_sb">
|
<widget class="QSpinBox" name="m_new_tabs_sb">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "elementautonumberingw.h"
|
#include "formulaautonumberingw.h"
|
||||||
#include "ui_elementautonumberingw.h"
|
#include "ui_formulaautonumberingw.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) :
|
FormulaAutonumberingW::FormulaAutonumberingW(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::ElementAutonumberingW)
|
ui(new Ui::FormulaAutonumberingW)
|
||||||
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@@ -36,39 +36,39 @@ ElementAutonumberingW::ElementAutonumberingW(QWidget *parent) :
|
|||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
ElementAutonumberingW::~ElementAutonumberingW()
|
FormulaAutonumberingW::~FormulaAutonumberingW()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementAutonumberingW::setContext
|
* @brief FormulaAutonumberingW::setContext
|
||||||
* @param formula to be inserted into context
|
* @param formula to be inserted into context
|
||||||
*/
|
*/
|
||||||
void ElementAutonumberingW::setContext(QString formula) {
|
void FormulaAutonumberingW::setContext(QString formula) {
|
||||||
ui->m_formula_le->insert(formula);
|
ui->m_formula_le->insert(formula);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementAutonumberingW::clearContext
|
* @brief FormulaAutonumberingW::clearContext
|
||||||
* @param clear formula line edit text
|
* @param clear formula line edit text
|
||||||
*/
|
*/
|
||||||
void ElementAutonumberingW::clearContext() {
|
void FormulaAutonumberingW::clearContext() {
|
||||||
ui->m_formula_le->clear();
|
ui->m_formula_le->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementAutonumberingW::formula
|
* @brief FormulaAutonumberingW::formula
|
||||||
* @return formula to be stored into project
|
* @return formula to be stored into project
|
||||||
*/
|
*/
|
||||||
QString ElementAutonumberingW::formula() {
|
QString FormulaAutonumberingW::formula() {
|
||||||
return ui->m_formula_le->text();
|
return ui->m_formula_le->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementAutonumberingW::on_m_formula_le_textChanged
|
* @brief FormulaAutonumberingW::on_m_formula_le_textChanged
|
||||||
* Update Apply Button
|
* Update Apply Button
|
||||||
*/
|
*/
|
||||||
void ElementAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
|
||||||
emit (textChanged(text));
|
emit (textChanged(text));
|
||||||
}
|
}
|
||||||
@@ -15,15 +15,15 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#ifndef ELEMENTAUTONUMBERINGW_H
|
#ifndef FORMULAAUTONUMBERINGW_H
|
||||||
#define ELEMENTAUTONUMBERINGW_H
|
#define FORMULAAUTONUMBERINGW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class QAbstractButton;
|
class QAbstractButton;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ElementAutonumberingW;
|
class FormulaAutonumberingW;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,18 +32,18 @@ namespace Ui {
|
|||||||
the user to overwrite it with a new formula. Formula is added
|
the user to overwrite it with a new formula. Formula is added
|
||||||
while parsing label in customelement.cpp
|
while parsing label in customelement.cpp
|
||||||
*/
|
*/
|
||||||
class ElementAutonumberingW : public QWidget
|
class FormulaAutonumberingW : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
//METHODS
|
//METHODS
|
||||||
public:
|
public:
|
||||||
explicit ElementAutonumberingW(QWidget *parent = 0);
|
explicit FormulaAutonumberingW(QWidget *parent = 0);
|
||||||
~ElementAutonumberingW();
|
~FormulaAutonumberingW();
|
||||||
QString formula();
|
QString formula();
|
||||||
void setContext(QString);
|
void setContext(QString);
|
||||||
void clearContext();
|
void clearContext();
|
||||||
Ui::ElementAutonumberingW *ui;
|
Ui::FormulaAutonumberingW *ui;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -62,4 +62,4 @@ class ElementAutonumberingW : public QWidget
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEMENTAUTONUMBERINGW_H
|
#endif // FORMULAAUTONUMBERINGW_H
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ElementAutonumberingW</class>
|
<class>FormulaAutonumberingW</class>
|
||||||
<widget class="QWidget" name="ElementAutonumberingW">
|
<widget class="QWidget" name="FormulaAutonumberingW">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>383</width>
|
<width>370</width>
|
||||||
<height>357</height>
|
<height>305</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLineEdit" name="m_formula_le">
|
<widget class="QLineEdit" name="m_formula_le">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -88,8 +88,6 @@
|
|||||||
-%c: Element Column
|
-%c: Element Column
|
||||||
-%F: Folio Name
|
-%F: Folio Name
|
||||||
-%f or %id: Folio ID
|
-%f or %id: Folio ID
|
||||||
-%M: Machine
|
|
||||||
-%LM: Location
|
|
||||||
-%total: Total of folios
|
-%total: Total of folios
|
||||||
You can also assign any other titleblock variable
|
You can also assign any other titleblock variable
|
||||||
that you create. Text and number inputs are
|
that you create. Text and number inputs are
|
||||||
@@ -84,8 +84,8 @@ void NumPartEditorW::setVisibleItems() {
|
|||||||
<< tr("Texte");
|
<< tr("Texte");
|
||||||
}
|
}
|
||||||
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") {
|
else if (parentWidget()->parentWidget()->objectName()=="ConductorTab") {
|
||||||
items << tr("Chiffre 1") << tr("Chiffre 01")
|
items << tr("Chiffre 1") << tr("Chiffre 1 - Folio") << tr("Chiffre 01")
|
||||||
<< tr("Chiffre 001")
|
<< tr("Chiffre 01 - Folio") << tr("Chiffre 001") << tr("Chiffre 001 - Folio")
|
||||||
<< tr("Texte") << tr("N° folio") << tr("Folio");
|
<< tr("Texte") << tr("N° folio") << tr("Folio");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include "numparteditorw.h"
|
#include "numparteditorw.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
#include "elementautonumberingw.h"
|
#include "formulaautonumberingw.h"
|
||||||
#include "ui_elementautonumberingw.h"
|
#include "ui_formulaautonumberingw.h"
|
||||||
#include "qdebug.h"
|
#include "qdebug.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,8 +34,13 @@ SelectAutonumW::SelectAutonumW(QWidget *parent) :
|
|||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
if (this->parentWidget() -> objectName()=="ElementTab"){
|
if (this->parentWidget() -> objectName()=="ElementTab"){
|
||||||
m_eaw = new ElementAutonumberingW();
|
m_feaw = new FormulaAutonumberingW();
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
|
ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
|
||||||
|
}
|
||||||
|
else if (this->parentWidget() -> objectName()=="ConductorTab"){
|
||||||
|
m_fcaw = new FormulaAutonumberingW();
|
||||||
|
m_fcaw->ui->label->setHidden(true);
|
||||||
|
ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
|
||||||
}
|
}
|
||||||
setContext(NumerotationContext());
|
setContext(NumerotationContext());
|
||||||
}
|
}
|
||||||
@@ -45,8 +50,13 @@ SelectAutonumW::SelectAutonumW(const NumerotationContext &context, QWidget *pare
|
|||||||
ui(new Ui::SelectAutonumW)
|
ui(new Ui::SelectAutonumW)
|
||||||
{
|
{
|
||||||
if (this->parentWidget() -> objectName()=="ElementTab"){
|
if (this->parentWidget() -> objectName()=="ElementTab"){
|
||||||
m_eaw = new ElementAutonumberingW();
|
m_feaw = new FormulaAutonumberingW();
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(m_eaw);
|
ui->scrollAreaWidgetContents->layout()->addWidget(m_feaw);
|
||||||
|
}
|
||||||
|
else if (this->parentWidget() -> objectName()=="ConductorTab"){
|
||||||
|
m_fcaw = new FormulaAutonumberingW();
|
||||||
|
m_fcaw->ui->label->setHidden(true);
|
||||||
|
ui->scrollAreaWidgetContents->layout()->addWidget(m_fcaw);
|
||||||
}
|
}
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setContext(context);
|
setContext(context);
|
||||||
@@ -130,11 +140,15 @@ void SelectAutonumW::on_remove_button_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SelectAutonumW::elementFormula
|
* @brief SelectAutonumW::formula
|
||||||
* @return element autonumbering widget formula
|
* @return autonumbering widget formula
|
||||||
*/
|
*/
|
||||||
QString SelectAutonumW::elementFormula() {
|
QString SelectAutonumW::formula() {
|
||||||
return m_eaw->formula();
|
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||||
|
return m_feaw->formula();
|
||||||
|
else if (this->parentWidget() ->objectName()=="ConductorTab")
|
||||||
|
return m_fcaw->formula();
|
||||||
|
else return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,6 +236,8 @@ void SelectAutonumW::applyEnable(bool b) {
|
|||||||
}
|
}
|
||||||
if (this->parentWidget() -> objectName()=="ElementTab")
|
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||||
contextToFormula();
|
contextToFormula();
|
||||||
|
if (this->parentWidget()->objectName()=="ConductorTab")
|
||||||
|
contextToFormula();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,7 +245,12 @@ void SelectAutonumW::applyEnable(bool b) {
|
|||||||
* Apply formula to ElementAutonumbering Widget
|
* Apply formula to ElementAutonumbering Widget
|
||||||
*/
|
*/
|
||||||
void SelectAutonumW::contextToFormula() {
|
void SelectAutonumW::contextToFormula() {
|
||||||
m_eaw->clearContext();
|
FormulaAutonumberingW* m_faw;
|
||||||
|
if (this->parentWidget() -> objectName()=="ElementTab")
|
||||||
|
m_faw = m_feaw;
|
||||||
|
if (this->parentWidget()->objectName()=="ConductorTab")
|
||||||
|
m_faw = m_fcaw;
|
||||||
|
m_faw->clearContext();
|
||||||
int count_unit = 0;
|
int count_unit = 0;
|
||||||
int count_unitf = 0;
|
int count_unitf = 0;
|
||||||
int count_ten = 0;
|
int count_ten = 0;
|
||||||
@@ -239,54 +260,54 @@ void SelectAutonumW::contextToFormula() {
|
|||||||
foreach (NumPartEditorW *npe, num_part_list_) {
|
foreach (NumPartEditorW *npe, num_part_list_) {
|
||||||
if (npe->isValid()) {
|
if (npe->isValid()) {
|
||||||
if (npe->type_ == NumPartEditorW::idfolio) {
|
if (npe->type_ == NumPartEditorW::idfolio) {
|
||||||
m_eaw->setContext("%id");
|
m_faw->setContext("%id");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::folio) {
|
else if (npe->type_ == NumPartEditorW::folio) {
|
||||||
m_eaw->setContext("%F");
|
m_faw->setContext("%F");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::machine) {
|
else if (npe->type_ == NumPartEditorW::machine) {
|
||||||
m_eaw->setContext("%M");
|
m_faw->setContext("%M");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::locmach) {
|
else if (npe->type_ == NumPartEditorW::locmach) {
|
||||||
m_eaw->setContext("%LM");
|
m_faw->setContext("%LM");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if (npe->type_ == NumPartEditorW::elementcolumn) {
|
else if (npe->type_ == NumPartEditorW::elementcolumn) {
|
||||||
m_eaw->setContext("%c");
|
m_faw->setContext("%c");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::elementline) {
|
else if (npe->type_ == NumPartEditorW::elementline) {
|
||||||
m_eaw->setContext("%l");
|
m_faw->setContext("%l");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::elementprefix) {
|
else if (npe->type_ == NumPartEditorW::elementprefix) {
|
||||||
m_eaw->setContext("%prefix");
|
m_faw->setContext("%prefix");
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::string) {
|
else if (npe->type_ == NumPartEditorW::string) {
|
||||||
m_eaw->setContext(npe->toNumContext().itemAt(0).at(1));
|
m_faw->setContext(npe->toNumContext().itemAt(0).at(1));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::unit) {
|
else if (npe->type_ == NumPartEditorW::unit) {
|
||||||
count_unit++;
|
count_unit++;
|
||||||
m_eaw->setContext("%sequ_"+QString::number(count_unit));
|
m_faw->setContext("%sequ_"+QString::number(count_unit));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::unitfolio) {
|
else if (npe->type_ == NumPartEditorW::unitfolio) {
|
||||||
count_unitf++;
|
count_unitf++;
|
||||||
m_eaw->setContext("%sequf_"+QString::number(count_unitf));
|
m_faw->setContext("%sequf_"+QString::number(count_unitf));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::ten) {
|
else if (npe->type_ == NumPartEditorW::ten) {
|
||||||
count_ten++;
|
count_ten++;
|
||||||
m_eaw->setContext("%seqt_"+QString::number(count_ten));
|
m_faw->setContext("%seqt_"+QString::number(count_ten));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::tenfolio) {
|
else if (npe->type_ == NumPartEditorW::tenfolio) {
|
||||||
count_tenf++;
|
count_tenf++;
|
||||||
m_eaw->setContext("%seqtf_"+QString::number(count_tenf));
|
m_faw->setContext("%seqtf_"+QString::number(count_tenf));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::hundred) {
|
else if (npe->type_ == NumPartEditorW::hundred) {
|
||||||
count_hundred++;
|
count_hundred++;
|
||||||
m_eaw->setContext("%seqh_"+QString::number(count_hundred));
|
m_faw->setContext("%seqh_"+QString::number(count_hundred));
|
||||||
}
|
}
|
||||||
else if (npe->type_ == NumPartEditorW::hundredfolio) {
|
else if (npe->type_ == NumPartEditorW::hundredfolio) {
|
||||||
count_hundredf++;
|
count_hundredf++;
|
||||||
m_eaw->setContext("%seqhf_"+QString::number(count_hundredf));
|
m_faw->setContext("%seqhf_"+QString::number(count_hundredf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "numerotationcontext.h"
|
#include "numerotationcontext.h"
|
||||||
#include "elementautonumberingw.h"
|
#include "formulaautonumberingw.h"
|
||||||
|
|
||||||
class NumPartEditorW;
|
class NumPartEditorW;
|
||||||
class QAbstractButton;
|
class QAbstractButton;
|
||||||
|
class FormulaAutonumberingW;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SelectAutonumW;
|
class SelectAutonumW;
|
||||||
@@ -42,7 +43,7 @@ class SelectAutonumW : public QWidget
|
|||||||
void setContext (const NumerotationContext &context);
|
void setContext (const NumerotationContext &context);
|
||||||
NumerotationContext toNumContext() const;
|
NumerotationContext toNumContext() const;
|
||||||
void contextToFormula ();
|
void contextToFormula ();
|
||||||
QString elementFormula();
|
QString formula();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void applyPressed();
|
void applyPressed();
|
||||||
@@ -65,7 +66,8 @@ class SelectAutonumW : public QWidget
|
|||||||
Ui::SelectAutonumW *ui;
|
Ui::SelectAutonumW *ui;
|
||||||
QList <NumPartEditorW *> num_part_list_;
|
QList <NumPartEditorW *> num_part_list_;
|
||||||
NumerotationContext m_context;
|
NumerotationContext m_context;
|
||||||
ElementAutonumberingW *m_eaw;
|
FormulaAutonumberingW *m_feaw;
|
||||||
|
FormulaAutonumberingW *m_fcaw;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SELECTAUTONUMW_H
|
#endif // SELECTAUTONUMW_H
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
<string>Type</string>
|
<string>Type</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
<string>Valeur</string>
|
<string>Valeur</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -250,7 +250,7 @@
|
|||||||
<string>Incrémentation</string>
|
<string>Incrémentation</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user