implement seeking in playback window and add playback line in graphing view

This commit is contained in:
Leopixelo
2026-06-08 15:13:12 +02:00
parent af048e8615
commit 614f2fef54
8 changed files with 137 additions and 0 deletions
+29
View File
@@ -69,6 +69,13 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
itemTracer->setStyle(QCPItemTracer::tsCircle);
itemTracer->setSize(20);
playbackPen.setWidth(1);
playbackPen.setColor(Qt::red);
playbackLine = new QCPItemStraightLine(ui->graphingView);
playbackLine->setSelectable(false);
playbackLine->setPen(playbackPen);
playbackLine->setVisible(false);
// connect slot that ties some axis selections together (especially opposite axes):
connect(ui->graphingView, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged()));
//connect up the mouse controls
@@ -329,6 +336,28 @@ void GraphingWindow::gotCenterTimeID(uint32_t ID, double timestamp)
ui->graphingView->replot();
}
void GraphingWindow::gotPlaybackTimestamp(double timestamp)
{
if (timestamp == INFINITY) {
playbackLine->setVisible(false);
return;
}
playbackLine->setVisible(true);
// timestamp is always givin in seconds
if (Utility::timeStyle == TS_MICROS)
timestamp *= 1000000;
else if (Utility::timeStyle == TS_MILLIS)
timestamp *= 1000;
else if (Utility::timeStyle == TS_CLOCK)
timestamp += 3600; // offset of one hour needed
playbackLine->point1->setCoords(timestamp, 0);
playbackLine->point2->setCoords(timestamp, 1);
ui->graphingView->replot();
}
void GraphingWindow::titleDoubleClick(QMouseEvent* event, QCPTextElement* title)
{
Q_UNUSED(event)