Increase max speed by 5 on short press
Added toggle to increase the value of the max speed by 5 instead of 1 and an additional function to enable/disable it by taping the "Max" speed icon in the onroad UI.
This commit is contained in:
@@ -105,15 +105,27 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
|
||||
// FrogPilot clickable widgets
|
||||
bool widgetClicked = false;
|
||||
|
||||
// Change cruise control increments button
|
||||
QRect maxSpeedRect(7, 25, 225, 225);
|
||||
bool isMaxSpeedClicked = maxSpeedRect.contains(e->pos());
|
||||
|
||||
// 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;
|
||||
if (isMaxSpeedClicked || isSpeedClicked) {
|
||||
if (isMaxSpeedClicked && scene.reverse_cruise_ui) {
|
||||
bool currentReverseCruise = scene.reverse_cruise;
|
||||
|
||||
uiState()->scene.hide_speed = !currentHideSpeed;
|
||||
params.putBoolNonBlocking("HideSpeed", !currentHideSpeed);
|
||||
uiState()->scene.reverse_cruise = !currentReverseCruise;
|
||||
params.putBoolNonBlocking("ReverseCruise", !currentReverseCruise);
|
||||
|
||||
} else 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"
|
||||
@@ -483,7 +495,11 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
||||
int bottom_radius = has_eu_speed_limit ? 100 : 32;
|
||||
|
||||
QRect set_speed_rect(QPoint(60 + (default_size.width() - set_speed_size.width()) / 2, 45), set_speed_size);
|
||||
p.setPen(QPen(whiteColor(75), 6));
|
||||
if (scene.reverse_cruise) {
|
||||
p.setPen(QPen(QColor(0, 150, 255), 6));
|
||||
} else {
|
||||
p.setPen(QPen(whiteColor(75), 6));
|
||||
}
|
||||
p.setBrush(blackColor(166));
|
||||
drawRoundedRect(p, set_speed_rect, top_radius, top_radius, bottom_radius, bottom_radius);
|
||||
|
||||
|
||||
@@ -319,6 +319,8 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength");
|
||||
|
||||
bool quality_of_life_controls = params.getBool("QOLControls");
|
||||
scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise");
|
||||
scene.reverse_cruise_ui = scene.reverse_cruise && params.getBool("ReverseCruiseUI");
|
||||
|
||||
bool quality_of_life_visuals = params.getBool("QOLVisuals");
|
||||
scene.full_map = quality_of_life_visuals && params.getBool("FullMap");
|
||||
|
||||
@@ -191,6 +191,8 @@ typedef struct UIScene {
|
||||
bool lead_info;
|
||||
bool map_open;
|
||||
bool model_ui;
|
||||
bool reverse_cruise;
|
||||
bool reverse_cruise_ui;
|
||||
bool show_driver_camera;
|
||||
bool turn_signal_left;
|
||||
bool turn_signal_right;
|
||||
|
||||
Reference in New Issue
Block a user