mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-09-30 11:33:41 +08:00
f4d8621be1
* use CameraViewWidget * no timer, updateFrame after frameSwapped * use QOpenGLShaderProgram * merge master * remove that * new function setStreamType * continue * remove showEvent * cleanup * cleanup * little more * fix black screen on startup Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: a034926264cd1025c69d6ceb3fe444965f960b75
66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <QStackedLayout>
|
|
#include <QWidget>
|
|
|
|
#include "selfdrive/ui/qt/widgets/cameraview.h"
|
|
#include "selfdrive/ui/ui.h"
|
|
|
|
|
|
// ***** onroad widgets *****
|
|
|
|
class OnroadAlerts : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
OnroadAlerts(QWidget *parent = 0) : QWidget(parent) {};
|
|
void updateAlert(const Alert &a, const QColor &color);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent*) override;
|
|
|
|
private:
|
|
QColor bg;
|
|
Alert alert = {};
|
|
};
|
|
|
|
// container window for the NVG UI
|
|
class NvgWindow : public CameraViewWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit NvgWindow(VisionStreamType type, QWidget* parent = 0) : CameraViewWidget(type, true, parent) {}
|
|
void updateState(const UIState &s);
|
|
|
|
protected:
|
|
void paintGL() override;
|
|
void initializeGL() override;
|
|
double prev_draw_t = 0;
|
|
};
|
|
|
|
// container for all onroad widgets
|
|
class OnroadWindow : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
OnroadWindow(QWidget* parent = 0);
|
|
bool isMapVisible() const { return map && map->isVisible(); }
|
|
|
|
private:
|
|
void paintEvent(QPaintEvent *event);
|
|
void mousePressEvent(QMouseEvent* e) override;
|
|
OnroadAlerts *alerts;
|
|
NvgWindow *nvg;
|
|
QColor bg = bg_colors[STATUS_DISENGAGED];
|
|
QWidget *map = nullptr;
|
|
QHBoxLayout* split;
|
|
|
|
signals:
|
|
void updateStateSignal(const UIState &s);
|
|
void offroadTransitionSignal(bool offroad);
|
|
|
|
private slots:
|
|
void offroadTransition(bool offroad);
|
|
void updateState(const UIState &s);
|
|
};
|