diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 2c52284..62be6d4 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -114,6 +114,10 @@ FlowViewWindow::FlowViewWindow(const QVector *frames, QWidget *parent) connect(ui->check_6, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); connect(ui->check_7, &QCheckBox::stateChanged, this, &FlowViewWindow::changeGraphVisibility); +// ui->timelineSlider->setTracking(true); + connect(ui->timelineSlider, &QSlider::sliderPressed, this, &FlowViewWindow::btnPauseClick); + connect(ui->timelineSlider, &QSlider::valueChanged, this, &FlowViewWindow::gotoFrame); + // Using lambda expression to strip away the possible filter label before passing the ID to updateDetailsWindow connect(ui->listFrameID, &QListWidget::currentTextChanged, [this](QString itemText) @@ -664,6 +668,7 @@ void FlowViewWindow::changeID(QString newID) void FlowViewWindow::btnBackOneClick() { + ui->cbLiveMode->setChecked(false); playbackTimer->stop(); //pushing this button halts automatic playback playbackActive = false; @@ -673,6 +678,7 @@ void FlowViewWindow::btnBackOneClick() void FlowViewWindow::btnPauseClick() { + ui->cbLiveMode->setChecked(false); playbackActive = false; playbackTimer->stop(); updateDataView(); @@ -680,6 +686,7 @@ void FlowViewWindow::btnPauseClick() void FlowViewWindow::btnReverseClick() { + ui->cbLiveMode->setChecked(false); playbackActive = true; playbackForward = false; playbackTimer->start(); @@ -687,6 +694,7 @@ void FlowViewWindow::btnReverseClick() void FlowViewWindow::btnStopClick() { + ui->cbLiveMode->setChecked(false); playbackTimer->stop(); //pushing this button halts automatic playback playbackActive = false; currentPosition = 0; @@ -701,6 +709,7 @@ void FlowViewWindow::btnStopClick() void FlowViewWindow::btnPlayClick() { + ui->cbLiveMode->setChecked(false); playbackActive = true; playbackForward = true; playbackTimer->start(); @@ -708,6 +717,7 @@ void FlowViewWindow::btnPlayClick() void FlowViewWindow::btnFwdOneClick() { + ui->cbLiveMode->setChecked(false); playbackTimer->stop(); playbackActive = false; updatePosition(true); @@ -773,6 +783,9 @@ void FlowViewWindow::updateDataView() ui->flowView->setReference(refBytes, false); ui->flowView->updateData(currBytes, true); + ui->timelineSlider->setMaximum(frameCache.count() - 1); + ui->timelineSlider->setValue(currentPosition); + for (int i = 0; i < 8; i++) { if (currBytes[i] == triggerValues[i]) @@ -789,6 +802,13 @@ void FlowViewWindow::updateDataView() } +void FlowViewWindow::gotoFrame(int frame) { + if (frameCache.count() >= frame) currentPosition = frame; + else currentPosition = 0; + + if (ui->cbSync->checkState() == Qt::Checked) emit sendCenterTimeID(frameCache[currentPosition].frameId(), frameCache[currentPosition].timeStamp().microSeconds() / 1000000.0); +} + void FlowViewWindow::updatePosition(bool forward) { @@ -832,6 +852,7 @@ void FlowViewWindow::updatePosition(bool forward) memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), 8); if (ui->cbSync->checkState() == Qt::Checked) emit sendCenterTimeID(frameCache[currentPosition].frameId(), frameCache[currentPosition].timeStamp().microSeconds() / 1000000.0); + ui->timelineSlider->setValue(currentPosition); } void FlowViewWindow::updateGraphLocation() diff --git a/re/flowviewwindow.h b/re/flowviewwindow.h index d2b0a16..e2705c1 100644 --- a/re/flowviewwindow.h +++ b/re/flowviewwindow.h @@ -3,6 +3,7 @@ #include #include +#include #include "qcustomplot.h" #include "can_structs.h" @@ -68,6 +69,7 @@ private: void refreshIDList(); void updateFrameLabel(); void updatePosition(bool forward); + void gotoFrame(int frame); void updateDataView(); void removeAllGraphs(); void createGraph(int); diff --git a/ui/flowviewwindow.ui b/ui/flowviewwindow.ui index 9e54b26..d83642d 100644 --- a/ui/flowviewwindow.ui +++ b/ui/flowviewwindow.ui @@ -6,63 +6,66 @@ 0 0 - 1078 - 623 + 906 + 568 Flow View - - - - - - - - - - 0 - 0 - - - - Frame IDs Found: - - - - - - - - 0 - 0 - - - - - 120 - 16777215 - - - - - - - + + + QLayout::SetNoConstraint + + + + + Qt::Horizontal + + - - + + + + + 0 + 0 + + + + + 200 + 16777215 + + Playback Control + + Qt::AlignCenter + + + false + + + + 0 + 0 + + + + + 40 + 16777215 + + @@ -74,6 +77,18 @@ + + + 0 + 0 + + + + + 60 + 16777215 + + @@ -85,6 +100,18 @@ + + + 0 + 0 + + + + + 40 + 16777215 + + @@ -100,6 +127,18 @@ + + + 0 + 0 + + + + + 40 + 16777215 + + @@ -111,6 +150,18 @@ + + + 0 + 0 + + + + + 60 + 16777215 + + @@ -122,6 +173,18 @@ + + + 0 + 0 + + + + + 40 + 16777215 + + @@ -148,6 +211,18 @@ + + + 0 + 0 + + + + + 200 + 16777215 + + 5000 @@ -197,6 +272,12 @@ + + + 0 + 0 + + Live Mode (No Playback) @@ -217,6 +298,12 @@ + + + 0 + 0 + + Graph by timestamp @@ -237,8 +324,8 @@ - - + + @@ -300,12 +387,6 @@ 0 - - - 40 - 0 - - 40 @@ -328,12 +409,6 @@ 0 - - - 40 - 0 - - 40 @@ -356,12 +431,6 @@ 0 - - - 40 - 0 - - 40 @@ -384,12 +453,6 @@ 0 - - - 40 - 0 - - 40 @@ -448,12 +511,6 @@ 0 - - - 40 - 0 - - 40 @@ -470,12 +527,6 @@ 0 - - - 40 - 0 - - 40 @@ -492,12 +543,6 @@ 0 - - - 40 - 0 - - 40 @@ -514,12 +559,6 @@ 0 - - - 40 - 0 - - 40 @@ -587,12 +626,6 @@ 0 - - - 40 - 0 - - 40 @@ -609,12 +642,6 @@ 0 - - - 40 - 0 - - 40 @@ -631,12 +658,6 @@ 0 - - - 40 - 0 - - 40 @@ -653,12 +674,6 @@ 0 - - - 40 - 0 - - 40 @@ -711,12 +726,6 @@ 0 - - - 40 - 0 - - 40 @@ -733,12 +742,6 @@ 0 - - - 40 - 0 - - 40 @@ -755,12 +758,6 @@ 0 - - - 40 - 0 - - 40 @@ -777,12 +774,6 @@ 0 - - - 40 - 0 - - 40 @@ -798,6 +789,12 @@ + + + 0 + 0 + + Data Seek Values @@ -844,12 +841,6 @@ 0 - - - 40 - 0 - - 40 @@ -1034,6 +1025,12 @@ + + + 0 + 0 + + @@ -1088,6 +1085,12 @@ + + + 0 + 0 + + @@ -1142,6 +1145,12 @@ + + + 0 + 0 + + @@ -1196,6 +1205,12 @@ + + + 0 + 0 + + @@ -1250,6 +1265,12 @@ + + + 0 + 0 + + @@ -1304,6 +1325,12 @@ + + + 0 + 0 + + @@ -1358,6 +1385,12 @@ + + + 0 + 0 + + @@ -1412,6 +1445,12 @@ + + + 0 + 0 + + @@ -1468,92 +1507,131 @@ - - + + + + QLayout::SetMaximumSize + - - - - - - - - - - - - - - - 0 - 0 - - - - - - - - 0 - 0 - - - - Chart range - - - - - - - - 0 - 0 - - - - - 75 - true - - - - 50 - - - - - - - - - - - 0 - 0 - - - - 1 - - - 500 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - 10 - - - - + + + + + + + + + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + Chart range + + + + + + + + 0 + 0 + + + + + 75 + true + + + + 50 + + + + + + + + + + + 0 + 0 + + + + 1 + + + 500 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 10 + + + + + + + + + Timeline: + + + + + + + + + + 0 + 0 + + + + Frame IDs Found: + + + + + + + + 0 + 0 + + + + + 120 + 16777215 + + +