[qet] [2617] Add name property to terminal

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


Revision: 2617
Author:   cfdev
Date:     2013-11-16 17:53:46 +0100 (Sat, 16 Nov 2013)
Log Message:
-----------
Add name property to terminal

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

Modified: trunk/sources/terminal.cpp
===================================================================
--- trunk/sources/terminal.cpp	2013-11-15 17:25:45 UTC (rev 2616)
+++ trunk/sources/terminal.cpp	2013-11-16 16:53:46 UTC (rev 2617)
@@ -32,8 +32,10 @@
 	Methode privee pour initialiser la borne.
 	@param pf  position du point d'amarrage pour un conducteur
 	@param o   orientation de la borne : Qt::Horizontal ou Qt::Vertical
+	@param number of terminal
+	@param name of terminal
 */
-void Terminal::init(QPointF pf, QET::Orientation o, QString number) {
+void Terminal::init(QPointF pf, QET::Orientation o, QString number, QString name, bool hiddenName) {
 	// definition du pount d'amarrage pour un conducteur
 	dock_conductor_  = pf;
 	
@@ -52,6 +54,9 @@
 	}
 	// Number of terminal
 	number_terminal_ = number;
+	// Name of terminal
+	name_terminal_ = name;
+	name_terminal_hidden = hiddenName;
 	// par defaut : pas de conducteur
 	
 	// QRectF null
@@ -76,7 +81,7 @@
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
-	init(pf, o, "_");
+	init(pf, o, "_", "_", false);
 }
 
 /**
@@ -92,7 +97,7 @@
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
-	init(QPointF(pf_x, pf_y), o, "_");
+	init(QPointF(pf_x, pf_y), o, "_", "_", false);
 }
 
 /**
@@ -100,15 +105,17 @@
 	@param pf  position du point d'amarrage pour un conducteur
 	@param o   orientation de la borne : Qt::Horizontal ou Qt::Vertical
 	@param num number of terminal (ex 3 - 4 for NO)
+	@param name of terminal
+	@param hiddenName hide or show the name
 	@param e   Element auquel cette borne appartient
 	@param s   Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, Element *e, Diagram *s) :
+Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, QString name, bool hiddenName, Element *e, Diagram *s) :
 	QGraphicsItem(e, s),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
-	init(pf, o, num);
+	init(pf, o, num, name, hiddenName);
 }
 
 /**
@@ -153,6 +160,15 @@
 }
 
 /**
+ * @brief Terminal::setName
+ * @param name
+ */
+void Terminal::setName(QString name, bool hiddenName) {
+	name_terminal_ = name;
+	name_terminal_hidden = hiddenName;
+}
+
+/**
 	Attribue un conductor a la borne
 	@param f Le conducteur a rattacher a cette borne
 */

Modified: trunk/sources/terminal.h
===================================================================
--- trunk/sources/terminal.h	2013-11-15 17:25:45 UTC (rev 2616)
+++ trunk/sources/terminal.h	2013-11-16 16:53:46 UTC (rev 2617)
@@ -33,7 +33,7 @@
 	public:
 	Terminal(QPointF,      QET::Orientation, Element * = 0, Diagram * = 0);
 	Terminal(qreal, qreal, QET::Orientation, Element * = 0, Diagram * = 0);
-	Terminal(QPointF,      QET::Orientation, QString number, Element * = 0, Diagram * = 0);
+	Terminal(QPointF,      QET::Orientation, QString number, QString name, bool hiddenName, Element * = 0, Diagram * = 0);
 	virtual ~Terminal();
 	
 	private:
@@ -63,7 +63,9 @@
 	QET::Orientation orientation() const;
 	QPointF dockConductor() const;
 	QString number() const;
+	QString name() const;
 	void setNumber(QString number);
+	void setName(QString name, bool hiddenName);
 	void updateConductor();
 	bool isLinkedTo(Terminal *);
 	bool canBeLinkedTo(Terminal *);
@@ -121,9 +123,12 @@
 	QColor hovered_color_;
 	/// Number of Terminal
 	QString number_terminal_;
+	/// Name of Terminal
+	QString name_terminal_;
+	bool name_terminal_hidden;
 	
 	private:
-	void init(QPointF, QET::Orientation, QString number);
+	void init(QPointF, QET::Orientation, QString number, QString name, bool hiddenName);
 };
 
 /**
@@ -148,4 +153,11 @@
 	return(number_terminal_);
 }
 
+/**
+	@return the name of terminal.
+*/
+inline QString Terminal::name() const {
+	return(name_terminal_);
+}
+
 #endif


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