Hide current speed in onroad UI
Added toggle to hide the current speed from the onroad UI and an additional function to enable/disable it by clicking on it via the onroad UI.
This commit is contained in:
@@ -105,8 +105,19 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// FrogPilot clickable widgets
|
||||
bool widgetClicked = false;
|
||||
|
||||
// Hide speed button
|
||||
QRect hideSpeedRect(rect().center().x() - 175, 50, 350, 350);
|
||||
bool isSpeedClicked = hideSpeedRect.contains(e->pos());
|
||||
|
||||
if (isSpeedClicked && scene.hide_speed_ui) {
|
||||
bool currentHideSpeed = scene.hide_speed;
|
||||
|
||||
uiState()->scene.hide_speed = !currentHideSpeed;
|
||||
params.putBoolNonBlocking("HideSpeed", !currentHideSpeed);
|
||||
|
||||
widgetClicked = true;
|
||||
// If the click wasn't for anything specific, change the value of "ExperimentalMode"
|
||||
if (scene.experimental_mode_via_screen && e->pos() != timeoutPoint) {
|
||||
} else if (scene.experimental_mode_via_screen && e->pos() != timeoutPoint) {
|
||||
if (clickTimer.isActive()) {
|
||||
clickTimer.stop();
|
||||
|
||||
@@ -533,7 +544,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
||||
}
|
||||
|
||||
// current speed
|
||||
if (!(fullMapOpen || showDriverCamera)) {
|
||||
if (!(scene.hide_speed || fullMapOpen || showDriverCamera)) {
|
||||
p.setFont(InterFont(176, QFont::Bold));
|
||||
drawText(p, rect().center().x(), 210, speedStr);
|
||||
p.setFont(InterFont(66));
|
||||
|
||||
@@ -321,6 +321,8 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
|
||||
bool quality_of_life_visuals = params.getBool("QOLVisuals");
|
||||
scene.full_map = quality_of_life_visuals && params.getBool("FullMap");
|
||||
scene.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed");
|
||||
scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI");
|
||||
}
|
||||
|
||||
void UIState::updateStatus() {
|
||||
|
||||
@@ -185,6 +185,8 @@ typedef struct UIScene {
|
||||
bool experimental_mode_via_screen;
|
||||
bool fps_counter;
|
||||
bool full_map;
|
||||
bool hide_speed;
|
||||
bool hide_speed_ui;
|
||||
bool lead_info;
|
||||
bool map_open;
|
||||
bool model_ui;
|
||||
|
||||
Reference in New Issue
Block a user