Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3da5ca1e
Commit
3da5ca1e
authored
Feb 22, 2011
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DOC][STYLE]
parent
376433b5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
681 additions
and
664 deletions
+681
-664
src/gui/qt4/networkEditor/WQtNetworkArrow.h
src/gui/qt4/networkEditor/WQtNetworkArrow.h
+112
-112
src/gui/qt4/networkEditor/WQtNetworkEditor.h
src/gui/qt4/networkEditor/WQtNetworkEditor.h
+6
-9
src/gui/qt4/networkEditor/WQtNetworkInputPort.h
src/gui/qt4/networkEditor/WQtNetworkInputPort.h
+115
-113
src/gui/qt4/networkEditor/WQtNetworkItem.h
src/gui/qt4/networkEditor/WQtNetworkItem.h
+173
-166
src/gui/qt4/networkEditor/WQtNetworkOutputPort.h
src/gui/qt4/networkEditor/WQtNetworkOutputPort.h
+116
-114
src/gui/qt4/networkEditor/WQtNetworkPort.h
src/gui/qt4/networkEditor/WQtNetworkPort.h
+116
-114
src/gui/qt4/networkEditor/WQtNetworkScene.h
src/gui/qt4/networkEditor/WQtNetworkScene.h
+43
-36
No files found.
src/gui/qt4/networkEditor/WQtNetworkArrow.h
View file @
3da5ca1e
...
...
@@ -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
src/gui/qt4/networkEditor/WQtNetworkEditor.h
View file @
3da5ca1e
...
...
@@ -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:
...
...
src/gui/qt4/networkEditor/WQtNetworkInputPort.h
View file @
3da5ca1e
...
...
@@ -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
<
WModuleInputConnector
>
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
<
WModuleInputConnector
>
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
<
WModuleInputConnector
>
m_connector
;
//!< the related WModuleInputConnector
public:
/**
* Constructor
* \param connector the related WModuleInputConnector
*/
explicit
WQtNetworkInputPort
(
boost
::
shared_ptr
<
WModuleInputConnector
>
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
<
WModuleInputConnector
>
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
<
WModuleInputConnector
>
m_connector
;
//!< the related WModuleInputConnector
};
#endif // WQTNETWORKINPUTPORT_H
src/gui/qt4/networkEditor/WQtNetworkItem.h
View file @
3da5ca1e
...
...
@@ -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