Visuals - Quality of Life - Hide Speed

Hide the speed indicator in the onroad UI. Additional toggle allows it to be hidden/shown via tapping the speed itself.
This commit is contained in:
FrogAi 2024-05-11 15:11:23 -07:00
parent c4a5749c6c
commit 859e5dfe52
3 changed files with 15 additions and 1 deletions

View File

@ -123,6 +123,9 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
bool isLeftSideClicked = leftRect.contains(e->pos()) && scene.speed_limit_changed;
bool isRightSideClicked = rightRect.contains(e->pos()) && scene.speed_limit_changed;
QRect hideSpeedRect(rect().center().x() - 175, 50, 350, 350);
bool isSpeedClicked = hideSpeedRect.contains(e->pos()) && scene.hide_speed_ui;
QRect maxSpeedRect(7, 25, 225, 225);
bool isMaxSpeedClicked = maxSpeedRect.contains(e->pos()) && scene.reverse_cruise_ui;
@ -144,6 +147,13 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
return;
}
if (isSpeedClicked) {
bool currentHideSpeed = scene.hide_speed;
uiState()->scene.hide_speed = !currentHideSpeed;
params.putBoolNonBlocking("HideSpeed", !currentHideSpeed);
return;
}
if (isSpeedLimitClicked) {
bool currentShowSLCOffset = scene.show_slc_offset;
scene.show_slc_offset = !currentShowSLCOffset;
@ -849,7 +859,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
}
// current speed
if (!bigMapOpen) {
if (!(scene.hide_speed || bigMapOpen)) {
p.setFont(InterFont(176, QFont::Bold));
drawText(p, rect().center().x(), 210, speedStr);
p.setFont(InterFont(66));

View File

@ -403,6 +403,8 @@ void ui_update_frogpilot_params(UIState *s) {
scene.full_map = scene.big_map && params.getBool("FullMap");
scene.camera_view = quality_of_life_visuals ? params.getInt("CameraView") : 0;
scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera");
scene.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed");
scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI");
scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController");
scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset");

View File

@ -210,6 +210,8 @@ typedef struct UIScene {
bool full_map;
bool has_auto_tune;
bool hide_lead_marker;
bool hide_speed;
bool hide_speed_ui;
bool holiday_themes;
bool is_CPU;
bool is_GPU;