cabana: highlight dowloaded segments (#30459)
highlight dowloaded segments old-commit-hash: 86a5ac383e938d16b19b69bb43e507abe8cdd63b
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include "tools/cabana/streams/replaystream.h"
|
||||
#include "tools/cabana/util.h"
|
||||
|
||||
const int MIN_VIDEO_HEIGHT = 100;
|
||||
const int THUMBNAIL_MARGIN = 3;
|
||||
@@ -290,12 +289,23 @@ void Slider::paintEvent(QPaintEvent *ev) {
|
||||
double min = minimum() / factor;
|
||||
double max = maximum() / factor;
|
||||
|
||||
for (auto [begin, end, type] : qobject_cast<ReplayStream *>(can)->getReplay()->getTimeline()) {
|
||||
if (begin > max || end < min)
|
||||
continue;
|
||||
auto fillRange = [&](double begin, double end, const QColor &color) {
|
||||
if (begin > max || end < min) return;
|
||||
r.setLeft(((std::max(min, begin) - min) / (max - min)) * width());
|
||||
r.setRight(((std::min(max, end) - min) / (max - min)) * width());
|
||||
p.fillRect(r, timeline_colors[(int)type]);
|
||||
p.fillRect(r, color);
|
||||
};
|
||||
|
||||
const auto replay = qobject_cast<ReplayStream *>(can)->getReplay();
|
||||
for (auto [begin, end, type] : replay->getTimeline()) {
|
||||
fillRange(begin, end, timeline_colors[(int)type]);
|
||||
}
|
||||
|
||||
QColor empty_color = palette().color(QPalette::Window);
|
||||
empty_color.setAlpha(160);
|
||||
for (const auto &[n, seg] : replay->segments()) {
|
||||
if (!(seg && seg->isLoaded()))
|
||||
fillRange(n * 60.0, (n + 1) * 60.0, empty_color);
|
||||
}
|
||||
|
||||
QStyleOptionSlider opt;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <QFrame>
|
||||
#include <QSlider>
|
||||
#include <QTabBar>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "selfdrive/ui/qt/widgets/cameraview.h"
|
||||
#include "tools/cabana/util.h"
|
||||
|
||||
Reference in New Issue
Block a user