diff --git a/selfdrive/ui/qt/body.cc b/selfdrive/ui/qt/body.cc index 3f6026a..631f34a 100644 --- a/selfdrive/ui/qt/body.cc +++ b/selfdrive/ui/qt/body.cc @@ -3,18 +3,19 @@ #include #include -#include +#include #include + #include #include #include #include #include -#include // Include the QWebEngineView header #include "common/params.h" #include "common/timing.h" -#include "system/hardware/hw.h" + +#include "system/hardware/hw.h" #include "selfdrive/ui/qt/qt_window.h" #include "selfdrive/ui/qt/util.h" @@ -23,16 +24,9 @@ void LogoWidget::paintEvent(QPaintEvent *event) { } BodyWindow::BodyWindow(QWidget *parent) : QWidget(parent) { - // Create a QWebEngineView - QWebEngineView *view = new QWebEngineView(this); - view->setUrl(QUrl("http://www.fark.com/")); // Set the URL to fark.com - - // Filler - QGridLayout *layout = new QGridLayout(this); layout->setSpacing(0); - layout->setMargin(0); // Set margin to 0 to fill the entire window - layout->addWidget(view, 0, 0); // Add the view to the layout + layout->setMargin(200); setAttribute(Qt::WA_OpaquePaintEvent); @@ -45,6 +39,20 @@ BodyWindow::BodyWindow(QWidget *parent) : QWidget(parent) { QObject::connect(uiState(), &UIState::uiUpdate, this, &BodyWindow::updateState); } +void BodyWindow::paintEvent(QPaintEvent *event) { + QPainter painter(this); + + QPixmap comma_img = loadPixmap("../assets/oscarpilot_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()) / 2; + + // Draw the pixmap at the calculated position. + painter.drawPixmap(x, y, comma_img); +} + + void BodyWindow::updateState(const UIState &s) { } diff --git a/selfdrive/ui/qt/body.webbrowser.test b/selfdrive/ui/qt/body.webbrowser.test new file mode 100644 index 0000000..88a8c5d --- /dev/null +++ b/selfdrive/ui/qt/body.webbrowser.test @@ -0,0 +1,52 @@ +#include "selfdrive/ui/qt/body.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include // Include the QWebEngineView header + +#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" + +void LogoWidget::paintEvent(QPaintEvent *event) { + QPainter painter(this); +} + +BodyWindow::BodyWindow(QWidget *parent) : QWidget(parent) { + // Create a QWebEngineView + QWebEngineView *view = new QWebEngineView(this); + view->setUrl(QUrl("http://www.fark.com/")); // Set the URL to fark.com + + // Filler + + QGridLayout *layout = new QGridLayout(this); + layout->setSpacing(0); + layout->setMargin(0); // Set margin to 0 to fill the entire window + layout->addWidget(view, 0, 0); // Add the view to the layout + + setAttribute(Qt::WA_OpaquePaintEvent); + + setStyleSheet(R"( + BodyWindow { + background-color: blue; + } + )"); + + QObject::connect(uiState(), &UIState::uiUpdate, this, &BodyWindow::updateState); +} + +void BodyWindow::updateState(const UIState &s) { +} + +void BodyWindow::offroadTransition(bool offroad) { +}