Fixes to frame capture bugs introduced by last commit. Naughty!

This commit is contained in:
Collin Kidder
2015-06-30 20:24:16 -04:00
parent 46a25cc1e5
commit cc6c8db1fc
3 changed files with 18 additions and 3 deletions
+11 -2
View File
@@ -28,6 +28,7 @@ CANFrameModel::CANFrameModel(QObject *parent)
useHexMode = true; useHexMode = true;
timeSeconds = false; timeSeconds = false;
timeOffset = 0; timeOffset = 0;
needFilterRefresh = false;
} }
void CANFrameModel::setHexMode(bool mode) void CANFrameModel::setHexMode(bool mode)
@@ -245,7 +246,7 @@ void CANFrameModel::addFrame(CANFrame &frame, bool autoRefresh = false)
if (!filters.contains(frame.ID)) if (!filters.contains(frame.ID))
{ {
filters.insert(frame.ID, true); filters.insert(frame.ID, true);
emit updatedFiltersList(); needFilterRefresh = true;
} }
if (!overwriteDups) if (!overwriteDups)
@@ -369,7 +370,7 @@ void CANFrameModel::insertFrames(const QVector<CANFrame> &newFrames)
if (!filters.contains(newFrames[i].ID)) if (!filters.contains(newFrames[i].ID))
{ {
filters.insert(newFrames[i].ID, true); filters.insert(newFrames[i].ID, true);
emit updatedFiltersList(); needFilterRefresh = true;
} }
if (filters[newFrames[i].ID]) if (filters[newFrames[i].ID])
{ {
@@ -380,6 +381,7 @@ void CANFrameModel::insertFrames(const QVector<CANFrame> &newFrames)
beginInsertRows(QModelIndex(), filteredFrames.count() + 1, filteredFrames.count() + insertedFiltered); beginInsertRows(QModelIndex(), filteredFrames.count() + 1, filteredFrames.count() + insertedFiltered);
endInsertRows(); endInsertRows();
if (needFilterRefresh) emit updatedFiltersList();
} }
void CANFrameModel::loadFilterFile(QString filename) void CANFrameModel::loadFilterFile(QString filename)
@@ -429,6 +431,13 @@ void CANFrameModel::saveFilterFile(QString filename)
outFile->close(); outFile->close();
} }
bool CANFrameModel::needsFilterRefresh()
{
bool temp = needFilterRefresh;
needFilterRefresh = false;
return temp;
}
/* /*
*This used to not be const correct but it is now. So, there's little harm in *This used to not be const correct but it is now. So, there's little harm in
* allowing external code to peek at our frames. There's just no touching. * allowing external code to peek at our frames. There's just no touching.
+2
View File
@@ -38,6 +38,7 @@ public:
void saveFilterFile(QString filename); void saveFilterFile(QString filename);
void normalizeTiming(); void normalizeTiming();
void recalcOverwrite(); void recalcOverwrite();
bool needsFilterRefresh();
void insertFrames(const QVector<CANFrame> &newFrames); void insertFrames(const QVector<CANFrame> &newFrames);
const QVector<CANFrame> *getListReference() const; //thou shalt not modify these frames externally! const QVector<CANFrame> *getListReference() const; //thou shalt not modify these frames externally!
const QVector<CANFrame> *getFilteredListReference() const; //Thus saith the Lord, NO. const QVector<CANFrame> *getFilteredListReference() const; //Thus saith the Lord, NO.
@@ -56,6 +57,7 @@ private:
bool overwriteDups; //should we display all frames or only the newest for each ID? bool overwriteDups; //should we display all frames or only the newest for each ID?
bool useHexMode; bool useHexMode;
bool timeSeconds; bool timeSeconds;
bool needFilterRefresh;
uint64_t timeOffset; uint64_t timeOffset;
}; };
+5 -1
View File
@@ -102,7 +102,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(this, &MainWindow::startFrameCapturing, worker, &SerialWorker::startFrameCapture); connect(this, &MainWindow::startFrameCapturing, worker, &SerialWorker::startFrameCapture);
connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture); connect(this, &MainWindow::stopFrameCapturing, worker, &SerialWorker::stopFrameCapture);
serialWorkerThread.start(); serialWorkerThread.start();
serialWorkerThread.setPriority(QThread::TimeCriticalPriority); serialWorkerThread.setPriority(QThread::HighPriority);
graphingWindow = NULL; graphingWindow = NULL;
frameInfoWindow = NULL; frameInfoWindow = NULL;
@@ -292,6 +292,8 @@ void MainWindow::updateFilterList()
const QMap<int, bool> *filters = model->getFiltersReference(); const QMap<int, bool> *filters = model->getFiltersReference();
if (filters == NULL) return; if (filters == NULL) return;
qDebug() << "updateFilterList called on MainWindow";
ui->listFilters->clear(); ui->listFilters->clear();
if (filters->isEmpty()) return; if (filters->isEmpty()) return;
@@ -333,6 +335,8 @@ void MainWindow::gotFrames(int FPS, int framesSinceLastUpdate)
bDirty = true; bDirty = true;
emit framesUpdated(framesSinceLastUpdate); //anyone care that frames were updated? emit framesUpdated(framesSinceLastUpdate); //anyone care that frames were updated?
} }
if (model->needsFilterRefresh()) updateFilterList();
} }
void MainWindow::addFrameToDisplay(CANFrame &frame, bool autoRefresh = false) void MainWindow::addFrameToDisplay(CANFrame &frame, bool autoRefresh = false)