|
|
|
@ -196,6 +196,7 @@ void NvgWindow::updateState(const UIState &s) { |
|
|
|
|
setProperty("has_eu_speed_limit", nav_alive && speed_limit_sign == cereal::NavInstruction::SpeedLimitSign::VIENNA); |
|
|
|
|
|
|
|
|
|
setProperty("is_cruise_set", cruise_set); |
|
|
|
|
setProperty("is_metric", s.scene.is_metric); |
|
|
|
|
setProperty("speed", cur_speed); |
|
|
|
|
setProperty("setSpeed", set_speed); |
|
|
|
|
setProperty("speedUnit", s.scene.is_metric ? "km/h" : "mph"); |
|
|
|
@ -225,8 +226,8 @@ void NvgWindow::drawHud(QPainter &p) { |
|
|
|
|
// Draw outer box + border to contain set speed and speed limit
|
|
|
|
|
int default_rect_width = 172; |
|
|
|
|
int rect_width = default_rect_width; |
|
|
|
|
if (is_metric || has_eu_speed_limit) rect_width = 200; |
|
|
|
|
if (has_us_speed_limit && speedLimitStr.size() >= 3) rect_width = 223; |
|
|
|
|
else if (has_eu_speed_limit) rect_width = 200; |
|
|
|
|
|
|
|
|
|
int rect_height = 204; |
|
|
|
|
if (has_us_speed_limit) rect_height = 402; |
|
|
|
@ -240,26 +241,6 @@ void NvgWindow::drawHud(QPainter &p) { |
|
|
|
|
p.setBrush(blackColor(166)); |
|
|
|
|
drawRoundedRect(p, set_speed_rect, top_radius, top_radius, bottom_radius, bottom_radius); |
|
|
|
|
|
|
|
|
|
// Draw set speed
|
|
|
|
|
if (is_cruise_set) { |
|
|
|
|
if (speedLimit > 0 && status != STATUS_DISENGAGED && status != STATUS_OVERRIDE) { |
|
|
|
|
p.setPen(interpColor( |
|
|
|
|
setSpeed, |
|
|
|
|
{speedLimit + 5, speedLimit + 15, speedLimit + 25}, |
|
|
|
|
{whiteColor(), QColor(0xff, 0x95, 0x00, 0xff), QColor(0xff, 0x00, 0x00, 0xff)} |
|
|
|
|
)); |
|
|
|
|
} else { |
|
|
|
|
p.setPen(whiteColor()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
p.setPen(QColor(0x72, 0x72, 0x72, 0xff)); |
|
|
|
|
} |
|
|
|
|
configFont(p, "Open Sans", 90, "Bold"); |
|
|
|
|
QRect speed_rect = getTextRect(p, Qt::AlignCenter, setSpeedStr); |
|
|
|
|
speed_rect.moveCenter({set_speed_rect.center().x(), 0}); |
|
|
|
|
speed_rect.moveTop(set_speed_rect.top() + 8); |
|
|
|
|
p.drawText(speed_rect, Qt::AlignCenter, setSpeedStr); |
|
|
|
|
|
|
|
|
|
// Draw MAX
|
|
|
|
|
if (is_cruise_set) { |
|
|
|
|
if (status == STATUS_DISENGAGED) { |
|
|
|
@ -281,9 +262,31 @@ void NvgWindow::drawHud(QPainter &p) { |
|
|
|
|
configFont(p, "Open Sans", 40, "SemiBold"); |
|
|
|
|
QRect max_rect = getTextRect(p, Qt::AlignCenter, "MAX"); |
|
|
|
|
max_rect.moveCenter({set_speed_rect.center().x(), 0}); |
|
|
|
|
max_rect.moveTop(set_speed_rect.top() + 123); |
|
|
|
|
max_rect.moveTop(set_speed_rect.top() + 23); |
|
|
|
|
p.drawText(max_rect, Qt::AlignCenter, "MAX"); |
|
|
|
|
|
|
|
|
|
// Draw set speed
|
|
|
|
|
if (is_cruise_set) { |
|
|
|
|
if (speedLimit > 0 && status != STATUS_DISENGAGED && status != STATUS_OVERRIDE) { |
|
|
|
|
p.setPen(interpColor( |
|
|
|
|
setSpeed, |
|
|
|
|
{speedLimit + 5, speedLimit + 15, speedLimit + 25}, |
|
|
|
|
{whiteColor(), QColor(0xff, 0x95, 0x00, 0xff), QColor(0xff, 0x00, 0x00, 0xff)} |
|
|
|
|
)); |
|
|
|
|
} else { |
|
|
|
|
p.setPen(whiteColor()); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
p.setPen(QColor(0x72, 0x72, 0x72, 0xff)); |
|
|
|
|
} |
|
|
|
|
configFont(p, "Open Sans", 90, "Bold"); |
|
|
|
|
QRect speed_rect = getTextRect(p, Qt::AlignCenter, setSpeedStr); |
|
|
|
|
speed_rect.moveCenter({set_speed_rect.center().x(), 0}); |
|
|
|
|
speed_rect.moveTop(set_speed_rect.top() + 67); |
|
|
|
|
p.drawText(speed_rect, Qt::AlignCenter, setSpeedStr); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// US/Canada (MUTCD style) sign
|
|
|
|
|
if (has_us_speed_limit) { |
|
|
|
|
const int border_width = 6; |
|
|
|
|