Fixes to Frame Data Analysis Window to make it work more reliably when

user is loading different files.
This commit is contained in:
Collin Kidder
2017-10-04 21:07:52 -04:00
parent 74cbcded53
commit afad7d42a5
+23 -5
View File
@@ -94,12 +94,18 @@ void FrameInfoWindow::updatedFrames(int numFrames)
{ {
if (numFrames == -1) //all frames deleted. Kill the display if (numFrames == -1) //all frames deleted. Kill the display
{ {
//qDebug() << "Delete all frames in Info Window";
ui->listFrameID->clear(); ui->listFrameID->clear();
ui->treeDetails->clear(); ui->treeDetails->clear();
foundID.clear();
refreshIDList(); refreshIDList();
} }
else if (numFrames == -2) //all new set of frames. Reset else if (numFrames == -2) //all new set of frames. Reset
{ {
//qDebug() << "All new set of frames in Info Window";
ui->listFrameID->clear();
ui->treeDetails->clear();
foundID.clear();
refreshIDList(); refreshIDList();
if (ui->listFrameID->count() > 0) if (ui->listFrameID->count() > 0)
{ {
@@ -109,20 +115,29 @@ void FrameInfoWindow::updatedFrames(int numFrames)
} }
else //just got some new frames. See if they are relevant. else //just got some new frames. See if they are relevant.
{ {
//qDebug() << "Got frames in Info Window";
if (numFrames > modelFrames->count()) return; if (numFrames > modelFrames->count()) return;
unsigned int currID = 0; unsigned int currID = 0;
if (ui->listFrameID->currentItem()) if (ui->listFrameID->currentItem())
currID = ui->listFrameID->currentItem()->text().toInt(NULL, 16); currID = (unsigned int)ui->listFrameID->currentItem()->text().toInt(NULL, 16);
bool foundID = false; bool thisID = false;
for (int x = modelFrames->count() - numFrames; x < modelFrames->count(); x++) for (int x = modelFrames->count() - numFrames; x < modelFrames->count(); x++)
{ {
unsigned int id = modelFrames->at(x).ID;
if (!foundID.contains(id))
{
foundID.append(id);
ui->listFrameID->addItem(Utility::formatNumber(id));
}
if (currID == modelFrames->at(x).ID) if (currID == modelFrames->at(x).ID)
{ {
foundID = true; thisID = true;
break; break;
} }
} }
if (foundID) if (thisID)
{ {
//the problem here is that it'll blast us out of the details as soon as this //the problem here is that it'll blast us out of the details as soon as this
//happens. The only way to do this properly is to actually traverse //happens. The only way to do this properly is to actually traverse
@@ -132,6 +147,9 @@ void FrameInfoWindow::updatedFrames(int numFrames)
//updateDetailsWindow(ui->listFrameID->currentItem()->text()); //updateDetailsWindow(ui->listFrameID->currentItem()->text());
} }
//default is to sort in ascending order
ui->listFrameID->sortItems();
ui->lblFrameID->setText(tr("Frame IDs: (") + QString::number(ui->listFrameID->count()) + tr(" unique ids)"));
} }
} }
@@ -376,7 +394,7 @@ void FrameInfoWindow::refreshIDList()
int id; int id;
for (int i = 0; i < modelFrames->count(); i++) for (int i = 0; i < modelFrames->count(); i++)
{ {
id = modelFrames->at(i).ID; id = (int)modelFrames->at(i).ID;
if (!foundID.contains(id)) if (!foundID.contains(id))
{ {
foundID.append(id); foundID.append(id);