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
+39
View File
@@ -407,10 +407,24 @@ void FramePlaybackWindow::EndOfFrameCache()
}
}
void FramePlaybackWindow::gotCenterTimeID(uint32_t ID, double timestamp)
{
Q_UNUSED(ID);
// isPlaying = false;
// wantPlaying = false;
// haveIncomingTraffic = false;
playbackObject.seekPlayback(timestamp);
}
void FramePlaybackWindow::getStatusUpdate(int frameNum)
{
currentPosition = frameNum;
updateFrameLabel();
QCanBusFrame::TimeStamp ts = seqItems[currentSeqNum].data[currentPosition].timeStamp();
emit sendCurrentTimestamp((double)(ts.seconds()) + ts.microSeconds() / 1000000.0f);
}
void FramePlaybackWindow::updateFrameLabel()
@@ -426,15 +440,40 @@ void FramePlaybackWindow::updateFrameLabel()
{
ui->lblCurrPlayback->setText("");
ui->lblPosition->setText("");
ui->timePosition->setText("");
return;
}
ui->lblCurrPlayback->setText(currentSeqItem->filename);
// convert current and last timestamp to text according to time format
QVariant currentTimestamp = Utility::formatTimestamp(seqItems[row].data[currentPosition].timeStamp().microSeconds());
QString currentTimestampText;
if (currentTimestamp.typeId() == QMetaType::Double)
currentTimestampText = QString::number(currentTimestamp.toDouble(), 'f', 5);
else if (currentTimestamp.typeId() == QMetaType::LongLong || currentTimestamp.typeId() == QMetaType::ULongLong)
currentTimestampText = QString::number(currentTimestamp.toLongLong());
else if (currentTimestamp.typeId() == QMetaType::QDateTime)
currentTimestampText = currentTimestamp.toDateTime().toString(Utility::timeFormat);
else
currentTimestampText = currentTimestamp.toString();
QVariant lastTimestamp = Utility::formatTimestamp(seqItems[row].data.last().timeStamp().microSeconds());
QString lastTimestampText;
if (lastTimestamp.typeId() == QMetaType::Double)
lastTimestampText = QString::number(lastTimestamp.toDouble(), 'f', 5);
else if (lastTimestamp.typeId() == QMetaType::LongLong || lastTimestamp.typeId() == QMetaType::ULongLong)
lastTimestampText = QString::number(lastTimestamp.toLongLong());
else if (lastTimestamp.typeId() == QMetaType::QDateTime)
lastTimestampText = lastTimestamp.toDateTime().toString(Utility::timeFormat);
else
lastTimestampText = lastTimestamp.toString();
if (wantPlaying && !isPlaying)
ui->lblPosition->setText(QString::number(currentPosition) + tr(" of ") + QString::number(seqItems[row].data.count()) + " (WAITING)");
else
ui->lblPosition->setText(QString::number(currentPosition) + tr(" of ") + QString::number(seqItems[row].data.count()));
ui->timePosition->setText(currentTimestampText + tr(" of ") + lastTimestampText);
}
void FramePlaybackWindow::seqTableCellClicked(int row, int col)