Quality of life toggles

Co-Authored-By: Tim Wilson <7284371+twilsonco@users.noreply.github.com>

Update visual_settings.cc
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent f0eef503f3
commit f71e0b629f
15 changed files with 138 additions and 56 deletions

View File

@@ -138,14 +138,23 @@ void OnroadWindow::mousePressEvent(QMouseEvent* e) {
if (isMaxSpeedClicked) {
reverseCruise = !params.getBool("ReverseCruise");
params.putBoolNonBlocking("ReverseCruise", reverseCruise);
if (!params.getBool("QOLControls")) {
params.putBoolNonBlocking("QOLControls", true);
}
paramsMemory.putBoolNonBlocking("FrogPilotTogglesUpdated", true);
// Check if the click was within the speed text area
} else if (isSpeedClicked) {
speedHidden = !params.getBool("HideSpeed");
params.putBoolNonBlocking("HideSpeed", speedHidden);
hideSpeed = !params.getBool("HideSpeed");
params.putBoolNonBlocking("HideSpeed", hideSpeed);
if (!params.getBool("QOLVisuals")) {
params.putBoolNonBlocking("QOLVisuals", true);
}
} else {
showSLCOffset = !params.getBool("ShowSLCOffset");
params.putBoolNonBlocking("ShowSLCOffset", showSLCOffset);
if (!params.getBool("QOLVisuals")) {
params.putBoolNonBlocking("QOLVisuals", true);
}
}
widgetClicked = true;
// If the click wasn't for anything specific, change the value of "ExperimentalMode"
@@ -193,7 +202,11 @@ void OnroadWindow::offroadTransition(bool offroad) {
QObject::connect(nvg->map_settings_btn_bottom, &MapSettingsButton::clicked, m, &MapPanel::toggleMapSettings);
nvg->map_settings_btn->setEnabled(true);
m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE);
if (scene.full_map) {
m->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
} else {
m->setFixedWidth(topWidget(this)->width() / 2 - UI_BORDER_SIZE);
}
split->insertWidget(0, m);
// hidden by default, made visible when navRoute is published
@@ -643,7 +656,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
}
// current speed
if (!speedHidden) {
if (!hideSpeed) {
p.setFont(InterFont(176, QFont::Bold));
drawText(p, rect().center().x(), 210, speedStr);
p.setFont(InterFont(66));
@@ -1125,16 +1138,13 @@ void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
main_layout->addLayout(bottom_layout);
if (params.getBool("HideSpeed")) {
speedHidden = true;
if (params.getBool("QOLControls")) {
reverseCruise = params.getBool("ReverseCruise");
}
if (params.getBool("ReverseCruise")) {
reverseCruise = true;
}
if (params.getBool("ShowSLCOffset")) {
showSLCOffset = true;
if (params.getBool("QOLVisuals")) {
hideSpeed = params.getBool("HideSpeed");
showSLCOffset = params.getBool("ShowSLCOffset");
}
// Custom themes configuration

View File

@@ -17,9 +17,9 @@ const int btn_size = 192;
const int img_size = (btn_size / 4) * 3;
// FrogPilot global variables
static bool hideSpeed;
static bool reverseCruise;
static bool showSLCOffset;
static bool speedHidden;
static double fps;
// ***** onroad widgets *****

View File

@@ -303,29 +303,33 @@ void ui_update_params(UIState *s) {
scene.conditional_speed_lead = params.getInt("CESpeedLead");
scene.custom_onroad_ui = params.getBool("CustomUI");
scene.adjacent_path = scene.custom_onroad_ui && params.getBool("AdjacentPath");
scene.blind_spot_path = scene.custom_onroad_ui && params.getBool("BlindSpotPath");
scene.lead_info = scene.custom_onroad_ui && params.getBool("LeadInfo");
scene.road_name_ui = scene.custom_onroad_ui && params.getBool("RoadNameUI");
scene.show_fps = scene.custom_onroad_ui && params.getBool("ShowFPS");
scene.use_si = scene.custom_onroad_ui && params.getBool("UseSI");
scene.adjacent_path = params.getBool("AdjacentPath") && scene.custom_onroad_ui;
scene.blind_spot_path = params.getBool("BlindSpotPath") && scene.custom_onroad_ui;
scene.lead_info = params.getBool("LeadInfo") && scene.custom_onroad_ui;
scene.road_name_ui = params.getBool("RoadNameUI") && scene.custom_onroad_ui;
scene.show_fps = params.getBool("ShowFPS") && scene.custom_onroad_ui;
scene.use_si = params.getBool("UseSI") && scene.custom_onroad_ui;
scene.custom_theme = params.getBool("CustomTheme");
scene.custom_colors = scene.custom_theme ? params.getInt("CustomColors") : 0;
scene.custom_signals = scene.custom_theme ? params.getInt("CustomSignals") : 0;
scene.model_ui = params.getBool("ModelUI");
scene.acceleration_path = scene.model_ui && params.getBool("AccelerationPath");
scene.acceleration_path = params.getBool("AccelerationPath") && scene.model_ui;
scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1 : INCH_TO_CM) / 200;
scene.path_edge_width = params.getInt("PathEdgeWidth");
scene.path_width = params.getInt("PathWidth") / 10.0 * (scene.is_metric ? 1 : FOOT_TO_METER) / 2;
scene.road_edge_width = params.getInt("RoadEdgesWidth") * (scene.is_metric ? 1 : INCH_TO_CM) / 200;
scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength");
scene.unlimited_road_ui_length = params.getBool("UnlimitedLength") && scene.model_ui;
scene.driver_camera = params.getBool("DriverCamera");
scene.experimental_mode_via_press = params.getBool("ExperimentalModeViaPress");
scene.mute_dm = params.getBool("FireTheBabysitter") && params.getBool("MuteDM");
scene.mute_dm = params.getBool("MuteDM") && params.getBool("FireTheBabysitter");
scene.personalities_via_screen = (params.getInt("AdjustablePersonalities") == 2 || params.getInt("AdjustablePersonalities") == 3);
scene.quality_of_life_visuals = params.getBool("QOLVisuals");
scene.full_map = params.getBool("QOLVisuals") && scene.quality_of_life_visuals;
scene.rotating_wheel = params.getBool("RotatingWheel");
scene.screen_brightness = params.getInt("ScreenBrightness");
scene.speed_limit_controller = params.getBool("SpeedLimitController");

View File

@@ -185,11 +185,13 @@ typedef struct UIScene {
bool enabled;
bool experimental_mode;
bool experimental_mode_via_press;
bool full_map;
bool lead_info;
bool map_open;
bool model_ui;
bool mute_dm;
bool personalities_via_screen;
bool quality_of_life_visuals;
bool road_name_ui;
bool rotating_wheel;
bool show_driver_camera;