|
|
|
|
@@ -283,7 +283,7 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) {
|
|
|
|
|
|
|
|
|
|
int margin = 40;
|
|
|
|
|
int radius = 30;
|
|
|
|
|
int offset = scene.always_on_lateral || scene.conditional_experimental ? 25 : 0;
|
|
|
|
|
int offset = scene.always_on_lateral || scene.conditional_experimental || scene.road_name_ui ? 25 : 0;
|
|
|
|
|
if (alert.size == cereal::ControlsState::AlertSize::FULL) {
|
|
|
|
|
margin = 0;
|
|
|
|
|
radius = 0;
|
|
|
|
|
@@ -827,7 +827,7 @@ void AnnotatedCameraWidget::drawDriverState(QPainter &painter, const UIState *s)
|
|
|
|
|
|
|
|
|
|
// base icon
|
|
|
|
|
int offset = UI_BORDER_SIZE + btn_size / 2;
|
|
|
|
|
offset += alwaysOnLateral || conditionalExperimental ? 25 : 0;
|
|
|
|
|
offset += alwaysOnLateral || conditionalExperimental || roadNameUI ? 25 : 0;
|
|
|
|
|
int x = rightHandDM ? width() - offset : offset;
|
|
|
|
|
int y = height() - offset;
|
|
|
|
|
float opacity = dmActive ? 0.65 : 0.2;
|
|
|
|
|
@@ -1137,6 +1137,8 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
|
|
|
|
mapOpen = scene.map_open;
|
|
|
|
|
fullMapOpen = mapOpen && scene.full_map;
|
|
|
|
|
|
|
|
|
|
roadNameUI = scene.road_name_ui;
|
|
|
|
|
|
|
|
|
|
showDriverCamera = scene.show_driver_camera;
|
|
|
|
|
|
|
|
|
|
turnSignalLeft = scene.turn_signal_left;
|
|
|
|
|
@@ -1147,7 +1149,7 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
|
|
|
|
drawLeadInfo(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (alwaysOnLateral || conditionalExperimental) {
|
|
|
|
|
if (alwaysOnLateral || conditionalExperimental || roadNameUI) {
|
|
|
|
|
drawStatusBar(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1484,6 +1486,8 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) {
|
|
|
|
|
{15, "Experimental Mode activated for stop" + (mapOpen ? "" : QString(" sign / stop light"))},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QString roadName = roadNameUI ? QString::fromStdString(paramsMemory.get("RoadName")) : QString();
|
|
|
|
|
|
|
|
|
|
// Update status text
|
|
|
|
|
if (alwaysOnLateralActive) {
|
|
|
|
|
newStatus = QString("Always On Lateral active") + (mapOpen ? "" : ". Press the \"Cruise Control\" button to disable");
|
|
|
|
|
@@ -1506,8 +1510,8 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if status has changed
|
|
|
|
|
if (newStatus != lastShownStatus) {
|
|
|
|
|
// Check if status has changed or if the road name is empty
|
|
|
|
|
if (newStatus != lastShownStatus || roadName.isEmpty()) {
|
|
|
|
|
displayStatusText = true;
|
|
|
|
|
lastShownStatus = newStatus;
|
|
|
|
|
timer.restart();
|
|
|
|
|
@@ -1521,10 +1525,15 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) {
|
|
|
|
|
p.setRenderHint(QPainter::TextAntialiasing);
|
|
|
|
|
|
|
|
|
|
// Calculate text opacity
|
|
|
|
|
static qreal roadNameOpacity;
|
|
|
|
|
static qreal statusTextOpacity;
|
|
|
|
|
int elapsed = timer.elapsed();
|
|
|
|
|
if (displayStatusText) {
|
|
|
|
|
statusTextOpacity = qBound(0.0, 1.0 - (elapsed - textDuration) / fadeDuration, 1.0);
|
|
|
|
|
roadNameOpacity = 1.0 - statusTextOpacity;
|
|
|
|
|
} else {
|
|
|
|
|
roadNameOpacity = qBound(0.0, elapsed / fadeDuration, 1.0);
|
|
|
|
|
statusTextOpacity = 0.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Draw the status text
|
|
|
|
|
@@ -1533,6 +1542,14 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) {
|
|
|
|
|
textRect.moveBottom(statusBarRect.bottom() - 50);
|
|
|
|
|
p.drawText(textRect, Qt::AlignCenter | Qt::TextWordWrap, newStatus);
|
|
|
|
|
|
|
|
|
|
// Draw the road name with the calculated opacity
|
|
|
|
|
if (!roadName.isEmpty()) {
|
|
|
|
|
p.setOpacity(roadNameOpacity);
|
|
|
|
|
textRect = p.fontMetrics().boundingRect(statusBarRect, Qt::AlignCenter | Qt::TextWordWrap, roadName);
|
|
|
|
|
textRect.moveBottom(statusBarRect.bottom() - 50);
|
|
|
|
|
p.drawText(textRect, Qt::AlignCenter | Qt::TextWordWrap, roadName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
p.restore();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|