Skip to content

Commit 2482ef0

Browse files
committed
[ADDITIVE] Make HW design connections theme aware
1 parent b6a1ad3 commit 2482ef0

6 files changed

Lines changed: 14 additions & 4 deletions

File tree

KactusAPI/include/KactusColors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ namespace KactusColors
7676
extern KACTUS2_API QColor MONITOR_INTERFACE;
7777
extern KACTUS2_API QColor INVALID_INTERFACE; // The interface is somehow invalid, eg. lacks a mode or type.
7878
extern KACTUS2_API QColor ENDPOINT_TYPE_API; // The interface is for API connections.
79+
extern KACTUS2_API QColor ADHOC_PORT;
7980

8081
//! Colors used in component instances.
8182
extern KACTUS2_API QColor MISSING_COMPONENT; // The component of the instance does not exist.

KactusAPI/utilities/KactusColors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ QColor KactusColors::MIRROREDSYSTEM_INTERFACE = QColor(201, 189, 233);
6565
QColor KactusColors::MONITOR_INTERFACE = QColor(0xfd, 0xfd, 0xfd);
6666
QColor KactusColors::INVALID_INTERFACE = ERROR_COLOR; // The interface is somehow invalid, eg. lacks a mode or type.
6767
QColor KactusColors::ENDPOINT_TYPE_API = QColor(0xcb, 0xfd, 0xfd); // The interface is for API connections.
68+
QColor KactusColors::ADHOC_PORT = QColor(Qt::black);
6869

6970
//! Colors used in component instances.
7071
QColor KactusColors::MISSING_COMPONENT = QColor(240, 180, 180); // The component of the instance does not exist.

common/KactusUtils.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ void KactusUtils::applyThemeToPalette()
112112
// Set colors for HW design
113113
KactusColors::DIAGRAM_GRID = palette.windowText().color().darker(250);
114114
KactusColors::REGULAR_CONNECTION = QColor(Qt::white).darker(150);
115+
KactusColors::ADHOC_PORT = KactusColors::REGULAR_CONNECTION;
115116
KactusColors::HW_COMPONENT = KactusColors::HW_COMPONENT.darker(175);
116117
KactusColors::HW_BUS_COMPONENT = KactusColors::HW_BUS_COMPONENT.darker(125);
117118
KactusColors::DIAGRAM_COLUMN_HEADER = KactusColors::DIAGRAM_COLUMN_HEADER.darker(175);
119+
KactusColors::CONNECTION_UNDERCROSSING = KactusColors::CONNECTION_UNDERCROSSING.darker(150);
118120

119121
KactusColors::DOCK_WIDGET_TITLE_BG = KactusColors::DEFAULT_WINDOW_BG.lighter(150);
120122
KactusColors::TABLE_GRIDLINE = KactusColors::DOCK_WIDGET_TITLE_BG;

common/graphicsItems/GraphicsConnection.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ GraphicsConnection::GraphicsConnection(QPointF const& p1, QVector2D const& dir1,
8181
{
8282
setItemSettings();
8383
pathPoints_ = DefaultRouting::createRoute(p1, p2, dir1, dir2);
84-
setRoute(pathPoints_);
84+
setRoute(pathPoints_);
85+
setDefaultColor();
8586
}
8687

8788
//-----------------------------------------------------------------------------
@@ -907,12 +908,12 @@ void GraphicsConnection::drawOverlapWithConnection(QPainter* painter, GraphicsCo
907908
//-----------------------------------------------------------------------------
908909
void GraphicsConnection::drawJunctionPoint(QPainter* painter, QPointF const& intersectionPoint)
909910
{
910-
painter->setPen(QPen(Qt::black, 0));
911+
painter->setPen(QPen(KactusColors::REGULAR_CONNECTION, 0));
911912

912913
QPainterPath circlePath;
913914
circlePath.addEllipse(intersectionPoint, 5.0, 5.0);
914915

915-
painter->fillPath(circlePath, QBrush(Qt::black));
916+
painter->fillPath(circlePath, QBrush(KactusColors::REGULAR_CONNECTION));
916917
}
917918

918919
//-----------------------------------------------------------------------------

editors/HWDesign/AdHocItem.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <editors/common/DesignDiagram.h>
1717
#include <editors/common/GraphicsItemLabel.h>
1818

19+
#include <KactusAPI/include/KactusColors.h>
20+
1921
#include <QPen>
2022
#include <QFont>
2123
#include <QGraphicsDropShadowEffect>
@@ -116,7 +118,7 @@ void AdHocItem::updateEndPointGraphics()
116118
{
117119
if (adhocPortIsValid())
118120
{
119-
setBrush(QBrush(Qt::black));
121+
setBrush(QBrush(KactusColors::ADHOC_PORT));
120122
}
121123
else
122124
{

editors/HWDesign/OffPageConnectorItem.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include <IPXACTmodels/Component/BusInterface.h>
2020

21+
#include <KactusAPI/include/KactusColors.h>
22+
2123
#include <QBrush>
2224
#include <QPen>
2325

@@ -43,6 +45,7 @@ parent_(parent)
4345
line->setFlag(ItemStacksBehindParent);
4446

4547
QPen newPen = line->pen();
48+
newPen.setColor(KactusColors::REGULAR_CONNECTION);
4649
newPen.setWidth(3);
4750
line->setPen(newPen);
4851

0 commit comments

Comments
 (0)