UI Onroad widget renames (#26124)

Consistent widget naming
pull/26125/head
HaraldSchafer 3 years ago committed by GitHub
parent c782e4d796
commit baca1cae1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      selfdrive/ui/qt/offroad/driverview.cc
  2. 2
      selfdrive/ui/qt/offroad/driverview.h
  3. 45
      selfdrive/ui/qt/onroad.cc
  4. 6
      selfdrive/ui/qt/onroad.h
  5. 26
      selfdrive/ui/qt/widgets/cameraview.cc
  6. 6
      selfdrive/ui/qt/widgets/cameraview.h
  7. 2
      selfdrive/ui/translations/main_ar.ts
  8. 46
      selfdrive/ui/translations/main_ja.ts
  9. 46
      selfdrive/ui/translations/main_ko.ts
  10. 2
      selfdrive/ui/translations/main_nl.ts
  11. 2
      selfdrive/ui/translations/main_pl.ts
  12. 46
      selfdrive/ui/translations/main_pt-BR.ts
  13. 2
      selfdrive/ui/translations/main_th.ts
  14. 46
      selfdrive/ui/translations/main_zh-CHS.ts
  15. 46
      selfdrive/ui/translations/main_zh-CHT.ts
  16. 8
      selfdrive/ui/watch3.cc
  17. 6
      tools/cabana/videowidget.cc
  18. 2
      tools/cabana/videowidget.h

@ -12,11 +12,11 @@ DriverViewWindow::DriverViewWindow(QWidget* parent) : QWidget(parent) {
layout = new QStackedLayout(this); layout = new QStackedLayout(this);
layout->setStackingMode(QStackedLayout::StackAll); layout->setStackingMode(QStackedLayout::StackAll);
cameraView = new CameraViewWidget("camerad", VISION_STREAM_DRIVER, true, this); cameraView = new CameraWidget("camerad", VISION_STREAM_DRIVER, true, this);
layout->addWidget(cameraView); layout->addWidget(cameraView);
scene = new DriverViewScene(this); scene = new DriverViewScene(this);
connect(cameraView, &CameraViewWidget::vipcThreadFrameReceived, scene, &DriverViewScene::frameUpdated); connect(cameraView, &CameraWidget::vipcThreadFrameReceived, scene, &DriverViewScene::frameUpdated);
layout->addWidget(scene); layout->addWidget(scene);
layout->setCurrentWidget(scene); layout->setCurrentWidget(scene);
} }

@ -42,7 +42,7 @@ protected:
void mouseReleaseEvent(QMouseEvent* e) override; void mouseReleaseEvent(QMouseEvent* e) override;
private: private:
CameraViewWidget *cameraView; CameraWidget *cameraView;
DriverViewScene *scene; DriverViewScene *scene;
QStackedLayout *layout; QStackedLayout *layout;
}; };

