mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 21:42:05 +08:00
cabana: display fingerprint and route on the top right (#26133)
This commit is contained in:
@@ -26,7 +26,8 @@ static bool event_filter(const Event *e, void *opaque) {
|
||||
}
|
||||
|
||||
bool CANMessages::loadRoute(const QString &route, const QString &data_dir, bool use_qcam) {
|
||||
replay = new Replay(route, {"can", "roadEncodeIdx"}, {}, nullptr, use_qcam ? REPLAY_FLAG_QCAMERA : 0, data_dir, this);
|
||||
routeName = route;
|
||||
replay = new Replay(route, {"can", "roadEncodeIdx", "carParams"}, {}, nullptr, use_qcam ? REPLAY_FLAG_QCAMERA : 0, data_dir, this);
|
||||
replay->setSegmentCacheLimit(settings.cached_segment_limit);
|
||||
replay->installEventFilter(event_filter, this);
|
||||
QObject::connect(replay, &Replay::segmentsMerged, this, &CANMessages::segmentsMerged);
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
bool eventFilter(const Event *event);
|
||||
|
||||
inline std::pair<double, double> range() const { return {begin_sec, end_sec}; }
|
||||
inline QString route() const { return routeName; }
|
||||
inline QString carFingerprint() const { return replay->carFingerprint().c_str(); }
|
||||
inline double totalSeconds() const { return replay->totalSeconds(); }
|
||||
inline double routeStartTime() const { return replay->routeStartTime() / (double)1e9; }
|
||||
inline double currentSec() const { return current_sec; }
|
||||
@@ -80,6 +82,7 @@ protected:
|
||||
double event_begin_sec = 0;
|
||||
double event_end_sec = 0;
|
||||
bool is_zoomed = false;
|
||||
QString routeName;
|
||||
Replay *replay = nullptr;
|
||||
};
|
||||
|
||||
|
||||
+10
-1
@@ -30,8 +30,16 @@ MainWindow::MainWindow() : QWidget() {
|
||||
right_container->setFixedWidth(640);
|
||||
r_layout = new QVBoxLayout(right_container);
|
||||
|
||||
QHBoxLayout *right_hlayout = new QHBoxLayout();
|
||||
QLabel *fingerprint_label = new QLabel(this);
|
||||
right_hlayout->addWidget(fingerprint_label);
|
||||
|
||||
// TODO: click to select another route.
|
||||
right_hlayout->addWidget(new QLabel(can->route()));
|
||||
QPushButton *settings_btn = new QPushButton("Settings");
|
||||
r_layout->addWidget(settings_btn, 0, Qt::AlignRight);
|
||||
right_hlayout->addWidget(settings_btn, 0, Qt::AlignRight);
|
||||
|
||||
r_layout->addLayout(right_hlayout);
|
||||
|
||||
video_widget = new VideoWidget(this);
|
||||
r_layout->addWidget(video_widget, 0, Qt::AlignTop);
|
||||
@@ -45,6 +53,7 @@ MainWindow::MainWindow() : QWidget() {
|
||||
QObject::connect(detail_widget, &DetailWidget::showChart, charts_widget, &ChartsWidget::addChart);
|
||||
QObject::connect(charts_widget, &ChartsWidget::dock, this, &MainWindow::dockCharts);
|
||||
QObject::connect(settings_btn, &QPushButton::clicked, this, &MainWindow::setOption);
|
||||
QObject::connect(can, &CANMessages::eventsMerged, [=]() { fingerprint_label->setText(can->carFingerprint() ); });
|
||||
}
|
||||
|
||||
void MainWindow::dockCharts(bool dock) {
|
||||
|
||||
@@ -15,6 +15,7 @@ inline QString formatTime(int seconds) {
|
||||
|
||||
VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) {
|
||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||
main_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
// TODO: figure out why the CameraWidget crashed occasionally.
|
||||
cam_widget = new CameraWidget("camerad", VISION_STREAM_ROAD, false, this);
|
||||
|
||||
Reference in New Issue
Block a user