#include "selfdrive/ui/qt/ready.h" #include #include #include #include #include #include #include #include #include #include "common/params.h" #include "common/timing.h" #include "system/hardware/hw.h" #include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/util.h" ReadyWindow::ReadyWindow(QWidget *parent) : QWidget(parent) { QGridLayout *layout = new QGridLayout(this); layout->setSpacing(0); layout->setMargin(0); setAttribute(Qt::WA_OpaquePaintEvent); setStyleSheet(R"( BodyWindow { background-color: black; } )"); QObject::connect(uiState(), &UIState::uiUpdate, this, &ReadyWindow::updateState); } void ReadyWindow::paintEvent(QPaintEvent *event) { QPainter painter(this); QPixmap comma_img = loadPixmap("/data/openpilot/selfdrive/clearpilot/theme/clearpilot/images/ready.png"); // Calculate the top-left position to center the image in the window. int x = (this->width() - comma_img.width()) / 2; int y = ((this->height() - comma_img.height()) / 20) * 9; // Draw the pixmap at the calculated position. painter.drawPixmap(x, y, comma_img); // TODO: Referencw widgets/offroad_alert.cc // std::string bytes = params.get(key); // if params value Offroad_TemperatureTooHigh is set with bytes > 0, then // temp is too high. show hot.png. Add current temp to the right of the logo. // otherwise, if offroad_alert widget would otherwise display, then ditch the ready.cc // screen and go to home.cc. } void ReadyWindow::showEvent(QShowEvent *event) { // refresh(); // timer->start(120 * 1000); } void ReadyWindow::hideEvent(QHideEvent *event) { // timer->stop(); } void ReadyWindow::updateState(const UIState &s) { } void ReadyWindow::offroadTransition(bool offroad) { }