|
|
@ -14,7 +14,6 @@ |
|
|
|
#include <QtConcurrent> |
|
|
|
#include <QtConcurrent> |
|
|
|
|
|
|
|
|
|
|
|
#include "tools/cabana/streams/replaystream.h" |
|
|
|
#include "tools/cabana/streams/replaystream.h" |
|
|
|
#include "tools/cabana/util.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int MIN_VIDEO_HEIGHT = 100; |
|
|
|
const int MIN_VIDEO_HEIGHT = 100; |
|
|
|
const int THUMBNAIL_MARGIN = 3; |
|
|
|
const int THUMBNAIL_MARGIN = 3; |
|
|
@ -290,12 +289,23 @@ void Slider::paintEvent(QPaintEvent *ev) { |
|
|
|
double min = minimum() / factor; |
|
|
|
double min = minimum() / factor; |
|
|
|
double max = maximum() / factor; |
|
|
|
double max = maximum() / factor; |
|
|
|
|
|
|
|
|
|
|
|
for (auto [begin, end, type] : qobject_cast<ReplayStream *>(can)->getReplay()->getTimeline()) { |
|
|
|
auto fillRange = [&](double begin, double end, const QColor &color) { |
|
|
|
if (begin > max || end < min) |
|
|
|
if (begin > max || end < min) return; |
|
|
|
continue; |
|
|
|
|
|
|
|
r.setLeft(((std::max(min, begin) - min) / (max - min)) * width()); |
|
|
|
r.setLeft(((std::max(min, begin) - min) / (max - min)) * width()); |
|
|
|
r.setRight(((std::min(max, end) - 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; |
|
|
|
QStyleOptionSlider opt; |
|
|
|