Visuals - Quality of Life - Driver Camera On Reverse

Added toggle to show the driver camera when in the reverse gear.
This commit is contained in:
FrogAi 2024-05-26 23:10:53 -07:00
parent 66f8878ba8
commit 734eca32a6
4 changed files with 8 additions and 3 deletions

View File

@ -70,6 +70,7 @@ void HomeWindow::updateState(const UIState &s) {
}
if (s.scene.started) {
showDriverView(s.scene.driver_camera_timer >= 10, true);
if (s.scene.map_open) {
showSidebar(false);
}
@ -87,10 +88,11 @@ void HomeWindow::offroadTransition(bool offroad) {
}
}
void HomeWindow::showDriverView(bool show) {
void HomeWindow::showDriverView(bool show, bool started) {
if (show) {
emit closeSettings();
slayout->setCurrentWidget(driver_view);
sidebar->setVisible(show == false);
} else {
if (started) {
slayout->setCurrentWidget(onroad);
@ -100,7 +102,6 @@ void HomeWindow::showDriverView(bool show) {
sidebar->setVisible(show == false);
}
}
sidebar->setVisible(show == false);
}
void HomeWindow::mousePressEvent(QMouseEvent* e) {

View File

@ -56,7 +56,7 @@ signals:
public slots:
void offroadTransition(bool offroad);
void showDriverView(bool show);
void showDriverView(bool show, bool started=false);
void showSidebar(bool show);
void showMapPanel(bool show);

View File

@ -421,6 +421,7 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
scene.big_map = quality_of_life_visuals && params.getBool("BigMap");
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.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController");
scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset");
@ -524,6 +525,7 @@ void UIState::update() {
scene.conditional_status = scene.conditional_experimental && scene.enabled ? paramsMemory.getInt("CEStatus") : 0;
scene.current_holiday_theme = scene.holiday_themes ? paramsMemory.getInt("CurrentHolidayTheme") : 0;
scene.current_random_event = scene.random_events ? paramsMemory.getInt("CurrentRandomEvent") : 0;
scene.driver_camera_timer = scene.driver_camera && scene.reverse ? scene.driver_camera_timer + 1 : 0;
scene.started_timer = scene.started || started_prev ? scene.started_timer + 1 : 0;
}

View File

@ -135,6 +135,7 @@ typedef struct UIScene {
bool conditional_experimental;
bool disable_smoothing_mtsc;
bool disable_smoothing_vtsc;
bool driver_camera;
bool dynamic_path_width;
bool dynamic_pedals_on_ui;
bool enabled;
@ -235,6 +236,7 @@ typedef struct UIScene {
int custom_icons;
int custom_signals;
int desired_follow;
int driver_camera_timer;
int model_length;
int obstacle_distance;
int obstacle_distance_stock;