diff --git a/re/frameinfowindow.cpp b/re/frameinfowindow.cpp index b4461b0..26b647a 100644 --- a/re/frameinfowindow.cpp +++ b/re/frameinfowindow.cpp @@ -4,6 +4,10 @@ #include "helpwindow.h" #include +const QColor FrameInfoWindow::byteGraphColors[8] = {Qt::blue, Qt::green, Qt::black, Qt::red, //0 1 2 3 + Qt::gray, Qt::yellow, Qt::cyan, Qt::darkMagenta}; //4 5 6 7 +QPen FrameInfoWindow::bytePens[8]; + FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *parent) : QDialog(parent), ui(new Ui::FrameInfoWindow) @@ -31,19 +35,40 @@ FrameInfoWindow::FrameInfoWindow(const QVector *frames, QWidget *paren ui->graphHistogram->legend->setVisible(false); + ui->graphBytes->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | + QCP::iSelectLegend | QCP::iSelectPlottables); + + ui->graphBytes->xAxis->setRange(0, 63); + ui->graphBytes->yAxis->setRange(0, 265); + ui->graphBytes->axisRect()->setupFullAxesBox(); + + ui->graphBytes->xAxis->setLabel("Time"); + ui->graphBytes->yAxis->setLabel("Value"); + + ui->graphBytes->legend->setVisible(false); + if (useOpenGL) { ui->graphHistogram->setAntialiasedElements(QCP::aeAll); - //ui->graphingView->setNoAntialiasingOnDrag(true); ui->graphHistogram->setOpenGl(true); + ui->graphBytes->setAntialiasedElements(QCP::aeAll); + ui->graphBytes->setOpenGl(true); } else { ui->graphHistogram->setOpenGl(false); ui->graphHistogram->setAntialiasedElements(QCP::aeNone); + ui->graphBytes->setOpenGl(false); + ui->graphBytes->setAntialiasedElements(QCP::aeNone); } installEventFilter(this); + + for (int i = 0; i < 8; i++) + { + bytePens[i].setColor(byteGraphColors[i]); + bytePens[i].setWidth(1); + } } void FrameInfoWindow::showEvent(QShowEvent* event) @@ -93,7 +118,7 @@ void FrameInfoWindow::readSettings() QSettings settings; if (settings.value("Main/SaveRestorePositions", false).toBool()) { - resize(settings.value("FrameInfo/WindowSize", QSize(794, 494)).toSize()); + resize(settings.value("FrameInfo/WindowSize", QSize(794, 694)).toSize()); move(settings.value("FrameInfo/WindowPos", QPoint(50, 50)).toPoint()); } useOpenGL = settings.value("Main/UseOpenGL", false).toBool(); @@ -187,7 +212,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) int maxData[8]; int dataHistogram[256][8]; int bitfieldHistogram[64]; - QVector graphX, graphY; + QVector histGraphX, histGraphY; + QVector byteGraphX, byteGraphY[8]; double maxY = -1000.0; uint8_t changedBits[8]; uint8_t referenceBits[8]; @@ -247,7 +273,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) baseNode->addChild(tempItem); tempItem = new QTreeWidgetItem(); - tempItem->setText(0, tr("PGN: ") + Utility::formatNumber(jid.pgn)); + tempItem->setText(0, tr("PGN: ") + Utility::formatNumber(jid.pgn) + "(" + QString::number(jid.pgn) + ")"); baseNode->addChild(tempItem); tempItem = new QTreeWidgetItem(); @@ -286,6 +312,12 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) //then find all data points for (int j = 0; j < frameCache.count(); j++) { + byteGraphX.append(j); + for (int bytcnt = 0; bytcnt < frameCache[j].len; bytcnt++) + { + byteGraphY[bytcnt].append(frameCache[j].data[bytcnt]); + } + if (j != 0) { thisInterval = (frameCache[j].timestamp - frameCache[j-1].timestamp); @@ -380,16 +412,17 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) + QString::number(c % 8) + ") :" + QString::number(bitfieldHistogram[c])); dataBase->addChild(tempItem); - graphX.append(c); - graphY.append(bitfieldHistogram[c]); + histGraphX.append(c); + histGraphY.append(bitfieldHistogram[c]); if (bitfieldHistogram[c] > maxY) maxY = bitfieldHistogram[c]; } baseNode->addChild(dataBase); ui->treeDetails->insertTopLevelItem(0, baseNode); + ui->graphHistogram->clearGraphs(); ui->graphHistogram->addGraph(); - ui->graphHistogram->graph()->setData(graphX, graphY); + ui->graphHistogram->graph()->setData(histGraphX, histGraphY); ui->graphHistogram->graph()->setLineStyle(QCPGraph::lsStepLeft); //connect points with lines QBrush graphBrush; graphBrush.setColor(Qt::red); @@ -399,6 +432,16 @@ void FrameInfoWindow::updateDetailsWindow(QString newID) ui->graphHistogram->yAxis->setRange(0, maxY * 1.02); ui->graphHistogram->axisRect()->setupFullAxesBox(); ui->graphHistogram->replot(); + + ui->graphBytes->clearGraphs(); + for (int graphs = 0; graphs < 8; graphs++) + { + ui->graphBytes->addGraph(); + ui->graphBytes->graph()->setData(byteGraphX, byteGraphY[graphs]); + ui->graphBytes->graph()->setPen(bytePens[graphs]); + } + ui->graphBytes->xAxis->setRange(0, byteGraphX.count()); + ui->graphBytes->replot(); } else { diff --git a/re/frameinfowindow.h b/re/frameinfowindow.h index 0f38edc..abf53a8 100644 --- a/re/frameinfowindow.h +++ b/re/frameinfowindow.h @@ -33,6 +33,8 @@ private: QList frameCache; const QVector *modelFrames; bool useOpenGL; + static const QColor byteGraphColors[8]; + static QPen bytePens[8]; void refreshIDList(); void closeEvent(QCloseEvent *event); diff --git a/ui/frameinfowindow.ui b/ui/frameinfowindow.ui index f696115..5fb1fdc 100644 --- a/ui/frameinfowindow.ui +++ b/ui/frameinfowindow.ui @@ -13,67 +13,473 @@ Detailed Frame Information - + - + - + - - - Frame IDs: - - + + + + + Frame IDs: + + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + - - - - 0 - 0 - - - - - 120 - 0 - - - - - - - - - - - - Details: - - - - - - - - 1 - - - + + + + + Details: + + + + + + + + 1 + + + + + + + + Save details to file + + + + - - - Save details to file - - - - - + + + + + Bit Histograph + + + Qt::AlignCenter + + + + + + + + + + Bytes Graph + + + Qt::AlignCenter + + + + + + + + + + + + + + + + + 52 + 101 + 164 + + + + + + + + + 52 + 101 + 164 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 0 + + + + + + + + + + + + 78 + 154 + 6 + + + + + + + + + 78 + 154 + 6 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 1 + + + + + + + + 13 + 75 + true + + + + 2 + + + + + + + + + + + + 204 + 0 + 0 + + + + + + + + + 204 + 0 + 0 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 3 + + + + + + + + + + + + 136 + 138 + 133 + + + + + + + + + 136 + 138 + 133 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 4 + + + + + + + + + + + + 252 + 233 + 79 + + + + + + + + + 252 + 233 + 79 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 5 + + + + + + + + + + + + 114 + 159 + 207 + + + + + + + + + 114 + 159 + 207 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 6 + + + + + + + + + + + + 173 + 127 + 168 + + + + + + + + + 173 + 127 + 168 + + + + + + + + + 190 + 190 + 190 + + + + + + + + + 13 + 75 + true + + + + 7 + + + + + + @@ -88,7 +494,6 @@ listFrameID treeDetails - btnSave