Hide current speed in onroad UI upon screen tap
Added ability to hide the current speed by taping on it via onroad UI.
This commit is contained in:
@@ -254,6 +254,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"GasRegenCmd", PERSISTENT},
|
||||
{"GoatScream", PERSISTENT},
|
||||
{"GreenLightAlert", PERSISTENT},
|
||||
{"HideSpeed", PERSISTENT},
|
||||
{"LaneLinesWidth", PERSISTENT},
|
||||
{"LateralTune", PERSISTENT},
|
||||
{"LeadInfo", PERSISTENT},
|
||||
|
||||
@@ -106,8 +106,16 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// FrogPilot clickable widgets
|
||||
bool widgetClicked = false;
|
||||
|
||||
// Hide speed button
|
||||
QRect speedRect(rect().center().x() - 175, 50, 350, 350);
|
||||
bool isSpeedClicked = speedRect.contains(e->pos());
|
||||
|
||||
if (isSpeedClicked) {
|
||||
speedHidden = !params.getBool("HideSpeed");
|
||||
params.putBoolNonBlocking("HideSpeed", speedHidden);
|
||||
widgetClicked = true;
|
||||
// If the click wasn't for anything specific, change the value of "ExperimentalMode"
|
||||
if (scene.experimental_mode_via_press && e->pos() != timeoutPoint) {
|
||||
} else if (scene.experimental_mode_via_press && e->pos() != timeoutPoint) {
|
||||
if (clickTimer.isActive()) {
|
||||
clickTimer.stop();
|
||||
if (scene.conditional_experimental) {
|
||||
@@ -552,10 +560,12 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
||||
}
|
||||
|
||||
// current speed
|
||||
if (!speedHidden) {
|
||||
p.setFont(InterFont(176, QFont::Bold));
|
||||
drawText(p, rect().center().x(), 210, speedStr);
|
||||
p.setFont(InterFont(66));
|
||||
drawText(p, rect().center().x(), 290, speedUnit, 200);
|
||||
}
|
||||
|
||||
p.restore();
|
||||
}
|
||||
@@ -1020,6 +1030,10 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
|
||||
|
||||
main_layout->addLayout(bottom_layout);
|
||||
|
||||
if (params.getBool("HideSpeed")) {
|
||||
speedHidden = true;
|
||||
}
|
||||
|
||||
// Custom themes configuration
|
||||
themeConfiguration = {
|
||||
{1, {QString("frog_theme"), {QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))},
|
||||
|
||||
@@ -16,6 +16,7 @@ const int btn_size = 192;
|
||||
const int img_size = (btn_size / 4) * 3;
|
||||
|
||||
// FrogPilot global variables
|
||||
static bool speedHidden;
|
||||
static double fps;
|
||||
|
||||
// ***** onroad widgets *****
|
||||
|
||||
Reference in New Issue
Block a user