diff --git a/selfdrive/ui/qt/offroad/driverview.cc b/selfdrive/ui/qt/offroad/driverview.cc index 00f7415cba..9010227f18 100644 --- a/selfdrive/ui/qt/offroad/driverview.cc +++ b/selfdrive/ui/qt/offroad/driverview.cc @@ -5,10 +5,7 @@ #include "selfdrive/ui/qt/util.h" -const int FACE_IMG_SIZE = 130; - DriverViewWindow::DriverViewWindow(QWidget* parent) : CameraWidget("camerad", VISION_STREAM_DRIVER, parent) { - face_img = loadPixmap("../assets/img_driver_face_static.png", {FACE_IMG_SIZE, FACE_IMG_SIZE}); QObject::connect(this, &CameraWidget::clicked, this, &DriverViewWindow::done); QObject::connect(device(), &Device::interactiveTimeout, this, [this]() { if (isVisible()) { @@ -68,12 +65,8 @@ void DriverViewWindow::paintGL() { p.drawRoundedRect(fbox_x - box_size / 2, fbox_y - box_size / 2, box_size, box_size, 35.0, 35.0); } - // icon - const int img_offset = 60; - const int img_x = is_rhd ? rect().right() - FACE_IMG_SIZE - img_offset : rect().left() + img_offset; - const int img_y = rect().bottom() - FACE_IMG_SIZE - img_offset; - p.setOpacity(face_detected ? 1.0 : 0.2); - p.drawPixmap(img_x, img_y, face_img); + driver_monitor.updateState(*uiState()); + driver_monitor.draw(p, rect()); } mat4 DriverViewWindow::calcFrameMatrix() { diff --git a/selfdrive/ui/qt/offroad/driverview.h b/selfdrive/ui/qt/offroad/driverview.h index 00acb68d29..f6eb752fe6 100644 --- a/selfdrive/ui/qt/offroad/driverview.h +++ b/selfdrive/ui/qt/offroad/driverview.h @@ -1,6 +1,7 @@ #pragma once #include "selfdrive/ui/qt/widgets/cameraview.h" +#include "selfdrive/ui/qt/onroad/driver_monitoring.h" class DriverViewWindow : public CameraWidget { Q_OBJECT @@ -18,5 +19,5 @@ protected: void paintGL() override; Params params; - QPixmap face_img; + DriverMonitorRenderer driver_monitor; };