wip
This commit is contained in:
@@ -5,16 +5,15 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStackedLayout>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <QPixmap>
|
||||
#include <QWebEngineView> // 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"
|
||||
@@ -24,9 +23,14 @@ 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
|
||||
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(200);
|
||||
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);
|
||||
|
||||
@@ -39,20 +43,6 @@ 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) {
|
||||
}
|
||||
|
||||
|
||||
60
selfdrive/ui/qt/body.good
Normal file
60
selfdrive/ui/qt/body.good
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "selfdrive/ui/qt/body.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStackedLayout>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QGridLayout>
|
||||
#include <QString>
|
||||
#include <QTransform>
|
||||
#include <QPixmap>
|
||||
|
||||
#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) {
|
||||
QGridLayout *layout = new QGridLayout(this);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(200);
|
||||
|
||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
|
||||
setStyleSheet(R"(
|
||||
BodyWindow {
|
||||
background-color: blue;
|
||||
}
|
||||
)");
|
||||
|
||||
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) {
|
||||
}
|
||||
|
||||
void BodyWindow::offroadTransition(bool offroad) {
|
||||
}
|
||||
@@ -9,31 +9,9 @@
|
||||
#include <QVariantAnimation>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
#include "common/util.h"
|
||||
#include "selfdrive/ui/ui.h"
|
||||
|
||||
constexpr int spinner_fps = 30;
|
||||
constexpr QSize spinner_size = QSize(360, 360);
|
||||
|
||||
class LogoWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LogoWidget(QWidget *parent = nullptr);
|
||||
private:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
};
|
||||
|
||||
// class RecordButton : public QPushButton {
|
||||
// Q_OBJECT
|
||||
|
||||
// public:
|
||||
// RecordButton(QWidget* parent = 0);
|
||||
|
||||
// private:
|
||||
// void paintEvent(QPaintEvent*) override;
|
||||
// };
|
||||
|
||||
class BodyWindow : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -44,15 +22,3 @@ private slots:
|
||||
void updateState(const UIState &s);
|
||||
void offroadTransition(bool onroad);
|
||||
};
|
||||
|
||||
// bool charging = false;
|
||||
// uint64_t last_button = 0;
|
||||
// FirstOrderFilter fuel_filter;
|
||||
// QLabel *face;
|
||||
// QMovie *awake, *sleep;
|
||||
// RecordButton *btn;
|
||||
|
||||
// private slots:
|
||||
// void updateState(const UIState &s);
|
||||
// void offroadTransition(bool onroad);
|
||||
// };
|
||||
|
||||
Reference in New Issue
Block a user