Display the current road's name
This commit is contained in:
@@ -147,6 +147,7 @@ void FrogPilotAnnotatedCameraWidget::updateState(const UIState &s, const FrogPil
|
||||
cscTraining = frogpilotPlan.getCscTraining();
|
||||
experimentalMode = selfdriveState.getExperimentalMode();
|
||||
roadCurvature = frogpilotPlan.getRoadCurvature();
|
||||
roadName = QString::fromStdString(params_memory.get("RoadName"));
|
||||
|
||||
hideBottomIcons = selfdriveState.getAlertSize() != cereal::SelfdriveState::AlertSize::NONE;
|
||||
hideBottomIcons |= frogpilotSelfdriveState.getAlertSize() != cereal::FrogPilotSelfdriveState::AlertSize::NONE;
|
||||
@@ -203,6 +204,10 @@ void FrogPilotAnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p, UIState
|
||||
}
|
||||
}
|
||||
|
||||
if (frogpilot_toggles.value("road_name_ui").toBool()) {
|
||||
paintRoadName(p);
|
||||
}
|
||||
|
||||
if ((blinkerLeft || blinkerRight) && signalStyle != "None") {
|
||||
paintTurnSignals(p);
|
||||
}
|
||||
@@ -418,6 +423,32 @@ void FrogPilotAnnotatedCameraWidget::paintCurveSpeedControlTraining(QPainter &p)
|
||||
p.restore();
|
||||
}
|
||||
|
||||
void FrogPilotAnnotatedCameraWidget::paintRoadName(QPainter &p) {
|
||||
if (roadName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
p.save();
|
||||
|
||||
QFont font = InterFont(40, QFont::DemiBold);
|
||||
|
||||
int textWidth = QFontMetrics(font).horizontalAdvance(roadName);
|
||||
|
||||
QSize size(textWidth + 100, 50);
|
||||
QRect roadNameRect = QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter | Qt::AlignBottom, size, rect().adjusted(0, 0, 0, -5));
|
||||
|
||||
p.setBrush(blackColor(166));
|
||||
p.setOpacity(1.0);
|
||||
p.setPen(QPen(blackColor(), 10));
|
||||
p.drawRoundedRect(roadNameRect, 24, 24);
|
||||
|
||||
p.setFont(font);
|
||||
p.setPen(QPen(whiteColor(), 6));
|
||||
p.drawText(roadNameRect, Qt::AlignCenter, roadName);
|
||||
|
||||
p.restore();
|
||||
}
|
||||
|
||||
void FrogPilotAnnotatedCameraWidget::paintTurnSignals(QPainter &p) {
|
||||
int frameIndex = qBound(0, animationFrameIndex, totalFrames - 1);
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ private:
|
||||
void paintCompass(QPainter &p);
|
||||
void paintCurveSpeedControl(QPainter &p);
|
||||
void paintCurveSpeedControlTraining(QPainter &p);
|
||||
void paintRoadName(QPainter &p);
|
||||
void paintTurnSignals(QPainter &p);
|
||||
void updateSignals();
|
||||
|
||||
@@ -99,6 +100,7 @@ private:
|
||||
|
||||
QString leadDistanceUnit;
|
||||
QString leadSpeedUnit;
|
||||
QString roadName;
|
||||
QString speedUnit;
|
||||
|
||||
QTimer *animationTimer;
|
||||
|
||||
@@ -74,6 +74,9 @@ void DriverMonitorRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
float opacity = is_active ? 0.65f : 0.2f;
|
||||
|
||||
// FrogPilot variables
|
||||
if (frogpilot_toggles.value("road_name_ui").toBool()) {
|
||||
y -= UI_BORDER_SIZE;
|
||||
}
|
||||
|
||||
drawIcon(painter, QPoint(x, y), dm_img, QColor(0, 0, 0, 70), opacity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user