openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.2 KiB

#pragma once
#include <QtWidgets>
#include <ui.h>
#define COLOR_GOOD QColor(255, 255, 255)
#define COLOR_WARNING QColor(218, 202, 37)
#define COLOR_DANGER QColor(201, 34, 49)
class SignalWidget : public QFrame {
Q_OBJECT
public:
SignalWidget(QString text, int strength, QWidget* parent = 0);
void update(QString text, int strength);
QLabel label;
int _strength = 0;
protected:
void paintEvent(QPaintEvent*) override;
private:
QVBoxLayout layout;
const float _dotspace = 37; // spacing between dots
const float _top = 10;
const float _dia = 28; // dot diameter
};
class StatusWidget : public QFrame {
Q_OBJECT
public:
StatusWidget(QString label, QString msg, QColor c, QWidget* parent = 0);
void update(QString label, QString msg, QColor c);
protected:
void paintEvent(QPaintEvent*) override;
private:
QColor color = COLOR_WARNING;
QLabel status;
QLabel substatus;
QVBoxLayout layout;
};
class Sidebar : public QFrame {
Q_OBJECT
public:
explicit Sidebar(QWidget* parent = 0);
signals:
void openSettings();
public slots:
void update(const UIState &s);
private:
SignalWidget *signal;
StatusWidget *temp;
StatusWidget *panda;
StatusWidget *connect;
};