@ -18,7 +18,7 @@ OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
stacked_layout->setStackingMode(QStackedLayout::StackAll); stacked_layout->setStackingMode(QStackedLayout::StackAll);
main_layout->addLayout(stacked_layout); main_layout->addLayout(stacked_layout);
nvg = new NvgWindow(VISION_STREAM_ROAD, this); nvg = new AnnotatedCameraWidget(VISION_STREAM_ROAD, this);
QWidget * split_wrapper = new QWidget; QWidget * split_wrapper = new QWidget;
split = new QHBoxLayout(split_wrapper); split = new QHBoxLayout(split_wrapper);
@ -27,7 +27,7 @@ OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent) {
split->addWidget(nvg); split->addWidget(nvg);
if (getenv("DUAL_CAMERA_VIEW")) { if (getenv("DUAL_CAMERA_VIEW")) {
CameraViewWidget *arCam = new CameraViewWidget("camerad", VISION_STREAM_ROAD, true, this); CameraWidget *arCam = new CameraWidget("camerad", VISION_STREAM_ROAD, true, this);
split->insertWidget(0, arCam); split->insertWidget(0, arCam);
} }
@ -173,16 +173,15 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) {
} }
} }
// NvgWindow
NvgWindow::NvgWindow(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), CameraViewWidget("camerad", type, true, parent) { AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), CameraWidget("camerad", type, true, parent) {
pm = std::make_unique<PubMaster, const std::initializer_list<const char *>>({"uiDebug"}); pm = std::make_unique<PubMaster, const std::initializer_list<const char *>>({"uiDebug"});
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size}); engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
dm_img = loadPixmap("../assets/img_driver_face.png", {img_size, img_size}); dm_img = loadPixmap("../assets/img_driver_face.png", {img_size, img_size});
} }
void NvgWindow::updateState(const UIState &s) { void AnnotatedCameraWidget::updateState(const UIState &s) {
const int SET_SPEED_NA = 255; const int SET_SPEED_NA = 255;
const SubMaster &sm = *(s.sm); const SubMaster &sm = *(s.sm);
@ -234,13 +233,13 @@ void NvgWindow::updateState(const UIState &s) {
} }
if (s.scene.calibration_valid) { if (s.scene.calibration_valid) {
CameraViewWidget::updateCalibration(s.scene.view_from_calib); CameraWidget::updateCalibration(s.scene.view_from_calib);
} else { } else {
CameraViewWidget::updateCalibration(DEFAULT_CALIBRATION); CameraWidget::updateCalibration(DEFAULT_CALIBRATION);
} }
} }
void NvgWindow::drawHud(QPainter &p) { void AnnotatedCameraWidget::drawHud(QPainter &p) {
p.save(); p.save();
// Header gradient // Header gradient
@ -402,7 +401,11 @@ void NvgWindow::drawHud(QPainter &p) {
p.restore(); p.restore();
} }
void NvgWindow::drawText(QPainter &p, int x, int y, const QString &text, int alpha) {
// Window that shows camera view and variety of
// info drawn on top
void AnnotatedCameraWidget::drawText(QPainter &p, int x, int y, const QString &text, int alpha) {
QRect real_rect = getTextRect(p, 0, text); QRect real_rect = getTextRect(p, 0, text);
real_rect.moveCenter({x, y - real_rect.height() / 2}); real_rect.moveCenter({x, y - real_rect.height() / 2});
@ -410,7 +413,7 @@ void NvgWindow::drawText(QPainter &p, int x, int y, const QString &text, int alp
p.drawText(real_rect.x(), real_rect.bottom(), text); p.drawText(real_rect.x(), real_rect.bottom(), text);
} }
void NvgWindow::drawIcon(QPainter &p, int x, int y, QPixmap &img, QBrush bg, float opacity) { void AnnotatedCameraWidget::drawIcon(QPainter &p, int x, int y, QPixmap &img, QBrush bg, float opacity) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(bg); p.setBrush(bg);
p.drawEllipse(x - radius / 2, y - radius / 2, radius, radius); p.drawEllipse(x - radius / 2, y - radius / 2, radius, radius);
@ -419,8 +422,8 @@ void NvgWindow::drawIcon(QPainter &p, int x, int y, QPixmap &img, QBrush bg, flo
} }
void NvgWindow::initializeGL() { void AnnotatedCameraWidget::initializeGL() {
CameraViewWidget::initializeGL(); CameraWidget::initializeGL();
qInfo() << "OpenGL version:" << QString((const char*)glGetString(GL_VERSION)); qInfo() << "OpenGL version:" << QString((const char*)glGetString(GL_VERSION));
qInfo() << "OpenGL vendor:" << QString((const char*)glGetString(GL_VENDOR)); qInfo() << "OpenGL vendor:" << QString((const char*)glGetString(GL_VENDOR));
qInfo() << "OpenGL renderer:" << QString((const char*)glGetString(GL_RENDERER)); qInfo() << "OpenGL renderer:" << QString((const char*)glGetString(GL_RENDERER));
@ -430,8 +433,8 @@ void NvgWindow::initializeGL() {
setBackgroundColor(bg_colors[STATUS_DISENGAGED]); setBackgroundColor(bg_colors[STATUS_DISENGAGED]);
} }
void NvgWindow::updateFrameMat() { void AnnotatedCameraWidget::updateFrameMat() {
CameraViewWidget::updateFrameMat(); CameraWidget::updateFrameMat();
UIState *s = uiState(); UIState *s = uiState();
int w = width(), h = height(); int w = width(), h = height();
@ -448,7 +451,7 @@ void NvgWindow::updateFrameMat() {
.translate(-intrinsic_matrix.v[2], -intrinsic_matrix.v[5]); .translate(-intrinsic_matrix.v[2], -intrinsic_matrix.v[5]);
} }
void NvgWindow::drawLaneLines(QPainter &painter, const UIState *s) { void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
painter.save(); painter.save();
const UIScene &scene = s->scene; const UIScene &scene = s->scene;
@ -507,7 +510,7 @@ void NvgWindow::drawLaneLines(QPainter &painter, const UIState *s) {
painter.restore(); painter.restore();
} }
void NvgWindow::drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd) { void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV3::Reader &lead_data, const QPointF &vd) {
painter.save(); painter.save();
const float speedBuff = 10.; const float speedBuff = 10.;
@ -543,13 +546,13 @@ void NvgWindow::drawLead(QPainter &painter, const cereal::ModelDataV2::LeadDataV
painter.restore(); painter.restore();
} }
void NvgWindow::paintGL() { void AnnotatedCameraWidget::paintGL() {
const double start_draw_t = millis_since_boot(); const double start_draw_t = millis_since_boot();
UIState *s = uiState(); UIState *s = uiState();
const cereal::ModelDataV2::Reader &model = (*s->sm)["modelV2"].getModelV2(); const cereal::ModelDataV2::Reader &model = (*s->sm)["modelV2"].getModelV2();
CameraViewWidget::setFrameId(model.getFrameId()); CameraWidget::setFrameId(model.getFrameId());
CameraViewWidget::paintGL(); CameraWidget::paintGL();
QPainter painter(this); QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing); painter.setRenderHint(QPainter::Antialiasing);
@ -587,8 +590,8 @@ void NvgWindow::paintGL() {
pm->send("uiDebug", msg); pm->send("uiDebug", msg);
} }
void NvgWindow::showEvent(QShowEvent *event) { void AnnotatedCameraWidget::showEvent(QShowEvent *event) {
CameraViewWidget::showEvent(event); CameraWidget::showEvent(event);
ui_update_params(uiState()); ui_update_params(uiState());
prev_draw_t = millis_since_boot(); prev_draw_t = millis_since_boot();

@ -25,7 +25,7 @@ private:
}; };
// container window for the NVG UI // container window for the NVG UI
class NvgWindow : public CameraViewWidget { class AnnotatedCameraWidget : public CameraWidget {
Q_OBJECT Q_OBJECT
Q_PROPERTY(float speed MEMBER speed); Q_PROPERTY(float speed MEMBER speed);
Q_PROPERTY(QString speedUnit MEMBER speedUnit); Q_PROPERTY(QString speedUnit MEMBER speedUnit);
@ -43,7 +43,7 @@ class NvgWindow : public CameraViewWidget {
Q_PROPERTY(int status MEMBER status); Q_PROPERTY(int status MEMBER status);
public: public:
explicit NvgWindow(VisionStreamType type, QWidget* parent = 0); explicit AnnotatedCameraWidget(VisionStreamType type, QWidget* parent = 0);
void updateState(const UIState &s); void updateState(const UIState &s);
private: private:
@ -98,7 +98,7 @@ private:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent* e) override; void mousePressEvent(QMouseEvent* e) override;
OnroadAlerts *alerts; OnroadAlerts *alerts;
NvgWindow *nvg; AnnotatedCameraWidget *nvg;
QColor bg = bg_colors[STATUS_DISENGAGED]; QColor bg = bg_colors[STATUS_DISENGAGED];
QWidget *map = nullptr; QWidget *map = nullptr;
QHBoxLayout* split; QHBoxLayout* split;

@ -93,14 +93,14 @@ mat4 get_fit_view_transform(float widget_aspect_ratio, float frame_aspect_ratio)
} // namespace } // namespace
CameraViewWidget::CameraViewWidget(std::string stream_name, VisionStreamType type, bool zoom, QWidget* parent) : CameraWidget::CameraWidget(std::string stream_name, VisionStreamType type, bool zoom, QWidget* parent) :
stream_name(stream_name), stream_type(type), zoomed_view(zoom), QOpenGLWidget(parent) { stream_name(stream_name), stream_type(type), zoomed_view(zoom), QOpenGLWidget(parent) {
setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_OpaquePaintEvent);
connect(this, &CameraViewWidget::vipcThreadConnected, this, &CameraViewWidget::vipcConnected, Qt::BlockingQueuedConnection); connect(this, &CameraWidget::vipcThreadConnected, this, &CameraWidget::vipcConnected, Qt::BlockingQueuedConnection);
connect(this, &CameraViewWidget::vipcThreadFrameReceived, this, &CameraViewWidget::vipcFrameReceived); connect(this, &CameraWidget::vipcThreadFrameReceived, this, &CameraWidget::vipcFrameReceived);
} }
CameraViewWidget::~CameraViewWidget() { CameraWidget::~CameraWidget() {
makeCurrent(); makeCurrent();
if (isValid()) { if (isValid()) {
glDeleteVertexArrays(1, &frame_vao); glDeleteVertexArrays(1, &frame_vao);
@ -111,7 +111,7 @@ CameraViewWidget::~CameraViewWidget() {
doneCurrent(); doneCurrent();
} }
void CameraViewWidget::initializeGL() { void CameraWidget::initializeGL() {
initializeOpenGLFunctions(); initializeOpenGLFunctions();
program = std::make_unique<QOpenGLShaderProgram>(context()); program = std::make_unique<QOpenGLShaderProgram>(context());
@ -161,7 +161,7 @@ void CameraViewWidget::initializeGL() {
#endif #endif
} }
void CameraViewWidget::showEvent(QShowEvent *event) { void CameraWidget::showEvent(QShowEvent *event) {
frames.clear(); frames.clear();
if (!vipc_thread) { if (!vipc_thread) {
vipc_thread = new QThread(); vipc_thread = new QThread();
@ -171,7 +171,7 @@ void CameraViewWidget::showEvent(QShowEvent *event) {
} }
} }
void CameraViewWidget::hideEvent(QHideEvent *event) { void CameraWidget::hideEvent(QHideEvent *event) {
if (vipc_thread) { if (vipc_thread) {
vipc_thread->requestInterruption(); vipc_thread->requestInterruption();
vipc_thread->quit(); vipc_thread->quit();
@ -180,7 +180,7 @@ void CameraViewWidget::hideEvent(QHideEvent *event) {
} }
} }
void CameraViewWidget::updateFrameMat() { void CameraWidget::updateFrameMat() {
int w = width(), h = height(); int w = width(), h = height();
if (zoomed_view) { if (zoomed_view) {
@ -224,12 +224,12 @@ void CameraViewWidget::updateFrameMat() {
} }
} }
void CameraViewWidget::updateCalibration(const mat3 &calib) { void CameraWidget::updateCalibration(const mat3 &calib) {
calibration = calib; calibration = calib;
updateFrameMat(); updateFrameMat();
} }
void CameraViewWidget::paintGL() { void CameraWidget::paintGL() {
glClearColor(bg.redF(), bg.greenF(), bg.blueF(), bg.alphaF()); glClearColor(bg.redF(), bg.greenF(), bg.blueF(), bg.alphaF());
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT); glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
@ -286,7 +286,7 @@ void CameraViewWidget::paintGL() {
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
} }
void CameraViewWidget::vipcConnected(VisionIpcClient *vipc_client) { void CameraWidget::vipcConnected(VisionIpcClient *vipc_client) {
makeCurrent(); makeCurrent();
frames.clear(); frames.clear();
stream_width = vipc_client->buffers[0].width; stream_width = vipc_client->buffers[0].width;
@ -339,7 +339,7 @@ void CameraViewWidget::vipcConnected(VisionIpcClient *vipc_client) {
updateFrameMat(); updateFrameMat();
} }
void CameraViewWidget::vipcFrameReceived(VisionBuf *buf, uint32_t frame_id) { void CameraWidget::vipcFrameReceived(VisionBuf *buf, uint32_t frame_id) {
frames.push_back(std::make_pair(frame_id, buf)); frames.push_back(std::make_pair(frame_id, buf));
while (frames.size() > FRAME_BUFFER_SIZE) { while (frames.size() > FRAME_BUFFER_SIZE) {
frames.pop_front(); frames.pop_front();
@ -347,7 +347,7 @@ void CameraViewWidget::vipcFrameReceived(VisionBuf *buf, uint32_t frame_id) {
update(); update();
} }
void CameraViewWidget::vipcThread() { void CameraWidget::vipcThread() {
VisionStreamType cur_stream_type = stream_type; VisionStreamType cur_stream_type = stream_type;
std::unique_ptr<VisionIpcClient> vipc_client; std::unique_ptr<VisionIpcClient> vipc_client;
VisionIpcBufExtra meta_main = {0}; VisionIpcBufExtra meta_main = {0};

@ -23,13 +23,13 @@
const int FRAME_BUFFER_SIZE = 5; const int FRAME_BUFFER_SIZE = 5;
static_assert(FRAME_BUFFER_SIZE <= YUV_BUFFER_COUNT); static_assert(FRAME_BUFFER_SIZE <= YUV_BUFFER_COUNT);
class CameraViewWidget : public QOpenGLWidget, protected QOpenGLFunctions { class CameraWidget : public QOpenGLWidget, protected QOpenGLFunctions {
Q_OBJECT Q_OBJECT
public: public:
using QOpenGLWidget::QOpenGLWidget; using QOpenGLWidget::QOpenGLWidget;
explicit CameraViewWidget(std::string stream_name, VisionStreamType stream_type, bool zoom, QWidget* parent = nullptr); explicit CameraWidget(std::string stream_name, VisionStreamType stream_type, bool zoom, QWidget* parent = nullptr);
~CameraViewWidget(); ~CameraWidget();
void setStreamType(VisionStreamType type) { stream_type = type; } void setStreamType(VisionStreamType type) { stream_type = type; }
void setBackgroundColor(const QColor &color) { bg = color; } void setBackgroundColor(const QColor &color) { bg = color; }
void setFrameId(int frame_id) { draw_frame_id = frame_id; } void setFrameId(int frame_id) { draw_frame_id = frame_id; }

@ -493,7 +493,7 @@ location set</source>
</message> </message>
</context> </context>
<context> <context>
<name>NvgWindow</name> <name>AnnotatedCameraWidget</name>
<message> <message>
<location filename="../qt/onroad.cc" line="218"/> <location filename="../qt/onroad.cc" line="218"/>
<source>km/h</source> <source>km/h</source>

@ -67,6 +67,29 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>AnnotatedCameraWidget</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation></translation>
</message>
<message>
<source>LIMIT</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>ConfirmationDialog</name> <name>ConfirmationDialog</name>
<message> <message>
@ -406,29 +429,6 @@ location set</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>NvgWindow</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation></translation>
</message>
<message>
<source>LIMIT</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>OffroadHome</name> <name>OffroadHome</name>
<message> <message>

@ -67,6 +67,29 @@
<translation> </translation> <translation> </translation>
</message> </message>
</context> </context>
<context>
<name>AnnotatedCameraWidget</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation>MAX</translation>
</message>
<message>
<source>SPEED</source>
<translation>SPEED</translation>
</message>
<message>
<source>LIMIT</source>
<translation>LIMIT</translation>
</message>
</context>
<context> <context>
<name>ConfirmationDialog</name> <name>ConfirmationDialog</name>
<message> <message>
@ -406,29 +429,6 @@ location set</source>
<translation> </translation> <translation> </translation>
</message> </message>
</context> </context>
<context>
<name>NvgWindow</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation>MAX</translation>
</message>
<message>
<source>SPEED</source>
<translation>SPEED</translation>
</message>
<message>
<source>LIMIT</source>
<translation>LIMIT</translation>
</message>
</context>
<context> <context>
<name>OffroadHome</name> <name>OffroadHome</name>
<message> <message>

@ -489,7 +489,7 @@ ingesteld</translation>
</message> </message>
</context> </context>
<context> <context>
<name>NvgWindow</name> <name>AnnotatedCameraWidget</name>
<message> <message>
<location filename="../qt/onroad.cc" line="218"/> <location filename="../qt/onroad.cc" line="218"/>
<source>km/h</source> <source>km/h</source>

@ -490,7 +490,7 @@ nie zostało ustawione</translation>
</message> </message>
</context> </context>
<context> <context>
<name>NvgWindow</name> <name>AnnotatedCameraWidget</name>
<message> <message>
<location filename="../qt/onroad.cc" line="218"/> <location filename="../qt/onroad.cc" line="218"/>
<source>km/h</source> <source>km/h</source>

@ -67,6 +67,29 @@
<translation>Evite grandes uploads de dados quando estiver em uma conexão limitada</translation> <translation>Evite grandes uploads de dados quando estiver em uma conexão limitada</translation>
</message> </message>
</context> </context>
<context>
<name>AnnotatedCameraWidget</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation>LIMITE</translation>
</message>
<message>
<source>SPEED</source>
<translation>MAX</translation>
</message>
<message>
<source>LIMIT</source>
<translation>VELO</translation>
</message>
</context>
<context> <context>
<name>ConfirmationDialog</name> <name>ConfirmationDialog</name>
<message> <message>
@ -407,29 +430,6 @@ trabalho definido</translation>
<translation>Senha incorreta</translation> <translation>Senha incorreta</translation>
</message> </message>
</context> </context>
<context>
<name>NvgWindow</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation>LIMITE</translation>
</message>
<message>
<source>SPEED</source>
<translation>MAX</translation>
</message>
<message>
<source>LIMIT</source>
<translation>VELO</translation>
</message>
</context>
<context> <context>
<name>OffroadHome</name> <name>OffroadHome</name>
<message> <message>

@ -488,7 +488,7 @@ location set</source>
</message> </message>
</context> </context>
<context> <context>
<name>NvgWindow</name> <name>AnnotatedCameraWidget</name>
<message> <message>
<location filename="../qt/onroad.cc" line="218"/> <location filename="../qt/onroad.cc" line="218"/>
<source>km/h</source> <source>km/h</source>

@ -67,6 +67,29 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>AnnotatedCameraWidget</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation>SPEED</translation>
</message>
<message>
<source>LIMIT</source>
<translation>LIMIT</translation>
</message>
</context>
<context> <context>
<name>ConfirmationDialog</name> <name>ConfirmationDialog</name>
<message> <message>
@ -404,29 +427,6 @@ location set</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>NvgWindow</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation>SPEED</translation>
</message>
<message>
<source>LIMIT</source>
<translation>LIMIT</translation>
</message>
</context>
<context> <context>
<name>OffroadHome</name> <name>OffroadHome</name>
<message> <message>

@ -67,6 +67,29 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>AnnotatedCameraWidget</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation></translation>
</message>
<message>
<source>LIMIT</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>ConfirmationDialog</name> <name>ConfirmationDialog</name>
<message> <message>
@ -406,29 +429,6 @@ location set</source>
<translation></translation> <translation></translation>
</message> </message>
</context> </context>
<context>
<name>NvgWindow</name>
<message>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<source>mph</source>
<translation>mph</translation>
</message>
<message>
<source>MAX</source>
<translation></translation>
</message>
<message>
<source>SPEED</source>
<translation></translation>
</message>
<message>
<source>LIMIT</source>
<translation></translation>
</message>
</context>
<context> <context>
<name>OffroadHome</name> <name>OffroadHome</name>
<message> <message>

@ -19,15 +19,15 @@ int main(int argc, char *argv[]) {
{ {
QHBoxLayout *hlayout = new QHBoxLayout(); QHBoxLayout *hlayout = new QHBoxLayout();
layout->addLayout(hlayout); layout->addLayout(hlayout);
hlayout->addWidget(new CameraViewWidget("navd", VISION_STREAM_MAP, false)); hlayout->addWidget(new CameraWidget("navd", VISION_STREAM_MAP, false));
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_ROAD, false)); hlayout->addWidget(new CameraWidget("camerad", VISION_STREAM_ROAD, false));
} }
{ {
QHBoxLayout *hlayout = new QHBoxLayout(); QHBoxLayout *hlayout = new QHBoxLayout();
layout->addLayout(hlayout); layout->addLayout(hlayout);
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_DRIVER, false)); hlayout->addWidget(new CameraWidget("camerad", VISION_STREAM_DRIVER, false));
hlayout->addWidget(new CameraViewWidget("camerad", VISION_STREAM_WIDE_ROAD, false)); hlayout->addWidget(new CameraWidget("camerad", VISION_STREAM_WIDE_ROAD, false));
} }
return a.exec(); return a.exec();

@ -16,8 +16,8 @@ inline QString formatTime(int seconds) {
VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) { VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) {
QVBoxLayout *main_layout = new QVBoxLayout(this); QVBoxLayout *main_layout = new QVBoxLayout(this);
// TODO: figure out why the CameraViewWidget crashed occasionally. // TODO: figure out why the CameraWidget crashed occasionally.
cam_widget = new CameraViewWidget("camerad", VISION_STREAM_ROAD, false, this); cam_widget = new CameraWidget("camerad", VISION_STREAM_ROAD, false, this);
cam_widget->setFixedSize(parent->width(), parent->width() / 1.596); cam_widget->setFixedSize(parent->width(), parent->width() / 1.596);
main_layout->addWidget(cam_widget); main_layout->addWidget(cam_widget);
@ -60,7 +60,7 @@ VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) {
QObject::connect(can, &CANMessages::updated, this, &VideoWidget::updateState); QObject::connect(can, &CANMessages::updated, this, &VideoWidget::updateState);
QObject::connect(slider, &QSlider::sliderReleased, [this]() { can->seekTo(slider->value() / 1000.0); }); QObject::connect(slider, &QSlider::sliderReleased, [this]() { can->seekTo(slider->value() / 1000.0); });
QObject::connect(slider, &QSlider::valueChanged, [=](int value) { time_label->setText(formatTime(value / 1000)); }); QObject::connect(slider, &QSlider::valueChanged, [=](int value) { time_label->setText(formatTime(value / 1000)); });
QObject::connect(cam_widget, &CameraViewWidget::clicked, [this]() { pause(!can->isPaused()); }); QObject::connect(cam_widget, &CameraWidget::clicked, [this]() { pause(!can->isPaused()); });
QObject::connect(play_btn, &QPushButton::clicked, [=]() { pause(!can->isPaused()); }); QObject::connect(play_btn, &QPushButton::clicked, [=]() { pause(!can->isPaused()); });
} }

@ -32,7 +32,7 @@ protected:
void updateState(); void updateState();
void pause(bool pause); void pause(bool pause);
CameraViewWidget *cam_widget; CameraWidget *cam_widget;
QLabel *end_time_label; QLabel *end_time_label;
QPushButton *play_btn; QPushButton *play_btn;
Slider *slider; Slider *slider;

Loading…
Cancel
Save