diff --git a/src/gui/qt4/networkEditor/WQtNetworkArrow.h b/src/gui/qt4/networkEditor/WQtNetworkArrow.h index f19b343aef04731ef7913c2648c7c95f6d747ce8..3559bc86668f53e636b6cae51521c66f0c031d7f 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkArrow.h +++ b/src/gui/qt4/networkEditor/WQtNetworkArrow.h @@ -46,117 +46,117 @@ class WQtNetworkInputPort; */ class WQtNetworkArrow : public QGraphicsLineItem { - public: - - /** - * This customize the return value of type() - */ - enum - { - Type = UserType + 4 - }; - - /** - * Constructor - * - * \param outPort the outputport that provide the data - * \param inPort the inputport that recive the data - */ - explicit WQtNetworkArrow( WQtNetworkOutputPort *outPort, WQtNetworkInputPort *inPort ); - - /** - * Destructor - */ - ~WQtNetworkArrow(); - - /** - * Reimplementation from QGraphicsItem - * \return the type of the item as int - */ - int type() const; - - /** - * Calculated the new position of the lines endpoints in the scene. - * Is called everytime the parentItem is changed or after construction. - */ - void updatePosition(); - - /** - * Returns the WQtNetworkOutputPort where the arrow starts. - *\return the WQtNetworkInputPort where the connection starts - */ - WQtNetworkOutputPort* getStartPort(); - - /** - * Returns the WQtNetworkInputPort where the arrow ends. - *\return the WQtNetworkInputPort where the connection ends - */ - WQtNetworkInputPort* getEndPort(); - - /** - * Reimplementation form QGraphicsItem, because the arrowhead is added - * to the line. Its needed that QGraphicsView knows which area needs to - * be redrawn. - * \return a QRectF that bounds the drawn object - */ - QRectF boundingRect() const; - - /** - * Reimplementation from QGraphicsItem. - * Return the shape of this item as a QPainterPath in local coordinates - * \return shape as QPainterPath of this object - */ - QPainterPath shape() const; - - /** - * If the item is changed we want to get notified. - * - * \param change - * \param value - * \return - */ - QVariant itemChange( GraphicsItemChange change, const QVariant &value ); - - protected: - - /** - * Draw some customized stuff in the scene. - * - * \param painter - * \param option - * \param w - */ - void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w ); - - /** - * If the cursor enters the arrow, the arrow becomes geen. - * - * \param event the hover event - */ - void hoverEnterEvent( QGraphicsSceneHoverEvent * event ); - - /** - * If the cursor leaves the arrow, the arrow gets his default color. - * - * \param event the hover event - */ - void hoverLeaveEvent( QGraphicsSceneHoverEvent * event ); - - private: - - /** - * This method changes the color of the arrow. - * - * \param color the choosen color - */ - void changeColor( QColor color ); - - WQtNetworkOutputPort *m_startPort; //!< the start port - - WQtNetworkInputPort *m_endPort; //!< the end port - - QColor m_color; //!< the current color - - QPolygonF arrowHead; //!< the arrowhead +public: + + /** + * This customize the return value of type() + */ + enum + { + Type = UserType + 4 + }; + + /** + * Constructor + * + * \param outPort the outputport that provide the data + * \param inPort the inputport that recive the data + */ + explicit WQtNetworkArrow( WQtNetworkOutputPort *outPort, WQtNetworkInputPort *inPort ); + + /** + * Destructor + */ + ~WQtNetworkArrow(); + + /** + * Reimplementation from QGraphicsItem + * \return the type of the item as int + */ + int type() const; + + /** + * Calculated the new position of the lines endpoints in the scene. + * Is called everytime the parentItem is changed or after construction. + */ + void updatePosition(); + + /** + * Returns the WQtNetworkOutputPort where the arrow starts. + *\return the WQtNetworkInputPort where the connection starts + */ + WQtNetworkOutputPort* getStartPort(); + + /** + * Returns the WQtNetworkInputPort where the arrow ends. + *\return the WQtNetworkInputPort where the connection ends + */ + WQtNetworkInputPort* getEndPort(); + + /** + * Reimplementation form QGraphicsItem, because the arrowhead is added + * to the line. Its needed that QGraphicsView knows which area needs to + * be redrawn. + * \return a QRectF that bounds the drawn object + */ + QRectF boundingRect() const; + + /** + * Reimplementation from QGraphicsItem. + * Return the shape of this item as a QPainterPath in local coordinates + * \return shape as QPainterPath of this object + */ + QPainterPath shape() const; + + /** + * If the item is changed we want to get notified. + * + * \param change + * \param value + * \return + */ + QVariant itemChange( GraphicsItemChange change, const QVariant &value ); + +protected: + + /** + * Draw some customized stuff in the scene. + * + * \param painter + * \param option + * \param w + */ + void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w ); + + /** + * If the cursor enters the arrow, the arrow becomes geen. + * + * \param event the hover event + */ + void hoverEnterEvent( QGraphicsSceneHoverEvent * event ); + + /** + * If the cursor leaves the arrow, the arrow gets his default color. + * + * \param event the hover event + */ + void hoverLeaveEvent( QGraphicsSceneHoverEvent * event ); + +private: + + /** + * This method changes the color of the arrow. + * + * \param color the choosen color + */ + void changeColor( QColor color ); + + WQtNetworkOutputPort *m_startPort; //!< the start port + + WQtNetworkInputPort *m_endPort; //!< the end port + + QColor m_color; //!< the current color + + QPolygonF arrowHead; //!< the arrowhead }; #endif // WQTNETWORKARROW_H diff --git a/src/gui/qt4/networkEditor/WQtNetworkEditor.h b/src/gui/qt4/networkEditor/WQtNetworkEditor.h index 6cd8e79d2f53b80db971e9665a712ab86011642a..aa0abefbfc77ba11f351c3817fa5b9613644285f 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkEditor.h +++ b/src/gui/qt4/networkEditor/WQtNetworkEditor.h @@ -55,7 +55,6 @@ public: /** * default constructor * - * \param title Title will be displayed above the widget * \param parent The widget that manages this widget */ explicit WQtNetworkEditor( WMainWindow* parent = 0 ); @@ -67,7 +66,7 @@ public: /** * Create a new WQtNetworkItem for a given WModule - * \param a new WModule + * \param module a new WModule */ void addModule( boost::shared_ptr< WModule > module ); @@ -100,20 +99,18 @@ protected: /** * Everytime a module is associated, ready, connected, disconnected, removed or * deleted the kernels emits a signal and here we look how to behave. + * + * \param event the event that should be handled here. */ virtual bool event( QEvent* event ); - /** - * Determines compatible prototypes - * \return list of modules without possible input connectors - */ - WQtCombinerToolbar* createCompatibleButtons( boost::shared_ptr< WModule >module ); - /** * This event is called every 'timerID' in ms. If the WQtNetworkItems don't * move as result of the calculated forces the timer won't be reseted. + * + * \param event the timer event */ - void timerEvent( QTimerEvent *event ); + void timerEvent( QTimerEvent* event ); private: diff --git a/src/gui/qt4/networkEditor/WQtNetworkInputPort.h b/src/gui/qt4/networkEditor/WQtNetworkInputPort.h index 2dcb88539a4783eb11c8eb46110a0c9fb4353d89..123df688131dee5d3e3c1ed8b5a82a6309387532 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkInputPort.h +++ b/src/gui/qt4/networkEditor/WQtNetworkInputPort.h @@ -37,120 +37,122 @@ class WQtNetworkArrow; /** * This class represents the ports a module have. Two ports from different * modules can be connected by the corresponding ports. - */ + */ class WQtNetworkInputPort : public WQtNetworkPort { - public: - - /** - * Constructor - * \param connector the related WModuleInputConnector - */ - explicit WQtNetworkInputPort( boost::shared_ptr connector ); - - /** - * Destructor - */ - ~WQtNetworkInputPort(); - - /** - * This customize the return value of type() - */ - enum - { - Type = UserType + 11 - }; - - /** - * Reimplementation from QGraphicsItem - * \return the type of the item as int - */ - int type() const; - - /** - * Every Arrow connected with this port is updating its position in the - * scene. - */ - void updateArrows(); - - /** - * Removes a specific arrow - * \param arrow an arrow - */ - void removeArrow( WQtNetworkArrow *arrow ); - - /** - * Removes all connected arrows - */ - void removeArrows(); - - /** - * Calculates the position inside a item for each port to get a correct - * alignment - * \param size the total number of ports ( distinguished by in- and - * outport - * \param portNumber the number of the current port (distinguised by in- - * and outport - * \param rect the rect of the parent item - * \param inOut is it an in- or outport - */ - void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); - - /** - * Set the type of the port. - * \param type true if out / false if in - */ - void setOutPort( bool type ); - - /** - * Returns the porttype. - * \return is it a outport - */ - bool isOutPort(); - - /** - * Returns the Name. - * \return Name - */ - QString getPortName(); - - /** - * Set the Name - * \param str Name as string - */ - void setPortName( QString str ); - - /** - * Return the number of connections - * \return number of connections - */ - int getNumberOfArrows(); - - /** - * Returns the WModuleInputConnecter that belongs to this object. - * \return a WModuleInputConnector - */ - boost::shared_ptr getConnector(); - - /** - * Adds an arrow to the port - */ - void addArrow( WQtNetworkArrow *arrow ); - - /** - * Get a QList of all arrows connected to this port - * \return a QList of WQtNetworkArrows - */ - QList< WQtNetworkArrow *> getArrowList(); - - private: - - bool m_isOutPort; //!< is the port an outport - - QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows - - QString m_name; //!< the portname - - boost::shared_ptr m_connector; //!< the related WModuleInputConnector +public: + + /** + * Constructor + * \param connector the related WModuleInputConnector + */ + explicit WQtNetworkInputPort( boost::shared_ptr connector ); + + /** + * Destructor + */ + ~WQtNetworkInputPort(); + + /** + * This customize the return value of type() + */ + enum + { + Type = UserType + 11 + }; + + /** + * Reimplementation from QGraphicsItem + * \return the type of the item as int + */ + int type() const; + + /** + * Every Arrow connected with this port is updating its position in the + * scene. + */ + void updateArrows(); + + /** + * Removes a specific arrow + * \param arrow an arrow + */ + void removeArrow( WQtNetworkArrow *arrow ); + + /** + * Removes all connected arrows + */ + void removeArrows(); + + /** + * Calculates the position inside a item for each port to get a correct + * alignment + * \param size the total number of ports ( distinguished by in- and + * outport + * \param portNumber the number of the current port (distinguised by in- + * and outport + * \param rect the rect of the parent item + * \param outPort is it an in- or outport + */ + void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); + + /** + * Set the type of the port. + * \param type true if out / false if in + */ + void setOutPort( bool type ); + + /** + * Returns the porttype. + * \return is it a outport + */ + bool isOutPort(); + + /** + * Returns the Name. + * \return Name + */ + QString getPortName(); + + /** + * Set the Name + * \param str Name as string + */ + void setPortName( QString str ); + + /** + * Return the number of connections + * \return number of connections + */ + int getNumberOfArrows(); + + /** + * Returns the WModuleInputConnecter that belongs to this object. + * \return a WModuleInputConnector + */ + boost::shared_ptr getConnector(); + + /** + * Adds an arrow to the port + * + * \param arrow the arrow to add + */ + void addArrow( WQtNetworkArrow* arrow ); + + /** + * Get a QList of all arrows connected to this port + * \return a QList of WQtNetworkArrows + */ + QList< WQtNetworkArrow *> getArrowList(); + +private: + + bool m_isOutPort; //!< is the port an outport + + QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows + + QString m_name; //!< the portname + + boost::shared_ptr m_connector; //!< the related WModuleInputConnector }; #endif // WQTNETWORKINPUTPORT_H diff --git a/src/gui/qt4/networkEditor/WQtNetworkItem.h b/src/gui/qt4/networkEditor/WQtNetworkItem.h index 156629fa86db180543bb3575adcdeecb9e0b02bb..0096d971cb09310dbe7da5386b58b8b95f6b1ff7 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkItem.h +++ b/src/gui/qt4/networkEditor/WQtNetworkItem.h @@ -43,171 +43,178 @@ class QGraphicsWidget; */ class WQtNetworkItem : public QGraphicsRectItem { - public: - /** - * Constructor of the item. - */ - explicit WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WModule > module ); - - /** - * Destructor. - */ - virtual ~WQtNetworkItem(); - - /** - * This customize the return value of type() - */ - enum - { - Type = UserType + 20 - }; - - /** - * Reimplementation from QGraphicsItem - * \return the type of the item as int - */ - int type() const; - - /** - * Add a port to the item. - */ - void addInputPort( WQtNetworkInputPort *inPort ); - - /** - * Add a port to the item. - */ - void addOutputPort( WQtNetworkOutputPort *outPort ); - - /** - * Returns the item inports. - * \return the item inports - */ - QList< WQtNetworkInputPort *> getInPorts(); - - /** - * Returns the item outports - * \return the item outports - */ - QList< WQtNetworkOutputPort *> getOutPorts(); - - /** - * This method aligns the in- and outports as well as the modulename - * in a regular way. - */ - void fitLook(); - - /** - * Set the QGraphicsTextItem ( the caption ) of the item - * - * \param text the caption - */ - void setTextItem( QGraphicsTextItem *text ); - - /** - * Get the caption as QString - * - * \return the caption. - */ - QString getText(); - - /** - * Get the WModule represented by this object. - * \return the related WModule - */ - boost::shared_ptr< WModule > getModule(); - - /** - * Here the module can be enabled when the WModule is ready. - * \param active true if module is ready. - */ - void activate( bool active ); - - /** - * calculate new forces to layout the WQtNetworkItems in the - * WQtNetworkScene. - */ - void calculateForces(); - - /** - * Check if new calculated position is different from current. If yes - * the ne position is set and all connected WQtNetworkArrow are updated. - * - * \return true if items position has changed - */ - bool advance(); - - protected: - - /** - * If the item is changed we want to get notified. - * - * \param change - * \param value - * \return - */ - QVariant itemChange( GraphicsItemChange change, const QVariant &value ); - - /** - * If the WQtNetworkItem is moved, then the contained ports have to update - * the connected WQtNetworkArrows for correct alignment. - * - * \param mouseEvent the mouse event - */ - void mouseMoveEvent( QGraphicsSceneMouseEvent *mouseEvent ); - - /** - * If the cursor enters the item, the item gets a green color. - * - * \param event the hover event - */ - void hoverEnterEvent( QGraphicsSceneHoverEvent *event ); - - /** - * If the cursor leaves the item, the item gets his default color. - * - * \param event the hover event - */ - void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ); - - /** - * This method changes the coloration of gradient. - * - * \param color the choosen color - */ - void changeColor( QColor color ); - - /** - * Draw some customized stuff in the scene. - * - * \param painter - * \param option - * \param w - */ - void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w ); - - - private: - - boost::shared_ptr< WModule > m_module; //!< the module - - QList< WQtNetworkInputPort *> m_inPorts; //!< the input ports of the item - - QList< WQtNetworkOutputPort *> m_outPorts; //!< the output ports of the item - - QLinearGradient m_gradient; //!< the gradient for a nice coloring of the item - - QColor m_color; //!< the current color - - QRectF m_rect; //!< the size of the items rect - - float m_width; //!< the width of the rect - - float m_height; //!< the height of the rect - - QGraphicsTextItem *m_text; //!< the caption - - QPointF m_newPos; //!< the new position in the WQtNetworkScene - - WQtNetworkEditor *m_networkEditor; //!< the related WQtNetworkEditor +public: + /** + * Constructs new item in the network scene. + * + * \param editor the editor containing this item + * \param module the module represented by the item + */ + WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WModule > module ); + + /** + * Destructor. + */ + virtual ~WQtNetworkItem(); + + /** + * This customize the return value of type() + */ + enum + { + Type = UserType + 20 + }; + + /** + * Reimplementation from QGraphicsItem + * \return the type of the item as int + */ + int type() const; + + /** + * Add a port to the item. + * + * \param inPort the input port + */ + void addInputPort( WQtNetworkInputPort* inPort ); + + /** + * Add a port to the item. + * + * \param outPort the output port + */ + void addOutputPort( WQtNetworkOutputPort* outPort ); + + /** + * Returns the item inports. + * \return the item inports + */ + QList< WQtNetworkInputPort* > getInPorts(); + + /** + * Returns the item outports + * \return the item outports + */ + QList< WQtNetworkOutputPort* > getOutPorts(); + + /** + * This method aligns the in- and outports as well as the modulename + * in a regular way. + */ + void fitLook(); + + /** + * Set the QGraphicsTextItem ( the caption ) of the item + * + * \param text the caption + */ + void setTextItem( QGraphicsTextItem* text ); + + /** + * Get the caption as QString + * + * \return the caption. + */ + QString getText(); + + /** + * Get the WModule represented by this object. + * \return the related WModule + */ + boost::shared_ptr< WModule > getModule(); + + /** + * Here the module can be enabled when the WModule is ready. + * \param active true if module is ready. + */ + void activate( bool active ); + + /** + * calculate new forces to layout the WQtNetworkItems in the + * WQtNetworkScene. + */ + void calculateForces(); + + /** + * Check if new calculated position is different from current. If yes + * the ne position is set and all connected WQtNetworkArrow are updated. + * + * \return true if items position has changed + */ + bool advance(); + +protected: + + /** + * If the item is changed we want to get notified. + * + * \param change + * \param value + * \return + */ + QVariant itemChange( GraphicsItemChange change, const QVariant& value ); + + /** + * If the WQtNetworkItem is moved, then the contained ports have to update + * the connected WQtNetworkArrows for correct alignment. + * + * \param mouseEvent the mouse event + */ + void mouseMoveEvent( QGraphicsSceneMouseEvent* mouseEvent ); + + /** + * If the cursor enters the item, the item gets a green color. + * + * \param event the hover event + */ + void hoverEnterEvent( QGraphicsSceneHoverEvent* event ); + + /** + * If the cursor leaves the item, the item gets his default color. + * + * \param event the hover event + */ + void hoverLeaveEvent( QGraphicsSceneHoverEvent* event ); + + /** + * This method changes the coloration of gradient. + * + * \param color the choosen color + */ + void changeColor( QColor color ); + + /** + * Draw some customized stuff in the scene. + * + * \param painter + * \param option + * \param w + */ + void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w ); + + +private: + + boost::shared_ptr< WModule > m_module; //!< the module + + QList< WQtNetworkInputPort* > m_inPorts; //!< the input ports of the item + + QList< WQtNetworkOutputPort* > m_outPorts; //!< the output ports of the item + + QLinearGradient m_gradient; //!< the gradient for a nice coloring of the item + + QColor m_color; //!< the current color + + QRectF m_rect; //!< the size of the items rect + + float m_width; //!< the width of the rect + + float m_height; //!< the height of the rect + + QGraphicsTextItem* m_text; //!< the caption + + QPointF m_newPos; //!< the new position in the WQtNetworkScene + + WQtNetworkEditor* m_networkEditor; //!< the related WQtNetworkEditor }; #endif // WQTNETWORKITEM_H diff --git a/src/gui/qt4/networkEditor/WQtNetworkOutputPort.h b/src/gui/qt4/networkEditor/WQtNetworkOutputPort.h index 54917744b7feee09c697951abb5350b4814c6dc3..d3576149adf9d6188142aeb93d000284a51d84e6 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkOutputPort.h +++ b/src/gui/qt4/networkEditor/WQtNetworkOutputPort.h @@ -40,119 +40,121 @@ class WQtNetworkArrow; */ class WQtNetworkOutputPort : public WQtNetworkPort { - public: - - /** - * Constructor - * - * \param connector a WModuleOutputConnector - */ - explicit WQtNetworkOutputPort( boost::shared_ptr connector ); - - /** - * Destructor - */ - ~WQtNetworkOutputPort(); - - /** - * This customize the return value of type() - */ - enum - { - Type = UserType + 12 - }; - - /** - * Reimplementation from QGraphicsItem - * \return the type of the item as int - */ - int type() const; - - /** - * Every Arrow connected with this port is updating its position in the - * scene. - */ - void updateArrows(); - - /** - * Removes a specific arrow - * \param arrow a specific arrow - */ - void removeArrow( WQtNetworkArrow *arrow ); - - /** - * Removes all connected arrows - */ - void removeArrows(); - - /** - * Calculates the position inside a item for each port to get a correct - * alignment - * \param size the total number of ports ( distinguished by in- and - * outport - * \param portNumber the number of the current port (distinguised by in- - * and outport - * \param rect the rect of the parent item - * \param inOut is it an in- or outport - */ - void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); - - /** - * Set the type of the port. - * \param type true if out / false if in - */ - void setOutPort( bool type ); - - /** - * Returns the porttype. - * \return is it a outport - */ - bool isOutPort(); - - /** - * Returns the Name. - * \return Name - */ - QString getPortName(); - - /** - * Set the Name - * \param str Name as string - */ - void setPortName( QString str ); - - /** - * Return the number of connections - * - * \return number of connections - */ - int getNumberOfArrows(); - - /** - * Returns the WModuleOutputConnecter that belongs to this object. - * \return a WModuleOutputConnector - */ - boost::shared_ptr getConnector(); - - /** - * Adds an arrow to the port - */ - void addArrow( WQtNetworkArrow *arrow ); - - /** - * Get a QList of all arrows connected to this port - * \return a QList of WQtNetworkArrows - */ - QList< WQtNetworkArrow *> getArrowList(); - - private: - - bool m_isOutPort; //!< is the port an outport - - QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows - - QString m_name; //!< the portname - - boost::shared_ptr m_connector; //!< the related WModuleInputConnector +public: + + /** + * Constructor + * + * \param connector a WModuleOutputConnector + */ + explicit WQtNetworkOutputPort( boost::shared_ptr connector ); + + /** + * Destructor + */ + ~WQtNetworkOutputPort(); + + /** + * This customize the return value of type() + */ + enum + { + Type = UserType + 12 + }; + + /** + * Reimplementation from QGraphicsItem + * \return the type of the item as int + */ + int type() const; + + /** + * Every Arrow connected with this port is updating its position in the + * scene. + */ + void updateArrows(); + + /** + * Removes a specific arrow + * \param arrow a specific arrow + */ + void removeArrow( WQtNetworkArrow *arrow ); + + /** + * Removes all connected arrows + */ + void removeArrows(); + + /** + * Calculates the position inside a item for each port to get a correct + * alignment + * \param size the total number of ports ( distinguished by in- and + * outport + * \param portNumber the number of the current port (distinguised by in- + * and outport + * \param rect the rect of the parent item + * \param outPort is it an in- or outport + */ + void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); + + /** + * Set the type of the port. + * \param type true if out / false if in + */ + void setOutPort( bool type ); + + /** + * Returns the porttype. + * \return is it a outport + */ + bool isOutPort(); + + /** + * Returns the Name. + * \return Name + */ + QString getPortName(); + + /** + * Set the Name + * \param str Name as string + */ + void setPortName( QString str ); + + /** + * Return the number of connections + * + * \return number of connections + */ + int getNumberOfArrows(); + + /** + * Returns the WModuleOutputConnecter that belongs to this object. + * \return a WModuleOutputConnector + */ + boost::shared_ptr getConnector(); + + /** + * Adds an arrow to the port + * + * \param arrow the arrow to add + */ + void addArrow( WQtNetworkArrow *arrow ); + + /** + * Get a QList of all arrows connected to this port + * \return a QList of WQtNetworkArrows + */ + QList< WQtNetworkArrow *> getArrowList(); + +private: + + bool m_isOutPort; //!< is the port an outport + + QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows + + QString m_name; //!< the portname + + boost::shared_ptr m_connector; //!< the related WModuleInputConnector }; #endif // WQTNETWORKOUTPUTPORT_H diff --git a/src/gui/qt4/networkEditor/WQtNetworkPort.h b/src/gui/qt4/networkEditor/WQtNetworkPort.h index f55801bccf24502ea17fefe4f2389acaf665feb8..93f6f632fdcb0b7c44324b57530047b607987026 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkPort.h +++ b/src/gui/qt4/networkEditor/WQtNetworkPort.h @@ -38,121 +38,123 @@ /** * Abstract class to distinguish between input- and output ports from a module. * This class handels if a connection between two ports is possible or not. - */ + */ class WQtNetworkPort : public QGraphicsRectItem { - public: - - WQtNetworkPort(); - - ~WQtNetworkPort(); - - /** - * Reimplementation from QGraphicsItem - * \return the type of the item as int - */ - virtual int type() const = 0; - - /** - * The position of every arrow connected with this port is updating its position in the - * scene. - */ - virtual void updateArrows() = 0; - - /** - * Removes a specific arrow. - * \param arrow an arrow - */ - virtual void removeArrow( WQtNetworkArrow *arrow ) = 0; - - /** - * Removes all connected arrows. - */ - virtual void removeArrows() = 0; - - /** - * Calculates the position inside a item for each port to get a correct - * alignment - * \param size the total number of ports ( distinguished by in- and - * outport - * \param portNumber the number of the current port (distinguised by in- - * and outport - * \param rect the rect of the parent item - * \param outPort is it an in- or outport - */ - void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); - - /** - * Set the type of the port. - * \param type true if out / false if in - */ - virtual void setOutPort( bool type ) = 0; - - /** - * Returns the porttype - true if outputport, false if inputport - * \return is it a outport? - */ - virtual bool isOutPort() = 0; - - /** - * Returns the portname. - * \return portname - */ - virtual QString getPortName() = 0; - - /** - * Set the Name - * \param str portname as string - */ - virtual void setPortName( QString str ) = 0; - - /** - * Return the number of connections - * - * \return number of connections - */ - virtual int getNumberOfArrows() = 0; - - /** - * Adds an arrow to the port - */ - virtual void addArrow( WQtNetworkArrow *arrow ) = 0; - - /** - * Get a QList of all arrows connected to this port - * - * \return a QList of WQtNetworkArrows - */ - virtual QList< WQtNetworkArrow *> getArrowList() = 0; - - protected: - - /** - * Start drawing an arrow temporary. - * - * \param mouseEvent the mouse event - */ - void mousePressEvent( QGraphicsSceneMouseEvent *mouseEvent ); - - /** - * Updates the temporary arrows endpoint. - * Arrow is colored green when connection possible, red if no connection - * is possible, or black when cursor doesent covers an WQtNetworkPort. - * - * \param mouseEvent the mouse event - */ - void mouseMoveEvent( QGraphicsSceneMouseEvent *mouseEvent ); - - /** - * Send a connect request to kernel when start- and endport are - * connectable - * - * \param mouseEvent the mouse event - */ - void mouseReleaseEvent( QGraphicsSceneMouseEvent *mouseEvent ); - - private: - - QGraphicsLineItem *line; //!< the temporary line when u connect two ports +public: + + WQtNetworkPort(); + + ~WQtNetworkPort(); + + /** + * Reimplementation from QGraphicsItem + * \return the type of the item as int + */ + virtual int type() const = 0; + + /** + * The position of every arrow connected with this port is updating its position in the + * scene. + */ + virtual void updateArrows() = 0; + + /** + * Removes a specific arrow. + * \param arrow an arrow + */ + virtual void removeArrow( WQtNetworkArrow *arrow ) = 0; + + /** + * Removes all connected arrows. + */ + virtual void removeArrows() = 0; + + /** + * Calculates the position inside a item for each port to get a correct + * alignment + * \param size the total number of ports ( distinguished by in- and + * outport + * \param portNumber the number of the current port (distinguised by in- + * and outport + * \param rect the rect of the parent item + * \param outPort is it an in- or outport + */ + void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); + + /** + * Set the type of the port. + * \param type true if out / false if in + */ + virtual void setOutPort( bool type ) = 0; + + /** + * Returns the porttype - true if outputport, false if inputport + * \return is it a outport? + */ + virtual bool isOutPort() = 0; + + /** + * Returns the portname. + * \return portname + */ + virtual QString getPortName() = 0; + + /** + * Set the Name + * \param str portname as string + */ + virtual void setPortName( QString str ) = 0; + + /** + * Return the number of connections + * + * \return number of connections + */ + virtual int getNumberOfArrows() = 0; + + /** + * Adds an arrow to the port + * + * \param arrow the arrow to add + */ + virtual void addArrow( WQtNetworkArrow* arrow ) = 0; + + /** + * Get a QList of all arrows connected to this port + * + * \return a QList of WQtNetworkArrows + */ + virtual QList< WQtNetworkArrow* > getArrowList() = 0; + +protected: + + /** + * Start drawing an arrow temporary. + * + * \param mouseEvent the mouse event + */ + void mousePressEvent( QGraphicsSceneMouseEvent *mouseEvent ); + + /** + * Updates the temporary arrows endpoint. + * Arrow is colored green when connection possible, red if no connection + * is possible, or black when cursor doesent covers an WQtNetworkPort. + * + * \param mouseEvent the mouse event + */ + void mouseMoveEvent( QGraphicsSceneMouseEvent *mouseEvent ); + + /** + * Send a connect request to kernel when start- and endport are + * connectable + * + * \param mouseEvent the mouse event + */ + void mouseReleaseEvent( QGraphicsSceneMouseEvent *mouseEvent ); + +private: + + QGraphicsLineItem *line; //!< the temporary line when you connect two ports }; #endif // WQTNETWORKPORT_H diff --git a/src/gui/qt4/networkEditor/WQtNetworkScene.h b/src/gui/qt4/networkEditor/WQtNetworkScene.h index bbed1a70cf8ce0de1b5421b600767c60ecb7721c..53eed13b009b1e989dc92855caddb6194978e57d 100644 --- a/src/gui/qt4/networkEditor/WQtNetworkScene.h +++ b/src/gui/qt4/networkEditor/WQtNetworkScene.h @@ -28,51 +28,58 @@ #include #include -class WQtNetworkScene : public QGraphicsScene +/** + * The scene containing the whole graph + */ +class WQtNetworkScene: public QGraphicsScene { - Q_OBJECT +Q_OBJECT - public: +public: - /** - * Constructor - */ - explicit WQtNetworkScene(); + /** + * Constructor + */ + explicit WQtNetworkScene(); - /** - * Destructor - */ - virtual ~WQtNetworkScene(); + /** + * Destructor + */ + virtual ~WQtNetworkScene(); - /** - * Set a fakeitem to the scene to avoid that groups of connected items - * or single items in the scene push away each other. - * - * \param the fakeitem - */ - void setFakeItem( QGraphicsItem *fake ); + /** + * Set a fakeitem to the scene to avoid that groups of connected items + * or single items in the scene push away each other. + * + * \param fake the fake item + */ + void setFakeItem( QGraphicsItem* fake ); - /** - * Return the fakeitem in the scene to calculate forces in a more - * beautiful way. - */ - QGraphicsItem* getFakeItem(); + /** + * Return the fakeitem in the scene to calculate forces in a more + * beautiful way. + */ + QGraphicsItem* getFakeItem(); - protected: +protected: - /** - * Emits a Signal to notify the WQtNetworkEditor to build a default WQtCombinerToolbar - */ - void mousePressEvent( QGraphicsSceneMouseEvent *mouseEvent ); + /** + * Emits a Signal to notify the WQtNetworkEditor to build a default WQtCombinerToolbar + * + * \param mouseEvent the mouse event + */ + void mousePressEvent( QGraphicsSceneMouseEvent* mouseEvent ); - /** - * Controls how to respond on key events. - * Current it only delets selected items. - */ - void keyPressEvent( QKeyEvent *keyEvent ); + /** + * Controls how to respond on key events. + * Current it only delets selected items. + * + * \param keyEvent the key press event + */ + void keyPressEvent( QKeyEvent* keyEvent ); - private: - - QGraphicsItem *m_fakeItem; //!< the fakeitem for the forcebased layout +private: + QGraphicsItem *m_fakeItem; //!< the fakeitem for the forcebased layout }; #endif // WQTNETWORKSCENE_H +