[qet] [2431] DiagramContent can now manage DiagramImageItem

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


Revision: 2431
Author:   blacksun
Date:     2013-08-16 16:26:56 +0200 (Fri, 16 Aug 2013)
Log Message:
-----------
DiagramContent can now manage DiagramImageItem

Modified Paths:
--------------
    branches/0.4/sources/diagramcontent.cpp
    branches/0.4/sources/diagramcontent.h
    branches/0.4/sources/qet.cpp
    branches/0.4/sources/qet.h

Modified: branches/0.4/sources/diagramcontent.cpp
===================================================================
--- branches/0.4/sources/diagramcontent.cpp	2013-08-16 13:57:22 UTC (rev 2430)
+++ branches/0.4/sources/diagramcontent.cpp	2013-08-16 14:26:56 UTC (rev 2431)
@@ -20,6 +20,7 @@
 #include "element.h"
 #include "independenttextitem.h"
 #include "conductor.h"
+#include "diagramimageitem.h"
 
 /**
 	Constructeur par defaut. Ne contient rien.
@@ -33,6 +34,7 @@
 DiagramContent::DiagramContent(const DiagramContent &other) :
 	elements(other.elements),
 	textFields(other.textFields),
+	images(other.images),
 	conductorsToUpdate(other.conductorsToUpdate),
 	conductorsToMove(other.conductorsToMove),
 	otherConductors(other.otherConductors)
@@ -68,6 +70,7 @@
 void DiagramContent::clear() {
 	elements.clear();
 	textFields.clear();
+	images.clear();
 	conductorsToUpdate.clear();
 	conductorsToMove.clear();
 	otherConductors.clear();
@@ -82,6 +85,7 @@
 	foreach(QGraphicsItem *qgi, conductors(filter)) items_list << qgi;
 	if (filter & Elements)   foreach(QGraphicsItem *qgi, elements)   items_list << qgi;
 	if (filter & TextFields) foreach(QGraphicsItem *qgi, textFields)  items_list << qgi;
+	if (filter & Images) foreach(QGraphicsItem *qgi, images) items_list << qgi;
 	if (filter & SelectedOnly) {
 		foreach(QGraphicsItem *qgi, items_list) {
 			if (!qgi -> isSelected()) items_list.removeOne(qgi);
@@ -99,12 +103,14 @@
 	if (filter & SelectedOnly) {
 		if (filter & Elements)           foreach(Element *element,     elements)                  { if (element   -> isSelected()) ++ count; }
 		if (filter & TextFields)         foreach(DiagramTextItem *dti, textFields)                { if (dti       -> isSelected()) ++ count; }
+		if (filter & Images)			 foreach(DiagramImageItem *dii, images)					  { if (dii		  -> isSelected()) ++ count; }
 		if (filter & ConductorsToMove)   foreach(Conductor *conductor, conductorsToMove)          { if (conductor -> isSelected()) ++ count; }
 		if (filter & ConductorsToUpdate) foreach(Conductor *conductor, conductorsToUpdate)        { if (conductor -> isSelected()) ++ count; }
 		if (filter & OtherConductors)    foreach(Conductor *conductor, otherConductors)           { if (conductor -> isSelected()) ++ count; }
 	} else {
 		if (filter & Elements)           count += elements.count();
 		if (filter & TextFields)         count += textFields.count();
+		if (filter & Images)			 count += images.count();
 		if (filter & ConductorsToMove)   count += conductorsToMove.count();
 		if (filter & ConductorsToUpdate) count += conductorsToUpdate.count();
 		if (filter & OtherConductors)    count += otherConductors.count();
@@ -122,12 +128,14 @@
 	int elements_count   = (filter & Elements) ? elements.count() : 0;
 	int conductors_count = conductors(filter).count();
 	int textfields_count = (filter & TextFields) ? textFields.count() : 0;
+	int images_count	 = (filter & Images) ? images.count() : 0;
 	
 	return(
 		QET::ElementsAndConductorsSentence(
 			elements_count,
 			conductors_count,
-			textfields_count
+			textfields_count,
+			images_count
 		)
 	);
 }

Modified: branches/0.4/sources/diagramcontent.h
===================================================================
--- branches/0.4/sources/diagramcontent.h	2013-08-16 13:57:22 UTC (rev 2430)
+++ branches/0.4/sources/diagramcontent.h	2013-08-16 14:26:56 UTC (rev 2431)
@@ -21,6 +21,7 @@
 class Conductor;
 class Element;
 class IndependentTextItem;
+class DiagramImageItem;
 /**
 	This class provides a container that makes the transmission of diagram content
 	to other functions/methods easier. The different kind of items are made
@@ -40,6 +41,7 @@
 	enum Filter {
 		Elements = 1,
 		TextFields = 2,
+		Images = 3,
 		ConductorsToMove = 4,
 		ConductorsToUpdate = 8,
 		OtherConductors = 16,
@@ -52,6 +54,8 @@
 	QSet<Element *> elements;
 	/// Hold independent text items
 	QSet<IndependentTextItem *> textFields;
+	/// Hold image
+	QSet<DiagramImageItem *> images;
 	/// Hold conductors that would get updated considering electrical elements are moved
 	QSet<Conductor *> conductorsToUpdate;
 	/// Hold conductors that would be moved as is considering electrical elements are moved

Modified: branches/0.4/sources/qet.cpp
===================================================================
--- branches/0.4/sources/qet.cpp	2013-08-16 13:57:22 UTC (rev 2430)
+++ branches/0.4/sources/qet.cpp	2013-08-16 14:26:56 UTC (rev 2431)
@@ -199,7 +199,7 @@
 	@return la proposition decrivant le nombre d'elements, de conducteurs et de
 	textes
 */
-QString QET::ElementsAndConductorsSentence(int elements_count, int conductors_count, int texts_count) {
+QString QET::ElementsAndConductorsSentence(int elements_count, int conductors_count, int texts_count, int images_count) {
 	QString text;
 	if (elements_count) {
 		text += QObject::tr(
@@ -244,6 +244,14 @@
 			texts_count
 		);
 	}
+
+	if (images_count) {
+		text += QObject::tr(
+			"%n image(s)",
+			"part of a sentence listing the content of a diagram",
+			images_count
+		);
+	}
 	return(text);
 }
 

Modified: branches/0.4/sources/qet.h
===================================================================
--- branches/0.4/sources/qet.h	2013-08-16 13:57:22 UTC (rev 2430)
+++ branches/0.4/sources/qet.h	2013-08-16 14:26:56 UTC (rev 2431)
@@ -152,7 +152,7 @@
 	bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = 0);
 	bool attributeIsAnInteger(const QDomElement &, QString , int * = NULL);
 	bool attributeIsAReal(const QDomElement &, QString , qreal * = NULL);
-	QString ElementsAndConductorsSentence(int, int, int = 0);
+	QString ElementsAndConductorsSentence(int, int, int = 0, int = 0);
 	QList<QDomElement> findInDomElement(const QDomElement &, const QString &);
 	QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);
 	QList<QChar> forbiddenCharacters();


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