ui: Hide Screenrecorder button when alert is displayed

This commit is contained in:
Jason Wen
2023-10-20 15:43:56 +00:00
parent 9717829840
commit 019454bd34
2 changed files with 15 additions and 4 deletions
+13 -4
View File
@@ -626,6 +626,11 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
// update onroad settings button state
onroad_settings_btn->updateState(s);
#ifdef ENABLE_DASHCAM
// update screen recorder button
recorder->updateState(s);
#endif
// update buttons layout
updateButtonsLayout();
@@ -648,6 +653,14 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
main_layout->setAlignment(onroad_settings_btn, (rightHandDM ? Qt::AlignRight : Qt::AlignLeft) | Qt::AlignBottom);
}
#ifdef ENABLE_DASHCAM
// hide screen recorder button for alerts and flip for right hand DM
if (recorder->isEnabled()) {
recorder->setVisible(!hideBottomIcons);
main_layout->setAlignment(recorder, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignBottom);
}
#endif
const auto lp_sp = sm["longitudinalPlanSP"].getLongitudinalPlanSP();
slcState = lp_sp.getSpeedLimitControlState();
@@ -783,10 +796,6 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
e2eStatus = chime_prompt;
e2eState = e2eLStatus;
#ifdef ENABLE_DASHCAM
recorder->updateState(s);
#endif
}
void AnnotatedCameraWidget::drawHud(QPainter &p) {
@@ -28,6 +28,7 @@ ScreenRecoder::ScreenRecoder(QWidget *parent) : QPushButton(parent), image_queue
rec_btn_size = 150;
setVisible(false);
setEnabled(false);
setFixedSize(rec_btn_size, rec_btn_size);
setFocusPolicy(Qt::NoFocus);
QObject::connect(this, &QPushButton::clicked, [=]() {
@@ -183,4 +184,5 @@ void ScreenRecoder::update_screen() {
void ScreenRecoder::updateState(const UIState &s) {
bool show_toggle = params.getBool("ScreenRecorder") || recording;
setVisible(show_toggle);
setEnabled(show_toggle);
}