Skip to content

Commit

Permalink
Change flash button border to red when overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
Wazzledi committed Jan 5, 2024
1 parent fb559e8 commit c984fc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion qmlui/qml/virtualconsole/VCButtonItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ VCWidgetItem

property int btnState: buttonObj ? buttonObj.state : VCButton.Inactive
property int btnAction: buttonObj ? buttonObj.actionType : VCButton.Toggle
property string activeColor: buttonObj.flashOverrides || buttonObj.flashForceLTP ? "#FF0000" : "#00FF00"

radius: 4

Expand Down Expand Up @@ -76,7 +77,7 @@ VCWidgetItem
height: parent.height - 2
color: "transparent"
border.width: (buttonRoot.width > 80) ? 3 : 2
border.color: btnState === VCButton.Active ? "#00FF00" : btnState === VCButton.Monitoring ? "orange" : "#A0A0A0"
border.color: btnState === VCButton.Active ? activeColor : btnState === VCButton.Monitoring ? "orange" : "#A0A0A0"
radius: 3

Rectangle
Expand Down
14 changes: 12 additions & 2 deletions ui/src/virtualconsole/vcbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,12 @@ void VCButton::paintEvent(QPaintEvent* e)
painter.setPen(QPen(QColor(160, 160, 160, 255), 2));

if (state() == Active)
painter.setBrush(QBrush(QColor(0, 230, 0, 255)));
{
if(m_flashForceLTP || m_flashOverrides)
painter.setBrush(QBrush(QColor(230, 0, 0, 255)));
else
painter.setBrush(QBrush(QColor(0, 230, 0, 255)));
}
else if (state() == Monitoring)
painter.setBrush(QBrush(QColor(255, 170, 0, 255)));
else
Expand All @@ -1141,7 +1146,12 @@ void VCButton::paintEvent(QPaintEvent* e)
if (state() == Monitoring)
painter.setPen(QPen(QColor(255, 170, 0, 255), borderWidth));
else
painter.setPen(QPen(QColor(0, 230, 0, 255), borderWidth));
{
if(m_flashForceLTP || m_flashOverrides)
painter.setPen(QPen(QColor(230, 0, 0, 255), borderWidth));
else
painter.setPen(QPen(QColor(0, 230, 0, 255), borderWidth));
}
painter.drawRoundedRect(borderWidth, borderWidth,
rect().width() - borderWidth * 2, rect().height() - (borderWidth * 2),
borderWidth, borderWidth);
Expand Down

0 comments on commit c984fc4

Please sign in to comment.