diff --git a/tools/cabana/videowidget.cc b/tools/cabana/videowidget.cc index 3dddc0fb64..552d86b5d7 100644 --- a/tools/cabana/videowidget.cc +++ b/tools/cabana/videowidget.cc @@ -341,7 +341,9 @@ void StreamCameraView::drawThumbnail(QPainter &p) { p.drawPixmap(x, y, thumb); p.setPen(QPen(palette().color(QPalette::BrightText), 2)); - p.drawText(x, y, thumb.width(), thumb.height() - THUMBNAIL_MARGIN, Qt::AlignHCenter | Qt::AlignBottom, QString::number(seconds)); + p.setFont(QFont(font().family(), 10)); + p.drawText(x, y, thumb.width(), thumb.height() - THUMBNAIL_MARGIN, + Qt::AlignHCenter | Qt::AlignBottom, QString::number(seconds, 'f', 3)); } } diff --git a/tools/replay/replay.h b/tools/replay/replay.h index 0b4906532e..61c538c0a7 100644 --- a/tools/replay/replay.h +++ b/tools/replay/replay.h @@ -73,7 +73,7 @@ public: inline float getSpeed() const { return speed_; } inline const SegmentMap &segments() const { return segments_; } inline const std::string &carFingerprint() const { return car_fingerprint_; } - inline const std::shared_ptr> getTimeline() const { return timeline_.get(); } + inline const std::shared_ptr> getTimeline() const { return timeline_.getEntries(); } inline const std::optional findAlertAtTime(double sec) const { return timeline_.findAlertAtTime(sec); } // Event callback functions diff --git a/tools/replay/timeline.cc b/tools/replay/timeline.cc index a984c20016..d836de972b 100644 --- a/tools/replay/timeline.cc +++ b/tools/replay/timeline.cc @@ -18,7 +18,7 @@ void Timeline::initialize(const Route &route, uint64_t route_start_ts, bool loca } std::optional Timeline::find(double cur_ts, FindFlag flag) const { - for (const auto &entry : *get()) { + for (const auto &entry : *getEntries()) { if (entry.type == TimelineType::Engaged) { if (flag == FindFlag::nextEngagement && entry.start_time > cur_ts) { return entry.start_time; @@ -38,7 +38,7 @@ std::optional Timeline::find(double cur_ts, FindFlag flag) const { } std::optional Timeline::findAlertAtTime(double target_time) const { - for (const auto &entry : *get()) { + for (const auto &entry : *getEntries()) { if (entry.start_time > target_time) break; if (entry.end_time >= target_time && entry.type >= TimelineType::AlertInfo) { return entry; @@ -72,8 +72,9 @@ void Timeline::buildTimeline(const Route &route, uint64_t route_start_ts, bool l } // Sort and finalize the timeline entries - std::sort(staging_entries_.begin(), staging_entries_.end(), [](auto &a, auto &b) { return a.start_time < b.start_time; }); - timeline_entries_ = std::make_shared>(staging_entries_); + auto entries = std::make_shared>(staging_entries_); + std::sort(entries->begin(), entries->end(), [](auto &a, auto &b) { return a.start_time < b.start_time; }); + timeline_entries_ = entries; callback(log); // Notify the callback once the log is processed } diff --git a/tools/replay/timeline.h b/tools/replay/timeline.h index b2535fd8b0..689a80635f 100644 --- a/tools/replay/timeline.h +++ b/tools/replay/timeline.h @@ -27,7 +27,7 @@ public: std::function)> callback); std::optional find(double cur_ts, FindFlag flag) const; std::optional findAlertAtTime(double target_time) const; - const std::shared_ptr> get() const { return timeline_entries_; } + const std::shared_ptr> getEntries() const { return timeline_entries_; } private: void buildTimeline(const Route &route, uint64_t route_start_ts, bool local_cache,