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},
|
{"GasRegenCmd", PERSISTENT},
|
||||||
{"GoatScream", PERSISTENT},
|
{"GoatScream", PERSISTENT},
|
||||||
{"GreenLightAlert", PERSISTENT},
|
{"GreenLightAlert", PERSISTENT},
|
||||||
|
{"HideSpeed", PERSISTENT},
|
||||||
{"LaneLinesWidth", PERSISTENT},
|
{"LaneLinesWidth", PERSISTENT},
|
||||||
{"LateralTune", PERSISTENT},
|
{"LateralTune", PERSISTENT},
|
||||||
{"LeadInfo", PERSISTENT},
|
{"LeadInfo", PERSISTENT},
|
||||||
|
|||||||
@@ -106,8 +106,16 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
|||||||
// FrogPilot clickable widgets
|
// FrogPilot clickable widgets
|
||||||
bool widgetClicked = false;
|
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 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()) {
|
if (clickTimer.isActive()) {
|
||||||
clickTimer.stop();
|
clickTimer.stop();
|
||||||
if (scene.conditional_experimental) {
|
if (scene.conditional_experimental) {
|
||||||
@@ -552,10 +560,12 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// current speed
|
// current speed
|
||||||
p.setFont(InterFont(176, QFont::Bold));
|
if (!speedHidden) {
|
||||||
drawText(p, rect().center().x(), 210, speedStr);
|
p.setFont(InterFont(176, QFont::Bold));
|
||||||
p.setFont(InterFont(66));
|
drawText(p, rect().center().x(), 210, speedStr);
|
||||||
drawText(p, rect().center().x(), 290, speedUnit, 200);
|
p.setFont(InterFont(66));
|
||||||
|
drawText(p, rect().center().x(), 290, speedUnit, 200);
|
||||||
|
}
|
||||||
|
|
||||||
p.restore();
|
p.restore();
|
||||||
}
|
}
|
||||||
@@ -1020,6 +1030,10 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
|
|||||||
|
|
||||||
main_layout->addLayout(bottom_layout);
|
main_layout->addLayout(bottom_layout);
|
||||||
|
|
||||||
|
if (params.getBool("HideSpeed")) {
|
||||||
|
speedHidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Custom themes configuration
|
// Custom themes configuration
|
||||||
themeConfiguration = {
|
themeConfiguration = {
|
||||||
{1, {QString("frog_theme"), {QColor(23, 134, 68, 242), {{0.0, QBrush(QColor::fromHslF(144 / 360., 0.71, 0.31, 0.9))},
|
{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;
|
const int img_size = (btn_size / 4) * 3;
|
||||||
|
|
||||||
// FrogPilot global variables
|
// FrogPilot global variables
|
||||||
|
static bool speedHidden;
|
||||||
static double fps;
|
static double fps;
|
||||||
|
|
||||||
// ***** onroad widgets *****
|
// ***** onroad widgets *****
|
||||||
|
|||||||
Reference in New Issue
Block a user