[qet] [4094] Diagram view : remove old code about drop element.

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


Revision: 4094
Author:   blacksun
Date:     2015-08-10 10:02:40 +0200 (Mon, 10 Aug 2015)
Log Message:
-----------
Diagram view : remove old code about drop element.

Modified Paths:
--------------
    trunk/sources/diagramview.cpp
    trunk/sources/diagramview.h

Modified: trunk/sources/diagramview.cpp
===================================================================
--- trunk/sources/diagramview.cpp	2015-08-09 17:10:09 UTC (rev 4093)
+++ trunk/sources/diagramview.cpp	2015-08-10 08:02:40 UTC (rev 4094)
@@ -94,7 +94,6 @@
 	connect(diagram, SIGNAL(editElementRequired(ElementsLocation)), this, SIGNAL(editElementRequired(ElementsLocation)));
 	connect(diagram, SIGNAL(findElementRequired(ElementsLocation)), this, SIGNAL(findElementRequired(ElementsLocation)));
 	
-	connect(this, SIGNAL(aboutToAddElement()), this, SLOT(addDroppedElement()), Qt::QueuedConnection);
 	connect(
 		this, SIGNAL(aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)),
 		this, SLOT(setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &)),
@@ -293,11 +292,6 @@
 	diagram()->setEventInterface(new DiagramEventAddElement(location, diagram(), mapToScene(e->pos())));
 		//Set focus to the view to get event
 	this->setFocus();
-	
-//	next_location_ = location;
-//	next_position_ = e-> pos();
-	
-//	emit(aboutToAddElement());
 }
 
 /**
@@ -823,33 +817,6 @@
 }
 
 /**
-	Cette methode permet de determiner s'il faut ou non integrer au projet un
-	element dont on connait l'emplacement.
-	L'element droppe est integre a la collection du projet :
-	  * s'il appartient a un autre projet, quelque soit la specification de
-	  l'utilisateur a ce propos ;
-	  * s'il appartient a la collection commune ou a la collection
-	  personnelle ET que l'utilisateur a autorise l'integration automatique
-	  des elements dans les projets.
-	@param location Emplacement de l'element
-	@return true si l'element doit etre integre, false sinon
-	
-*/
-bool DiagramView::mustIntegrateElement(const ElementsLocation &location) const {
-	// l'utilisateur a-t-il autorise l'integration automatique des elements dans les projets ?
-	bool auto_integration_enabled = QETApp::settings().value("diagrameditor/integrate-elements", true).toBool();
-	
-	// l'element appartient-il a un projet et si oui, est-ce un autre projet ?
-	bool elmt_from_project = location.project();
-	bool elmt_from_another_project = elmt_from_project && location.project() != scene -> project();
-	
-	// faut-il integrer l'element ?
-	bool must_integrate_element = (elmt_from_another_project || (auto_integration_enabled && !elmt_from_project));
-	
-	return(must_integrate_element);
-}
-
-/**
 	@param tbt_loc A title block template location
 	@return true if the title block template needs to be integrated in the
 	parent project before being applied to the current diagram, or false if it
@@ -864,24 +831,6 @@
 }
 
 /**
-	@param location Emplacement de l'element a ajouter sur le schema
-	@param pos Position (dans les coordonnees de la vue) a laquelle l'element sera ajoute
-*/
-bool DiagramView::addElementAtPos(const ElementsLocation &location, const QPoint &pos) {
-	// construit une instance de l'element correspondant a l'emplacement
-	int state;
-	Element *el = ElementFactory::Instance()->createElement(location, 0, &state);
-	if (state) {
-		delete el;
-		return(false);
-	}
-	
-	//Add element to diagram
-	diagram() -> undoStack().push (new AddItemCommand<Element *>(el, diagram(), mapToScene(pos)));
-	return(true);
-}
-
-/**
 	Fait en sorte que le schema ne soit editable que s'il n'est pas en lecture
 	seule
 */
@@ -1211,32 +1160,6 @@
 }
 
 /**
-	Cette methode ajoute l'element designe par l'emplacement location a la
-	position pos. Si necessaire, elle demande l'integration de l'element au
-	projet.
-	@see mustIntegrateElement
-*/
-void DiagramView::addDroppedElement() {
-	ElementsLocation location = next_location_;
-	QPoint pos = next_position_;
-	
-	if (!mustIntegrateElement(location)) {
-		addElementAtPos(location, pos);
-	} else {
-		QString error_msg;
-		IntegrationMoveElementsHandler *integ_handler = new IntegrationMoveElementsHandler(this);
-		QString integ_path = scene -> project() -> integrateElement(location.toString(), integ_handler, error_msg);
-		delete integ_handler;
-		if (integ_path.isEmpty()) {
-			qDebug() << "DiagramView::addDroppedElement : Impossible d'ajouter l'element. Motif : " << qPrintable(error_msg);
-			return;
-		}
-		addElementAtPos(ElementsLocation::locationFromString(integ_path), pos);
-	}
-	adjustSceneRect();
-}
-
-/**
 	@param tbt TitleBlockTemplateLocation
 */
 void DiagramView::setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &tbt) {

Modified: trunk/sources/diagramview.h
===================================================================
--- trunk/sources/diagramview.h	2015-08-09 17:10:09 UTC (rev 4093)
+++ trunk/sources/diagramview.h	2015-08-10 08:02:40 UTC (rev 4094)
@@ -17,7 +17,9 @@
 */
 #ifndef DIAGRAMVIEW_H
 #define DIAGRAMVIEW_H
-#include <QtWidgets>
+
+#include <QGraphicsView>
+#include <QClipboard>
 #include "elementslocation.h"
 #include "templatelocation.h"
 
@@ -25,12 +27,16 @@
 class Diagram;
 class QETDiagramEditor;
 class DVEventInterface;
+class QMenu;
+class QInputEvent;
+class QGestureEvent;
 
 /**
 	This class provides a widget to render an electric diagram in an editable,
 	interactive way.
 */
-class DiagramView : public QGraphicsView {
+class DiagramView : public QGraphicsView
+{
 	Q_OBJECT
 	
 		// constructors, destructor
@@ -49,10 +55,8 @@
 		QAction          *paste_here;
 		QAction          *find_element_;
 		QPoint            paste_here_pos;
-		QPoint            next_position_;
 		QPointF           rubber_band_origin;
 		bool              fresh_focus_in_;    ///< Indicate the focus was freshly gained
-		ElementsLocation  next_location_;
 		bool m_first_activation;
 
 
@@ -99,9 +103,7 @@
 	void handleTextDrop(QDropEvent *);
 	bool gestureEvent(QGestureEvent *event);
 	QRectF viewedSceneRect() const;
-	bool mustIntegrateElement(const ElementsLocation &) const;
 	bool mustIntegrateTitleBlockTemplate(const TitleBlockTemplateLocation &) const;
-	bool addElementAtPos(const ElementsLocation &, const QPoint &);
 	bool gestures() const;
 
 	signals:
@@ -111,8 +113,6 @@
 	void modeChanged();
 	/// Signal emitted after the diagram title changed
 	void titleChanged(DiagramView *, const QString &);
-	/// Signal emitted before integrating an element
-	void aboutToAddElement();
 	/// Signal emitted before integrating a title block template
 	void aboutToSetDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &);
 	/// Signal emitted when users wish to locate an element from the diagram within elements collection
@@ -154,7 +154,6 @@
 	void resetConductors();
 	
 	private slots:
-	void addDroppedElement();
 	void setDroppedTitleBlockTemplate(const TitleBlockTemplateLocation &);
 	void adjustGridToZoom();
 	void applyReadOnly();


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