mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-28 18:33:45 +08:00
cabana: fix thumbnail font size and timeline sorting issues (#34086)
fix thumbnail font size and timeline sorting issues
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::vector<Timeline::Entry>> getTimeline() const { return timeline_.get(); }
|
||||
inline const std::shared_ptr<std::vector<Timeline::Entry>> getTimeline() const { return timeline_.getEntries(); }
|
||||
inline const std::optional<Timeline::Entry> findAlertAtTime(double sec) const { return timeline_.findAlertAtTime(sec); }
|
||||
|
||||
// Event callback functions
|
||||
|
||||
@@ -18,7 +18,7 @@ void Timeline::initialize(const Route &route, uint64_t route_start_ts, bool loca
|
||||
}
|
||||
|
||||
std::optional<uint64_t> 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<uint64_t> Timeline::find(double cur_ts, FindFlag flag) const {
|
||||
}
|
||||
|
||||
std::optional<Timeline::Entry> 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<std::vector<Entry>>(staging_entries_);
|
||||
auto entries = std::make_shared<std::vector<Entry>>(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
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
std::function<void(std::shared_ptr<LogReader>)> callback);
|
||||
std::optional<uint64_t> find(double cur_ts, FindFlag flag) const;
|
||||
std::optional<Entry> findAlertAtTime(double target_time) const;
|
||||
const std::shared_ptr<std::vector<Entry>> get() const { return timeline_entries_; }
|
||||
const std::shared_ptr<std::vector<Entry>> getEntries() const { return timeline_entries_; }
|
||||
|
||||
private:
|
||||
void buildTimeline(const Route &route, uint64_t route_start_ts, bool local_cache,
|
||||
|
||||
Reference in New Issue
Block a user