Commit 3da5ca1e authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[DOC][STYLE]

parent 376433b5
...@@ -46,117 +46,117 @@ class WQtNetworkInputPort; ...@@ -46,117 +46,117 @@ class WQtNetworkInputPort;
*/ */
class WQtNetworkArrow : public QGraphicsLineItem class WQtNetworkArrow : public QGraphicsLineItem
{ {
public: public:
/** /**
* This customize the return value of type() * This customize the return value of type()
*/ */
enum enum
{ {
Type = UserType + 4 Type = UserType + 4
}; };
/** /**
* Constructor * Constructor
* *
* \param outPort the outputport that provide the data * \param outPort the outputport that provide the data
* \param inPort the inputport that recive the data * \param inPort the inputport that recive the data
*/ */
explicit WQtNetworkArrow( WQtNetworkOutputPort *outPort, WQtNetworkInputPort *inPort ); explicit WQtNetworkArrow( WQtNetworkOutputPort *outPort, WQtNetworkInputPort *inPort );
/** /**
* Destructor * Destructor
*/ */
~WQtNetworkArrow(); ~WQtNetworkArrow();
/** /**
* Reimplementation from QGraphicsItem * Reimplementation from QGraphicsItem
* \return the type of the item as int * \return the type of the item as int
*/ */
int type() const; int type() const;
/** /**
* Calculated the new position of the lines endpoints in the scene. * Calculated the new position of the lines endpoints in the scene.
* Is called everytime the parentItem is changed or after construction. * Is called everytime the parentItem is changed or after construction.
*/ */
void updatePosition(); void updatePosition();
/** /**
* Returns the WQtNetworkOutputPort where the arrow starts. * Returns the WQtNetworkOutputPort where the arrow starts.
*\return the WQtNetworkInputPort where the connection starts *\return the WQtNetworkInputPort where the connection starts
*/ */
WQtNetworkOutputPort* getStartPort(); WQtNetworkOutputPort* getStartPort();
/** /**
* Returns the WQtNetworkInputPort where the arrow ends. * Returns the WQtNetworkInputPort where the arrow ends.
*\return the WQtNetworkInputPort where the connection ends *\return the WQtNetworkInputPort where the connection ends
*/ */
WQtNetworkInputPort* getEndPort(); WQtNetworkInputPort* getEndPort();
/** /**
* Reimplementation form QGraphicsItem, because the arrowhead is added * Reimplementation form QGraphicsItem, because the arrowhead is added
* to the line. Its needed that QGraphicsView knows which area needs to * to the line. Its needed that QGraphicsView knows which area needs to
* be redrawn. * be redrawn.
* \return a QRectF that bounds the drawn object * \return a QRectF that bounds the drawn object
*/ */
QRectF boundingRect() const; QRectF boundingRect() const;
/** /**
* Reimplementation from QGraphicsItem. * Reimplementation from QGraphicsItem.
* Return the shape of this item as a QPainterPath in local coordinates * Return the shape of this item as a QPainterPath in local coordinates
* \return shape as QPainterPath of this object * \return shape as QPainterPath of this object
*/ */
QPainterPath shape() const; QPainterPath shape() const;
/** /**
* If the item is changed we want to get notified. * If the item is changed we want to get notified.
* *
* \param change * \param change
* \param value * \param value
* \return * \return
*/ */
QVariant itemChange( GraphicsItemChange change, const QVariant &value ); QVariant itemChange( GraphicsItemChange change, const QVariant &value );
protected: protected:
/** /**
* Draw some customized stuff in the scene. * Draw some customized stuff in the scene.
* *
* \param painter * \param painter
* \param option * \param option
* \param w * \param w
*/ */
void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w ); void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* w );
/** /**
* If the cursor enters the arrow, the arrow becomes geen. * If the cursor enters the arrow, the arrow becomes geen.
* *
* \param event the hover event * \param event the hover event
*/ */
void hoverEnterEvent( QGraphicsSceneHoverEvent * event ); void hoverEnterEvent( QGraphicsSceneHoverEvent * event );
/** /**
* If the cursor leaves the arrow, the arrow gets his default color. * If the cursor leaves the arrow, the arrow gets his default color.
* *
* \param event the hover event * \param event the hover event
*/ */
void hoverLeaveEvent( QGraphicsSceneHoverEvent * event ); void hoverLeaveEvent( QGraphicsSceneHoverEvent * event );
private: private:
/** /**
* This method changes the color of the arrow. * This method changes the color of the arrow.
* *
* \param color the choosen color * \param color the choosen color
*/ */
void changeColor( QColor color ); void changeColor( QColor color );
WQtNetworkOutputPort *m_startPort; //!< the start port WQtNetworkOutputPort *m_startPort; //!< the start port
WQtNetworkInputPort *m_endPort; //!< the end port WQtNetworkInputPort *m_endPort; //!< the end port
QColor m_color; //!< the current color QColor m_color; //!< the current color
QPolygonF arrowHead; //!< the arrowhead QPolygonF arrowHead; //!< the arrowhead
}; };
#endif // WQTNETWORKARROW_H #endif // WQTNETWORKARROW_H
...@@ -55,7 +55,6 @@ public: ...@@ -55,7 +55,6 @@ public:
/** /**
* default constructor * default constructor
* *
* \param title Title will be displayed above the widget
* \param parent The widget that manages this widget * \param parent The widget that manages this widget
*/ */
explicit WQtNetworkEditor( WMainWindow* parent = 0 ); explicit WQtNetworkEditor( WMainWindow* parent = 0 );
...@@ -67,7 +66,7 @@ public: ...@@ -67,7 +66,7 @@ public:
/** /**
* Create a new WQtNetworkItem for a given WModule * Create a new WQtNetworkItem for a given WModule
* \param a new WModule * \param module a new WModule
*/ */
void addModule( boost::shared_ptr< WModule > module ); void addModule( boost::shared_ptr< WModule > module );
...@@ -100,20 +99,18 @@ protected: ...@@ -100,20 +99,18 @@ protected:
/** /**
* Everytime a module is associated, ready, connected, disconnected, removed or * Everytime a module is associated, ready, connected, disconnected, removed or
* deleted the kernels emits a signal and here we look how to behave. * 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 ); 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 * 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. * 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: private:
......
...@@ -37,120 +37,122 @@ class WQtNetworkArrow; ...@@ -37,120 +37,122 @@ class WQtNetworkArrow;
/** /**
* This class represents the ports a module have. Two ports from different * This class represents the ports a module have. Two ports from different
* modules can be connected by the corresponding ports. * modules can be connected by the corresponding ports.
*/ */
class WQtNetworkInputPort : public WQtNetworkPort class WQtNetworkInputPort : public WQtNetworkPort
{ {
public: public:
/** /**
* Constructor * Constructor
* \param connector the related WModuleInputConnector * \param connector the related WModuleInputConnector
*/ */
explicit WQtNetworkInputPort( boost::shared_ptr<WModuleInputConnector> connector ); explicit WQtNetworkInputPort( boost::shared_ptr<WModuleInputConnector> connector );
/** /**
* Destructor * Destructor
*/ */
~WQtNetworkInputPort(); ~WQtNetworkInputPort();
/** /**
* This customize the return value of type() * This customize the return value of type()
*/ */
enum enum
{ {
Type = UserType + 11 Type = UserType + 11
}; };
/** /**
* Reimplementation from QGraphicsItem * Reimplementation from QGraphicsItem
* \return the type of the item as int * \return the type of the item as int
*/ */
int type() const; int type() const;
/** /**
* Every Arrow connected with this port is updating its position in the * Every Arrow connected with this port is updating its position in the
* scene. * scene.
*/ */
void updateArrows(); void updateArrows();
/** /**
* Removes a specific arrow * Removes a specific arrow
* \param arrow an arrow * \param arrow an arrow
*/ */
void removeArrow( WQtNetworkArrow *arrow ); void removeArrow( WQtNetworkArrow *arrow );
/** /**
* Removes all connected arrows * Removes all connected arrows
*/ */
void removeArrows(); void removeArrows();
/** /**
* Calculates the position inside a item for each port to get a correct * Calculates the position inside a item for each port to get a correct
* alignment * alignment
* \param size the total number of ports ( distinguished by in- and * \param size the total number of ports ( distinguished by in- and
* outport * outport
* \param portNumber the number of the current port (distinguised by in- * \param portNumber the number of the current port (distinguised by in-
* and outport * and outport
* \param rect the rect of the parent item * \param rect the rect of the parent item
* \param inOut is it an in- or outport * \param outPort is it an in- or outport
*/ */
void alignPosition( int size, int portNumber, QRectF rect, bool outPort ); void alignPosition( int size, int portNumber, QRectF rect, bool outPort );
/** /**
* Set the type of the port. * Set the type of the port.
* \param type true if out / false if in * \param type true if out / false if in
*/ */
void setOutPort( bool type ); void setOutPort( bool type );
/** /**
* Returns the porttype. * Returns the porttype.
* \return is it a outport * \return is it a outport
*/ */
bool isOutPort(); bool isOutPort();
/** /**
* Returns the Name. * Returns the Name.
* \return Name * \return Name
*/ */
QString getPortName(); QString getPortName();
/** /**
* Set the Name * Set the Name
* \param str Name as string * \param str Name as string
*/ */
void setPortName( QString str ); void setPortName( QString str );
/** /**
* Return the number of connections * Return the number of connections
* \return number of connections * \return number of connections
*/ */
int getNumberOfArrows(); int getNumberOfArrows();
/** /**
* Returns the WModuleInputConnecter that belongs to this object. * Returns the WModuleInputConnecter that belongs to this object.
* \return a WModuleInputConnector * \return a WModuleInputConnector
*/ */
boost::shared_ptr<WModuleInputConnector> getConnector(); boost::shared_ptr<WModuleInputConnector> getConnector();
/** /**
* Adds an arrow to the port * Adds an arrow to the port
*/ *
void addArrow( WQtNetworkArrow *arrow ); * \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 /**
*/ * Get a QList of all arrows connected to this port
QList< WQtNetworkArrow *> getArrowList(); * \return a QList of WQtNetworkArrows
*/
private: QList< WQtNetworkArrow *> getArrowList();
bool m_isOutPort; //!< is the port an outport private:
QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows bool m_isOutPort; //!< is the port an outport
QString m_name; //!< the portname QList< WQtNetworkArrow *> m_arrows; //!< the connected arrows
boost::shared_ptr<WModuleInputConnector> m_connector; //!< the related WModuleInputConnector QString m_name; //!< the portname
boost::shared_ptr<WModuleInputConnector> m_connector; //!< the related WModuleInputConnector
}; };
#endif // WQTNETWORKINPUTPORT_H #endif // WQTNETWORKINPUTPORT_H
...@@ -43,171 +43,178 @@ class QGraphicsWidget; ...@@ -43,171 +43,178 @@ class QGraphicsWidget;
*/ */
class WQtNetworkItem : public QGraphicsRectItem class WQtNetworkItem : public QGraphicsRectItem
{ {
public: public:
/** /**
* Constructor of the item. * Constructs new item in the network scene.
*/ *
explicit WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WModule > module ); * \param editor the editor containing this item
* \param module the module represented by the item
/** */
* Destructor. WQtNetworkItem( WQtNetworkEditor *editor, boost::shared_ptr< WModule > module );
*/
virtual ~WQtNetworkItem(); /**
* Destructor.
/** */
* This customize the return value of type() virtual ~WQtNetworkItem();
*/
enum /**
{ * This customize the return value of type()
Type = UserType + 20 */
}; enum
{
/** Type = UserType + 20
* Reimplementation from QGraphicsItem };
* \return the type of the item as int
*/ /**
int type() const; * Reimplementation from QGraphicsItem
* \return the type of the item as int
/** */
* Add a port to the item. int type() const;
*/
void addInputPort( WQtNetworkInputPort *inPort ); /**
* Add a port to the item.
/** *
* Add a port to the item. * \param inPort the input port
*/ */
void addOutputPort( WQtNetworkOutputPort *outPort ); void addInputPort( WQtNetworkInputPort* inPort );
/** /**
* Returns the item inports. * Add a port to the item.
* \return the item inports *
*/ * \param outPort the output port
QList< WQtNetworkInputPort *> getInPorts(); */
void addOutputPort( WQtNetworkOutputPort* outPort );
/**
* Returns the item outports /**
* \return the item outports * Returns the item inports.
*/ * \return the item inports
QList< WQtNetworkOutputPort *> getOutPorts(); */
QList< WQtNetworkInputPort* > getInPorts();
/**
* This method aligns the in- and outports as well as the modulename /**
* in a regular way. * Returns the item outports
*/ * \return the item outports
void fitLook(); */
QList< WQtNetworkOutputPort* > getOutPorts();
/**
* Set the QGraphicsTextItem ( the caption ) of the item /**
* * This method aligns the in- and outports as well as the modulename
* \param text the caption * in a regular way.
*/ */
void setTextItem( QGraphicsTextItem *text ); void fitLook();
/** /**
* Get the caption as QString * Set the QGraphicsTextItem ( the caption ) of the item
* *
* \return the caption. * \param text the caption
*/ */
QString getText(); void setTextItem( QGraphicsTextItem* text );