[qet] [2848] Minor formatting and documenting

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


Revision: 2848
Author:   abhishekm71
Date:     2014-02-11 06:10:16 +0100 (Tue, 11 Feb 2014)
Log Message:
-----------
Minor formatting and documenting

Modified Paths:
--------------
    trunk/sources/createdxf.cpp
    trunk/sources/diagramfoliolist.cpp
    trunk/sources/qetdiagrameditor.cpp
    trunk/sources/qetproject.cpp
    trunk/sources/qetproject.h

Modified: trunk/sources/createdxf.cpp
===================================================================
--- trunk/sources/createdxf.cpp	2014-02-10 13:58:30 UTC (rev 2847)
+++ trunk/sources/createdxf.cpp	2014-02-11 05:10:16 UTC (rev 2848)
@@ -488,6 +488,8 @@
 }
 
 /* draw aligned text in DXF Format */
+// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small,
+// then the text is either centered or left-aligned, depnding on the value of leftAlign.
 void Createdxf::drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour,
 							bool leftAlign, float scale)
 {

Modified: trunk/sources/diagramfoliolist.cpp
===================================================================
--- trunk/sources/diagramfoliolist.cpp	2014-02-10 13:58:30 UTC (rev 2847)
+++ trunk/sources/diagramfoliolist.cpp	2014-02-11 05:10:16 UTC (rev 2848)
@@ -24,6 +24,7 @@
 /**
  * @brief DiagramFolioList::DiagramFolioList
  * Constructor
+ * @param project QETproject *: The project from which this constructor was called. Important to setProject().
  * @param parent parent QObject
  */
 DiagramFolioList::DiagramFolioList( QETProject *project, QObject *parent) : Diagram(parent) {

Modified: trunk/sources/qetdiagrameditor.cpp
===================================================================
--- trunk/sources/qetdiagrameditor.cpp	2014-02-10 13:58:30 UTC (rev 2847)
+++ trunk/sources/qetdiagrameditor.cpp	2014-02-11 05:10:16 UTC (rev 2848)
@@ -651,8 +651,7 @@
 	new_project -> setDefaultTitleBlockProperties(defaultTitleBlockProperties());
 	new_project -> setDefaultReportProperties(defaultReportProperties());
 	
-	// add summary and new diagram
-	//new_project -> addNewDiagramFolioList();
+	// add new diagram
 	new_project -> addNewDiagram();
 	
 	return(addProject(new_project));
@@ -1682,6 +1681,8 @@
 void QETDiagramEditor::addDiagramFolioListToProject() {
 	ProjectView *current_project = currentProject();
 	if (current_project && current_project -> project() -> getFolioSheetsQuantity() == 0) {
+
+		// The number of folio sheets depend on the number of diagrams in the project.
 		int diagram_qty = current_project -> diagrams().size();
 		for (int i = 0; i <= diagram_qty/58; i++)
 			current_project -> addNewDiagramFolioList();
@@ -1805,23 +1806,28 @@
 		if (DiagramView *current_diagram = current_project -> currentDiagram()) {
 			can_update_actions = false;
 			bool isFolioList = false;
+
+			// if diagram to remove is a "folio list sheet", then set a flag.
 			if (DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(current_diagram -> diagram()))
 				isFolioList = true;
+
 			current_project -> removeDiagram(current_diagram);
+
+			// if the removed diagram was a folio sheet, then delete all the remaining folio sheets also.
 			if (isFolioList) {
 				foreach (DiagramView *diag, current_project -> diagrams()) {
 					if (DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram())) {
 						current_project -> removeDiagram(diag);
 					}
 				}
-				//current_project ->project() ->setFolioSheetsQuantity(0);
+
+			  // else if after diagram removal, the total diagram quantity becomes a factor of 58, then
+			  // remove one (last) folio sheet.
 			} else if (current_project -> diagrams().size() % 58 == 0) {
 				foreach (DiagramView *diag, current_project -> diagrams()) {
 					DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
 					if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
 						current_project -> removeDiagram(diag);
-						//int folioQuantity = current_project -> project() -> getFolioSheetsQuantity();
-						//current_project -> project() -> setFolioSheetsQuantity(folioQuantity - 1);
 					}
 				}
 			}

Modified: trunk/sources/qetproject.cpp
===================================================================
--- trunk/sources/qetproject.cpp	2014-02-10 13:58:30 UTC (rev 2847)
+++ trunk/sources/qetproject.cpp	2014-02-11 05:10:16 UTC (rev 2848)
@@ -172,10 +172,18 @@
 	return(state_);
 }
 
+/**
+	Get the folioSheetQuantity
+	@return folio Sheets Quantity.
+*/
 int QETProject::getFolioSheetsQuantity() const {
 	return(folioSheetsQuantity);
 }
 
+/**
+	Set the folioSheetQuantity to quantity
+	@param New value of quantity to be set.
+*/
 void QETProject::setFolioSheetsQuantity(int quantity) {
 	folioSheetsQuantity = quantity;
 }
@@ -453,6 +461,8 @@
 	QDomElement project_root = xml_doc.createElement("project");
 	project_root.setAttribute("version", QET::version);
 	project_root.setAttribute("title", project_title_);
+
+	// write the present value of folioSheetsQuantity to XML.
 	project_root.setAttribute("folioSheetQuantity", QString::number(folioSheetsQuantity));
 	xml_doc.appendChild(project_root);
 	
@@ -481,6 +491,8 @@
 	// qDebug() << "Export XML de" << diagrams_.count() << "schemas";
 	int order_num = 1;
 	foreach(Diagram *diagram, diagrams_) {
+
+		// Write the diagram to XML only if it is not of type DiagramFolioList.
 		DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
 		if ( !ptr ) {
 			qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\" [%2]").arg(diagram -> title()).arg(QET::pointerString(diagram)));
@@ -966,6 +978,8 @@
 	// la racine du document XML est sensee etre un element "project"
 	if (root_elmt.tagName() == "project") {
 
+		// if there is an attribute for folioSheetQuantity, then set it accordingly.
+		// If not, then the value remains at the initial value of zero.
 		if (root_elmt.hasAttribute("folioSheetQuantity"))
 			setFolioSheetsQuantity(root_elmt.attribute("folioSheetQuantity","0").toInt());
 
@@ -1065,6 +1079,7 @@
 		d->initElementsLinks();
 	}
 
+	// If the folio sheets quantity is non-zero, then add the folio sheets
 	if (getFolioSheetsQuantity()) {
 		setFolioSheetsQuantity(0);
 		int diagCount = diagrams().size();

Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h	2014-02-10 13:58:30 UTC (rev 2847)
+++ trunk/sources/qetproject.h	2014-02-11 05:10:16 UTC (rev 2848)
@@ -74,8 +74,8 @@
 	public:
 	ProjectState state() const;
 	QList<Diagram *> diagrams() const;
-	int getFolioSheetsQuantity() const;
-	void setFolioSheetsQuantity(int);
+	int getFolioSheetsQuantity() const; /// get the folio sheets quantity for this project
+	void setFolioSheetsQuantity(int);   /// set the folio sheets quantity for this project
 	int folioIndex(const Diagram *) const;
 	ElementsCollection *embeddedCollection() const;
 	TitleBlockTemplatesProjectCollection *embeddedTitleBlockTemplatesCollection();
@@ -177,7 +177,7 @@
 	QDomDocument document_root_;
 	/// Diagrams carried by the project
 	QList<Diagram *> diagrams_;
-	/// Folio List Sheet is added to this project.
+	/// Folio List Sheets quantity for this project.
 	int folioSheetsQuantity;
 	/// Embedded elements collection
 	XmlElementsCollection *collection_;


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