[qet] [4521] Nomenclature export(all fields exported to csv) and Comment field( displayed on editor) handle position and folio variables

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4521
Author:   dfochi
Date:     2016-05-25 16:49:33 +0200 (Wed, 25 May 2016)
Log Message:
-----------
Nomenclature export(all fields exported to csv) and Comment field(displayed on editor) handle position and folio variables

Modified Paths:
--------------
    trunk/sources/nomenclature.cpp
    trunk/sources/nomenclature.h
    trunk/sources/qetgraphicsitem/crossrefitem.cpp
    trunk/sources/qetgraphicsitem/customelement.cpp
    trunk/sources/qetgraphicsitem/customelement.h
    trunk/sources/qetgraphicsitem/element.cpp
    trunk/sources/qetgraphicsitem/element.h

Modified: trunk/sources/nomenclature.cpp
===================================================================
--- trunk/sources/nomenclature.cpp	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/nomenclature.cpp	2016-05-25 14:49:33 UTC (rev 4521)
@@ -121,7 +121,7 @@
  * @param elmt : the element to getinfo
  * @return : QString with information about element formated to csv file
  */
-QString nomenclature::getElementInfo(const Element *elmt) {
+QString nomenclature::getElementInfo(Element *elmt) {
 	QString info;
 
 	Diagram *diagram = elmt -> diagram();
@@ -132,16 +132,15 @@
 	info += diagram -> border_and_titleblock.folio() + ";";
 	info += elmt -> name() + ";";
 	info += elmt-> diagram()-> convertPosition(elmt -> scenePos()).toString() + ";";
-	info += elmt_info["label"].toString() + ";";
-	info += elmt_info["designation"].toString() + ";";
-	info += elmt_info["comment"].toString() + ";";
-	info += elmt_info["manufacturer"].toString() + ";";
-	info += elmt_info["manufacturer-reference"].toString() + ";";
-	info += elmt_info["auxiliary1"].toString() + ";";
-	info += elmt_info["auxiliary2"].toString() + ";";
-	info += elmt_info["machine-manufacturer-reference"].toString() + ";";
-	info += elmt_info["location"].toString() + ";";
-	info += elmt_info["function"].toString() + "\n";
-
+	info += elmt->assignVariables(elmt_info["label"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["designation"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["comment"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["manufacturer"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["manufacturer-reference"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["auxiliary1"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["auxiliary2"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["machine-manufacturer-reference"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["location"].toString(), elmt) + ";";
+	info += elmt->assignVariables(elmt_info["function"].toString(), elmt) + "\n";
 	return info;
 }

Modified: trunk/sources/nomenclature.h
===================================================================
--- trunk/sources/nomenclature.h	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/nomenclature.h	2016-05-25 14:49:33 UTC (rev 4521)
@@ -56,7 +56,7 @@
 	
 	private:
 	QString getNomenclature ();
-	QString getElementInfo  (const Element *elmt);
+	QString getElementInfo  (Element *elmt);
 	
 };
 

Modified: trunk/sources/qetgraphicsitem/crossrefitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/crossrefitem.cpp	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/qetgraphicsitem/crossrefitem.cpp	2016-05-25 14:49:33 UTC (rev 4521)
@@ -535,7 +535,7 @@
  */
 void CrossRefItem::AddExtraInfo(QPainter &painter)
 {
-	QString comment = m_element -> elementInformations()["comment"].toString();
+	QString comment = m_element -> assignVariables(m_element -> elementInformations()["comment"].toString(), m_element);
 	bool must_show  = m_element -> elementInformations().keyMustShow("comment");
 
 	if (!comment.isEmpty() && must_show)

Modified: trunk/sources/qetgraphicsitem/customelement.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.cpp	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/qetgraphicsitem/customelement.cpp	2016-05-25 14:49:33 UTC (rev 4521)
@@ -987,11 +987,3 @@
 	}
 	return NULL;
 }
-
-QString CustomElement::assignVariables(QString label, Element *elmt){
-	label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
-	label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
-	label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
-	label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
-	return label;
-}

Modified: trunk/sources/qetgraphicsitem/customelement.h
===================================================================
--- trunk/sources/qetgraphicsitem/customelement.h	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/qetgraphicsitem/customelement.h	2016-05-25 14:49:33 UTC (rev 4521)
@@ -93,7 +93,6 @@
 	virtual bool validOrientationAttribute(const QDomElement &);
 	virtual void setPainterStyle(QDomElement &, QPainter &);
 	ElementTextItem* setTaggedText(const QString &tagg, const QString &newstr, const bool noeditable=false);
-	QString assignVariables (QString, Element *);
 };
 
 /**

Modified: trunk/sources/qetgraphicsitem/element.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/element.cpp	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/qetgraphicsitem/element.cpp	2016-05-25 14:49:33 UTC (rev 4521)
@@ -635,3 +635,17 @@
 	m_mouse_over = false;
 	update();
 }
+
+/**
+ * @brief Element::assignVariables()
+ * Assign variables values
+ * @param label, string to be changed
+ * @param elmt, element to extract variables values
+ */
+QString Element::assignVariables(QString label, Element *elmt){
+	label.replace("%f", QString::number(elmt->diagram()->folioIndex()+1));
+	label.replace("%F", elmt->diagram() -> border_and_titleblock.folio());
+	label.replace("%c", QString::number(elmt->diagram() -> convertPosition(elmt -> scenePos()).number()));
+	label.replace("%l", elmt->diagram() -> convertPosition(elmt -> scenePos()).letter());
+	return label;
+}

Modified: trunk/sources/qetgraphicsitem/element.h
===================================================================
--- trunk/sources/qetgraphicsitem/element.h	2016-05-25 06:32:17 UTC (rev 4520)
+++ trunk/sources/qetgraphicsitem/element.h	2016-05-25 14:49:33 UTC (rev 4521)
@@ -131,6 +131,7 @@
 		DiagramContext  kindInformations       () const             {return kind_informations_;}	//@kind_information_ is used to store more information
 																									//about the herited class like contactelement for know
 																									// kind of contact (simple tempo) or number of contact show by the element.
+		QString assignVariables (QString, Element *);
 
 	//ATTRIBUTES
 	protected:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/