From 315b6971dad7ea33af1db6332ab5885be3f72dd9 Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 2 Dec 2024 20:02:47 -0500 Subject: [PATCH] Add buttons for switching graphing of all bytes on/off, make timeline sync properly --- re/flowviewwindow.cpp | 45 +++++++- re/flowviewwindow.h | 3 + ui/flowviewwindow.ui | 244 ++++++++++++++++++++++-------------------- 3 files changed, 174 insertions(+), 118 deletions(-) diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index 264c209..83fe9c1 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -97,6 +97,9 @@ FlowViewWindow::FlowViewWindow(const QVector *frames, QWidget *parent) ui->tableBytes->setColumnWidth(4, 70); ui->tableBytes->setColumnWidth(5, 80); + //make slider output constant updates while dragging the value around + ui->timelineSlider->setTracking(true); + connect(ui->btnBackOne, SIGNAL(clicked(bool)), this, SLOT(btnBackOneClick())); connect(ui->btnPause, SIGNAL(clicked(bool)), this, SLOT(btnPauseClick())); connect(ui->btnReverse, SIGNAL(clicked(bool)), this, SLOT(btnReverseClick())); @@ -109,9 +112,10 @@ FlowViewWindow::FlowViewWindow(const QVector *frames, QWidget *parent) connect(ui->graphView, SIGNAL(plottableDoubleClick(QCPAbstractPlottable*,QMouseEvent*)), this, SLOT(plottableDoubleClick(QCPAbstractPlottable*,QMouseEvent*))); connect(ui->tableBytes, SIGNAL(cellChanged(int,int)), this, SLOT(handleTableCellChange(int,int))); connect(ui->graphRangeSlider, &QSlider::valueChanged, this, &FlowViewWindow::graphRangeChanged); -// ui->timelineSlider->setTracking(true); connect(ui->timelineSlider, &QSlider::sliderPressed, this, &FlowViewWindow::btnPauseClick); connect(ui->timelineSlider, &QSlider::valueChanged, this, &FlowViewWindow::gotoFrame); + connect(ui->btnAllGraphs, SIGNAL(clicked(bool)), this, SLOT(selectAllGraphs())); + connect(ui->btnNoGraphs, SIGNAL(clicked(bool)), this, SLOT(selectNoGraphs())); // Using lambda expression to strip away the possible filter label before passing the ID to updateDetailsWindow connect(ui->listFrameID, &QListWidget::currentTextChanged, @@ -264,6 +268,32 @@ void FlowViewWindow::handleTableCellChange(int row, int col) } } +void FlowViewWindow::selectAllGraphs() +{ + for (int i = 0; i < 64; i++) + { + if (graphRef[i]) + { + graphRef[i]->setVisible(true); + ui->tableBytes->item(i, TABLE_BYTE::GRAPH_EN)->setCheckState(Qt::Checked); + } + } + ui->graphView->replot(); +} + +void FlowViewWindow::selectNoGraphs() +{ + for (int i = 0; i < 64; i++) + { + if (graphRef[i]) + { + graphRef[i]->setVisible(false); + ui->tableBytes->item(i, TABLE_BYTE::GRAPH_EN)->setCheckState(Qt::Unchecked); + } + } + ui->graphView->replot(); +} + void FlowViewWindow::setupByteTable(int bytes) { inhibitChangeCallback = true; @@ -833,7 +863,10 @@ 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); + processNewPosition(); + + updateDataView(); + updateGraphLocation(); } void FlowViewWindow::updatePosition(bool forward) @@ -850,6 +883,13 @@ void FlowViewWindow::updatePosition(bool forward) else if (ui->cbLoopPlayback->isChecked()) currentPosition = frameCache.count() - 1; } + processNewPosition(); + + ui->timelineSlider->setValue(currentPosition); +} + +void FlowViewWindow::processNewPosition() +{ if (ui->cbAutoRef->isChecked()) { memcpy(refBytes, currBytes, 64); @@ -885,7 +925,6 @@ void FlowViewWindow::updatePosition(bool forward) memcpy(currBytes, frameCache.at(currentPosition).payload().constData(), frameCache.at(currentPosition).payload().length()); 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 2e71677..bb0c865 100644 --- a/re/flowviewwindow.h +++ b/re/flowviewwindow.h @@ -52,6 +52,8 @@ private slots: void graphRangeChanged(int range); void changeGraphVisibility(int state); void handleTableCellChange(int row, int col); + void selectAllGraphs(); + void selectNoGraphs(); signals: void sendCenterTimeID(uint32_t ID, double timestamp); @@ -80,6 +82,7 @@ private slots: void refreshIDList(); void updateFrameLabel(); void updatePosition(bool forward); + void processNewPosition(); void gotoFrame(int frame); void updateDataView(); void removeAllGraphs(); diff --git a/ui/flowviewwindow.ui b/ui/flowviewwindow.ui index 8a9738a..15e0573 100644 --- a/ui/flowviewwindow.ui +++ b/ui/flowviewwindow.ui @@ -17,73 +17,6 @@ QLayout::SizeConstraint::SetNoConstraint - - - - Timeline: - - - - - - - - - Auto Reference - - - - - - - - 0 - 0 - - - - Live Mode (No Playback) - - - - - - - - 0 - 0 - - - - Synchronize windows - - - - - - - - 0 - 0 - - - - Graph by timestamp - - - - - - - - - - - - Qt::Orientation::Horizontal - - - @@ -332,7 +265,134 @@ - + + + + 0 + + + 6 + + + 30 + + + false + + + + Byte + + + + + Val + + + + + Ref + + + + + Seek + + + + + Graph? + + + + + Color + + + + + + + + + + Auto Reference + + + + + + + + 0 + 0 + + + + Live Mode (No Playback) + + + + + + + + 0 + 0 + + + + Synchronize windows + + + + + + + + 0 + 0 + + + + Graph by timestamp + + + + + + + + + + + + Qt::Orientation::Horizontal + + + + + + + Timeline: + + + + + + + Select All Graphs + + + + + + + Deselect All Graphs + + + + @@ -365,7 +425,7 @@ - + QLayout::SizeConstraint::SetMaximumSize @@ -452,52 +512,6 @@ - - - - 0 - - - 6 - - - 30 - - - false - - - - Byte - - - - - Val - - - - - Ref - - - - - Seek - - - - - Graph? - - - - - Color - - - -