[qet] [2439] add remove image command

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


Revision: 2439
Author:   blacksun
Date:     2013-08-19 23:24:50 +0200 (Mon, 19 Aug 2013)
Log Message:
-----------
add remove image command

Modified Paths:
--------------
    branches/0.4/sources/diagram.cpp
    branches/0.4/sources/diagramcommands.cpp
    branches/0.4/sources/diagramview.cpp
    branches/0.4/sources/qet.cpp

Modified: branches/0.4/sources/diagram.cpp
===================================================================
--- branches/0.4/sources/diagram.cpp	2013-08-19 16:31:29 UTC (rev 2438)
+++ branches/0.4/sources/diagram.cpp	2013-08-19 21:24:50 UTC (rev 2439)
@@ -1193,6 +1193,8 @@
 			) {
 				dc.otherConductors << c;
 			}
+		} else if (DiagramImageItem *dii = qgraphicsitem_cast<DiagramImageItem *>(item)) {
+			dc.images << dii;
 		}
 	}
 	

Modified: branches/0.4/sources/diagramcommands.cpp
===================================================================
--- branches/0.4/sources/diagramcommands.cpp	2013-08-19 16:31:29 UTC (rev 2438)
+++ branches/0.4/sources/diagramcommands.cpp	2013-08-19 21:24:50 UTC (rev 2439)
@@ -209,6 +209,10 @@
 	foreach(IndependentTextItem *t, removed_content.textFields) {
 		diagram -> addIndependentTextItem(t);
 	}
+
+	foreach(DiagramImageItem *dii, removed_content.images) {
+		diagram -> addItem(dii);
+	}
 }
 
 /// refait les suppressions
@@ -227,6 +231,11 @@
 	foreach(IndependentTextItem *t, removed_content.textFields) {
 		diagram -> removeIndependentTextItem(t);
 	}
+
+	//enleve les images
+	foreach(DiagramImageItem *dii, removed_content.images) {
+		diagram -> removeItem(dii);
+	}
 }
 
 /**

Modified: branches/0.4/sources/diagramview.cpp
===================================================================
--- branches/0.4/sources/diagramview.cpp	2013-08-19 16:31:29 UTC (rev 2438)
+++ branches/0.4/sources/diagramview.cpp	2013-08-19 21:24:50 UTC (rev 2439)
@@ -658,7 +658,8 @@
 		if (
 			qgraphicsitem_cast<Element *>(qgi) ||
 			qgraphicsitem_cast<Conductor *>(qgi) ||
-			qgraphicsitem_cast<IndependentTextItem *>(qgi)
+			qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
+			qgraphicsitem_cast<DiagramImageItem *>(qgi)
 		) {
 			return(true);
 		}

Modified: branches/0.4/sources/qet.cpp
===================================================================
--- branches/0.4/sources/qet.cpp	2013-08-19 16:31:29 UTC (rev 2438)
+++ branches/0.4/sources/qet.cpp	2013-08-19 21:24:50 UTC (rev 2439)
@@ -196,6 +196,7 @@
 	@param elements_count nombre d'elements
 	@param conductors_count nombre de conducteurs
 	@param texts_count nombre de champs de texte
+	@param images_count nombre d'images
 	@return la proposition decrivant le nombre d'elements, de conducteurs et de
 	textes
 */
@@ -207,13 +208,15 @@
 			"part of a sentence listing the content of a diagram",
 			elements_count
 		);
-		if (conductors_count && texts_count) {
+		if ((conductors_count && texts_count) ||
+			(conductors_count && images_count) ||
+			(texts_count && images_count)) {
 			text += QObject::tr(
 				", ",
 				"separator between elements and conductors in a sentence "
 				"listing the content of a diagram"
 			);
-		} else if (conductors_count || texts_count) {
+		} else if (conductors_count || texts_count || images_count) {
 			text += QObject::tr(
 				" et ",
 				"separator between elements and conductors (or texts) in a "
@@ -228,8 +231,15 @@
 			"part of a sentence listing the content of a diagram",
 			conductors_count
 		);
-		if (texts_count) {
+		if (texts_count && images_count) {
 			text += QObject::tr(
+				", ",
+				"separator between elements and conductors in a sentence "
+				"listing the content of a diagram"
+			);
+		}
+		else if (texts_count || images_count) {
+			text += QObject::tr(
 				" et ",
 				"separator between conductors and texts in a sentence listing "
 				"the content of a diagram"
@@ -243,6 +253,13 @@
 			"part of a sentence listing the content of a diagram",
 			texts_count
 		);
+		if (images_count) {
+			text += QObject::tr(
+				" et ",
+				"separator between conductors and texts in a sentence listing "
+				"the content of a diagram"
+			);
+		}
 	}
 
 	if (images_count) {


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