Qt-UI add driver monitoring view in offroad (#20148)

* should work, need to test onroad

* reduce diff

* Update home.cc

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: a53c361bd4
commatwo_master
grekiki 4 years ago committed by GitHub
parent 70db46e752
commit 3ad3cd5d4b
  1. 4
      selfdrive/ui/qt/home.cc
  2. 9
      selfdrive/ui/qt/offroad/settings.cc

@ -160,6 +160,10 @@ void HomeWindow::setVisibility(bool offroad) {
void HomeWindow::mousePressEvent(QMouseEvent* e) { void HomeWindow::mousePressEvent(QMouseEvent* e) {
UIState* ui_state = &glWindow->ui_state; UIState* ui_state = &glWindow->ui_state;
if (GLWindow::ui_state.started && GLWindow::ui_state.scene.frontview) {
Params().write_db_value("IsDriverViewEnabled", "0", 1);
return;
}
glWindow->wake(); glWindow->wake();

@ -28,6 +28,7 @@ QFrame* horizontal_line(QWidget* parent = 0){
line->setFixedHeight(2); line->setFixedHeight(2);
return line; return line;
} }
QWidget* labelWidget(QString labelName, QString labelContent){ QWidget* labelWidget(QString labelName, QString labelContent){
QHBoxLayout* labelLayout = new QHBoxLayout; QHBoxLayout* labelLayout = new QHBoxLayout;
labelLayout->addWidget(new QLabel(labelName), 0, Qt::AlignLeft); labelLayout->addWidget(new QLabel(labelName), 0, Qt::AlignLeft);
@ -151,6 +152,14 @@ QWidget * device_panel() {
device_layout->addWidget(labelWidget(QString::fromStdString(l.first), QString::fromStdString(l.second)), 0, Qt::AlignTop); device_layout->addWidget(labelWidget(QString::fromStdString(l.first), QString::fromStdString(l.second)), 0, Qt::AlignTop);
} }
QPushButton* dcam_view = new QPushButton("Driver camera view");
device_layout->addWidget(dcam_view, 0, Qt::AlignBottom);
device_layout->addWidget(horizontal_line(), Qt::AlignBottom);
QObject::connect(dcam_view, &QPushButton::released, [=]() {
Params().write_db_value("IsDriverViewEnabled", "1", 1);
});
// TODO: show current calibration values // TODO: show current calibration values
QPushButton *clear_cal_btn = new QPushButton("Reset Calibration"); QPushButton *clear_cal_btn = new QPushButton("Reset Calibration");
device_layout->addWidget(clear_cal_btn, 0, Qt::AlignBottom); device_layout->addWidget(clear_cal_btn, 0, Qt::AlignBottom);

Loading…
Cancel
Save