Date: Tue, 22 Nov 2022 02:48:19 +0800
Subject: [PATCH 010/201] Cabana: display dashes if no value available (#26557)
show dot if no value
---
tools/cabana/chartswidget.cc | 45 ++++++++++++++++++------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/tools/cabana/chartswidget.cc b/tools/cabana/chartswidget.cc
index 3029d9db89..5d530a8c8a 100644
--- a/tools/cabana/chartswidget.cc
+++ b/tools/cabana/chartswidget.cc
@@ -420,34 +420,35 @@ void ChartView::mouseMoveEvent(QMouseEvent *ev) {
const auto plot_area = chart()->plotArea();
if (!is_zooming && plot_area.contains(ev->pos())) {
- double sec = chart()->mapToValue(ev->pos()).x();
QStringList text_list;
- QPointF pos = plot_area.bottomRight();
- double tm = 0.0;
-
+ QPointF pos = {};
+ const double sec = chart()->mapToValue(ev->pos()).x();
for (auto &s : sigs) {
- auto value = std::upper_bound(s.vals.begin(), s.vals.end(), sec, [](double x, auto &p) { return x < p.x(); });
- if (value != s.vals.end()) {
- text_list.push_back(QString(" %1 : %2 ").arg(sigs.size() > 1 ? s.sig->name.c_str() : "Value").arg(value->y()));
- tm = value->x();
- auto y_pos = chart()->mapToPosition(*value);
- if (y_pos.y() < pos.y()) pos = y_pos;
+ QString value = "--";
+ // use reverse iterator to find last item <= sec.
+ auto it = std::lower_bound(s.vals.rbegin(), s.vals.rend(), sec, [](auto &p, double x) { return p.x() > x; });
+ if (it != s.vals.rend() && it->x() >= axis_x->min()) {
+ value = QString::number(it->y());
+ auto value_pos = chart()->mapToPosition(*it);
+ if (value_pos.x() > pos.x()) pos = value_pos;
}
+ text_list.push_back(QString(" %1 : %2 ").arg(sigs.size() > 1 ? s.sig->name.c_str() : "Value").arg(value));
}
+ if (pos.x() == 0) pos = ev->pos();
- if (!text_list.isEmpty()) {
- value_text->setHtml(" Time: " +
- QString::number(tm, 'f', 3) + "
" + text_list.join("
") + "
");
- track_line->setLine(pos.x(), plot_area.top(), pos.x(), plot_area.bottom());
- int text_x = pos.x() + 8;
- QRectF text_rect = value_text->boundingRect();
- if ((text_x + text_rect.width()) > plot_area.right()) {
- text_x = pos.x() - text_rect.width() - 8;
- }
- value_text->setPos(text_x, pos.y() - text_rect.height() / 2);
- track_ellipse->setRect(pos.x() - 5, pos.y() - 5, 10, 10);
+ QString time = QString::number(chart()->mapToValue(pos).x(), 'f', 3);
+ value_text->setHtml(QString(" Time: %1
%2
")
+ .arg(time).arg(text_list.join("
")));
+
+ QRectF text_rect = value_text->boundingRect();
+ int text_x = pos.x() + 8;
+ if ((text_x + text_rect.width()) > plot_area.right()) {
+ text_x = pos.x() - text_rect.width() - 8;
}
- item_group->setVisible(!text_list.isEmpty());
+ value_text->setPos(text_x, pos.y() - text_rect.height() / 2);
+ track_line->setLine(pos.x(), plot_area.top(), pos.x(), plot_area.bottom());
+ track_ellipse->setRect(pos.x() - 5, pos.y() - 5, 10, 10);
+ item_group->setVisible(true);
} else {
item_group->setVisible(false);
}
From 96c9b8c50e0413ba92e7729e1820884d88598989 Mon Sep 17 00:00:00 2001
From: protonchang <2095341+protonchang@users.noreply.github.com>
Date: Tue, 22 Nov 2022 02:48:30 +0800
Subject: [PATCH 011/201] Update CHT translations (#26537)
* Add missing translations
* Fix some CHS -> CHT wording
---
selfdrive/ui/translations/main_zh-CHT.ts | 30 ++++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts
index 46fb5578a3..0379e926c4 100644
--- a/selfdrive/ui/translations/main_zh-CHT.ts
+++ b/selfdrive/ui/translations/main_zh-CHT.ts
@@ -113,7 +113,7 @@
Decline, uninstall %1
- 拒絕並卸載 %1
+ 拒絕並解除安裝 %1