diff --git a/flowviewwindow.cpp b/flowviewwindow.cpp index 4eea706..1866564 100644 --- a/flowviewwindow.cpp +++ b/flowviewwindow.cpp @@ -22,10 +22,6 @@ FlowViewWindow::FlowViewWindow(QVector *frames, QWidget *parent) : memset(refBytes, 0, 8); memset(currBytes, 0, 8); - refreshIDList(); - - updateFrameLabel(); - //ui->graphView->setInteractions(); ui->graphView->xAxis->setRange(0, 8); @@ -59,6 +55,13 @@ FlowViewWindow::FlowViewWindow(QVector *frames, QWidget *parent) : } +void FlowViewWindow::showEvent(QShowEvent* event) +{ + QDialog::showEvent(event); + refreshIDList(); + updateFrameLabel(); +} + FlowViewWindow::~FlowViewWindow() { delete ui; diff --git a/flowviewwindow.h b/flowviewwindow.h index f1cc229..c8ded34 100644 --- a/flowviewwindow.h +++ b/flowviewwindow.h @@ -15,6 +15,7 @@ class FlowViewWindow : public QDialog public: explicit FlowViewWindow(QVector *frames, QWidget *parent = 0); ~FlowViewWindow(); + void showEvent(QShowEvent*); private slots: void btnBackOneClick(); diff --git a/frameinfowindow.cpp b/frameinfowindow.cpp index 7b3385e..719fe0a 100644 --- a/frameinfowindow.cpp +++ b/frameinfowindow.cpp @@ -8,6 +8,11 @@ FrameInfoWindow::FrameInfoWindow(QVector *frames, QWidget *parent) : { ui->setupUi(this); modelFrames = frames; +} + +void FrameInfoWindow::showEvent(QShowEvent* event) +{ + QDialog::showEvent(event); refreshIDList(); } diff --git a/frameinfowindow.h b/frameinfowindow.h index 0a9a0f8..a2f2155 100644 --- a/frameinfowindow.h +++ b/frameinfowindow.h @@ -16,6 +16,7 @@ class FrameInfoWindow : public QDialog public: explicit FrameInfoWindow(QVector *frames, QWidget *parent = 0); ~FrameInfoWindow(); + void showEvent(QShowEvent*); private slots: void updateDetailsWindow(QListWidgetItem *); diff --git a/graphingwindow.cpp b/graphingwindow.cpp index 3d84ca2..b5abc31 100644 --- a/graphingwindow.cpp +++ b/graphingwindow.cpp @@ -60,6 +60,10 @@ GraphingWindow::~GraphingWindow() delete ui; } +void GraphingWindow::showEvent(QShowEvent* event) +{ + QDialog::showEvent(event); +} void GraphingWindow::titleDoubleClick(QMouseEvent* event, QCPPlotTitle* title) { diff --git a/graphingwindow.h b/graphingwindow.h index 4748049..461559b 100644 --- a/graphingwindow.h +++ b/graphingwindow.h @@ -31,6 +31,7 @@ class GraphingWindow : public QDialog public: explicit GraphingWindow(QVector *, QWidget *parent = 0); ~GraphingWindow(); + void showEvent(QShowEvent*); private slots: void titleDoubleClick(QMouseEvent *event, QCPPlotTitle *title); diff --git a/mainwindow.cpp b/mainwindow.cpp index 7377f60..fd52dcd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -22,13 +22,8 @@ fuzzy scope - Try to find potential places where a given value might be stored - Things currently broken or in need of attention: -1. It should be possible to stop the capture at any time. -2. The details window should tell you the min/max/avg time between frames of this ID -3. Frame reception gets weird somewhere between 100k and 150k frames. Increase prealloc and re-test -4. Expanding the main window (while having a large capture going?) could lock up the program -5. Clicking one of the three main checkboxes (auto scroll, interpret, overwrite) locks up reception -6. The windows that deal with canbus data should update based on incoming frames. It should not be required to load files to use these windows -7. Overall, test more often with large captures coming in. Use Kvaser to simulate incoming data in large quantities. +1. The details window should tell you the min/max/avg time between frames of this ID +2. The windows that deal with canbus data should update based on incoming frames. It should not be required to load files to use these windows */ @@ -79,7 +74,7 @@ MainWindow::MainWindow(QWidget *parent) : worker->moveToThread(&serialWorkerThread); connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater); connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection); - connect(worker, &SerialWorker::receivedFrames, this, &MainWindow::gotFrames, Qt::QueuedConnection); + connect(worker, &SerialWorker::frameUpdateTick, this, &MainWindow::gotFrames, Qt::QueuedConnection); connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection); connect(this, &MainWindow::sendCANFrame, worker, &SerialWorker::sendFrame, Qt::QueuedConnection); connect(worker, &SerialWorker::connectionSuccess, this, &MainWindow::connectionSucceeded, Qt::QueuedConnection); @@ -153,7 +148,7 @@ void MainWindow::updateBaudLabel(int baud0, int baud1) //most of the work is handled elsewhere. Need only to update the # of frames //and maybe auto scroll -void MainWindow::gotFrames(int FPS) +void MainWindow::gotFrames(int FPS, int framesSinceLastUpdate) { ui->lbNumFrames->setText(QString::number(model->rowCount())); if (ui->cbAutoScroll->isChecked()) ui->canFramesView->scrollToBottom(); diff --git a/mainwindow.h b/mainwindow.h index a2655cb..8541939 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -46,7 +46,7 @@ private slots: void connectionSucceeded(int, int); public slots: - void gotFrames(int); + void gotFrames(int, int); signals: diff --git a/serialworker.cpp b/serialworker.cpp index b497880..de2ec11 100644 --- a/serialworker.cpp +++ b/serialworker.cpp @@ -350,12 +350,9 @@ void SerialWorker::handleTick() //qDebug() << "Tick!"; framesPerSec += gotFrames * 1000 / elapsedTime->elapsed() - (framesPerSec / 4); elapsedTime->restart(); - //if (gotFrames > 0) - //{ - emit receivedFrames(framesPerSec / 4); //misnamed now. Just notifies of FPS and that frames might exist - canModel->sendBulkRefresh(gotFrames); - gotFrames = 0; - //} + emit frameUpdateTick(framesPerSec / 4, gotFrames); //sends stats to interested parties + canModel->sendBulkRefresh(gotFrames); + gotFrames = 0; } //totally shuts down the whole thing diff --git a/serialworker.h b/serialworker.h index 65eda45..10e7704 100644 --- a/serialworker.h +++ b/serialworker.h @@ -33,7 +33,7 @@ public: signals: //we emit signals void error(const QString &); - void receivedFrames(int); //since the last tick we got at least one more frame + void frameUpdateTick(int, int); //update interested parties about the # of frames that have come in void connectionSuccess(int, int); void connectionFailure(); void deviceInfo(int, int);