[qet] [3391] Diagram command : minor imrpovement

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


Revision: 3391
Author:   blacksun
Date:     2014-10-21 22:29:16 +0200 (Tue, 21 Oct 2014)
Log Message:
-----------
Diagram command : minor imrpovement

Modified Paths:
--------------
    trunk/sources/diagramcommands.cpp
    trunk/sources/diagramcommands.h
    trunk/sources/elementsmover.cpp
    trunk/sources/qet.cpp
    trunk/sources/qgimanager.cpp

Modified: trunk/sources/diagramcommands.cpp
===================================================================
--- trunk/sources/diagramcommands.cpp	2014-10-21 14:04:26 UTC (rev 3390)
+++ trunk/sources/diagramcommands.cpp	2014-10-21 20:29:16 UTC (rev 3391)
@@ -160,7 +160,7 @@
 	QUndoCommand(parent),
 	content(c),
 	diagram(dia),
-	filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove),
+	filter(DiagramContent::Elements|DiagramContent::TextFields|DiagramContent::Images|DiagramContent::ConductorsToMove | DiagramContent::Shapes),
 	first_redo(true)
 {
 	
@@ -354,22 +354,6 @@
 }
 
 /**
-	Ajoute un champ de texte de conducteur a deplacer
-	@param text_item Champ de texte a deplacer
-	@param old_pos Position du champ de texte avant le deplacement
-	@param new_pos Position du champ de texte apres le deplacement
-*/
-void MoveElementsCommand::addConductorTextItemMovement(ConductorTextItem *text_item, const QPointF &old_pos, const QPointF &new_pos) {
-	if (moved_conductor_texts_.contains(text_item)) return;
-	if (!text_item -> wasMovedByUser()) return;
-	if (new_pos == old_pos) return;
-	moved_conductor_texts_.insert(
-		text_item,
-		qMakePair(old_pos, new_pos)
-	);
-}
-
-/**
  * @brief MoveElementsCommand::setupAnimation
  * Set up the animation for this undo command
  * @param target object to anim

Modified: trunk/sources/diagramcommands.h
===================================================================
--- trunk/sources/diagramcommands.h	2014-10-21 14:04:26 UTC (rev 3390)
+++ trunk/sources/diagramcommands.h	2014-10-21 20:29:16 UTC (rev 3391)
@@ -159,7 +159,6 @@
 	virtual void undo();
 	virtual void redo();
 	virtual void move(const QPointF &);
-	virtual void addConductorTextItemMovement(ConductorTextItem *, const QPointF &, const QPointF &);
 
 	private:
 	void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant start, const QVariant end);
@@ -174,13 +173,6 @@
 	QPointF movement;
 	///animation group
 	QParallelAnimationGroup *m_anim_group;
-	/**
-		Moving elements impacts their conductors: either they are moved, or their path
-		needs to be generated again, which in turn tends to move their child text
-		items. This attribute holds both new and previous positions for each moved
-		text item.
-	*/
-	QHash<ConductorTextItem *, QPair<QPointF, QPointF> > moved_conductor_texts_;
 	/// prevent the first call to redo()
 	bool first_redo;
 };

Modified: trunk/sources/elementsmover.cpp
===================================================================
--- trunk/sources/elementsmover.cpp	2014-10-21 14:04:26 UTC (rev 3390)
+++ trunk/sources/elementsmover.cpp	2014-10-21 20:29:16 UTC (rev 3391)
@@ -155,17 +155,6 @@
 			current_movement_
 		);
 		
-		// Add info needed to the position of conductors texte
-		foreach(ConductorTextItem *text_item, updated_conductors_text_pos_.keys()) {
-			if (text_item -> pos() != updated_conductors_text_pos_[text_item]) {
-				undo_object -> addConductorTextItemMovement(
-					text_item,
-					updated_conductors_text_pos_[text_item],
-					text_item -> pos()
-				);
-			}
-		}
-		
 		diagram_ -> undoStack().push(undo_object);
 	}
 	

Modified: trunk/sources/qet.cpp
===================================================================
--- trunk/sources/qet.cpp	2014-10-21 14:04:26 UTC (rev 3390)
+++ trunk/sources/qet.cpp	2014-10-21 20:29:16 UTC (rev 3391)
@@ -273,7 +273,7 @@
 
 	if (shapes_count) {
 		text += QObject::tr(
-			"%n image(s)",
+			"%n forme(s)",
 			"part of a sentence listing the content of a diagram",
 			shapes_count
 		);

Modified: trunk/sources/qgimanager.cpp
===================================================================
--- trunk/sources/qgimanager.cpp	2014-10-21 14:04:26 UTC (rev 3390)
+++ trunk/sources/qgimanager.cpp	2014-10-21 20:29:16 UTC (rev 3391)
@@ -46,6 +46,7 @@
 	@param qgi QGraphicsItem a gerer
 */
 void QGIManager::manage(QGraphicsItem *qgi) {
+	if (qgi -> parentItem()) return;
 	if (qgi_manager.contains(qgi)) ++ qgi_manager[qgi];
 	else qgi_manager.insert(qgi, 1);
 }


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