Restructured the Frame Info window and added a graph of all the bytes

in the selected frame (color coded the same as the flowview)
This commit is contained in:
Collin Kidder
2018-12-12 20:53:11 -05:00
parent 248bd21002
commit 29dec2dc65
3 changed files with 508 additions and 58 deletions
+50 -7
View File
@@ -4,6 +4,10 @@
#include "helpwindow.h" #include "helpwindow.h"
#include <QtDebug> #include <QtDebug>
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<CANFrame> *frames, QWidget *parent) : FrameInfoWindow::FrameInfoWindow(const QVector<CANFrame> *frames, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::FrameInfoWindow) ui(new Ui::FrameInfoWindow)
@@ -31,19 +35,40 @@ FrameInfoWindow::FrameInfoWindow(const QVector<CANFrame> *frames, QWidget *paren
ui->graphHistogram->legend->setVisible(false); 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) if (useOpenGL)
{ {
ui->graphHistogram->setAntialiasedElements(QCP::aeAll); ui->graphHistogram->setAntialiasedElements(QCP::aeAll);
//ui->graphingView->setNoAntialiasingOnDrag(true);
ui->graphHistogram->setOpenGl(true); ui->graphHistogram->setOpenGl(true);
ui->graphBytes->setAntialiasedElements(QCP::aeAll);
ui->graphBytes->setOpenGl(true);
} }
else else
{ {
ui->graphHistogram->setOpenGl(false); ui->graphHistogram->setOpenGl(false);
ui->graphHistogram->setAntialiasedElements(QCP::aeNone); ui->graphHistogram->setAntialiasedElements(QCP::aeNone);
ui->graphBytes->setOpenGl(false);
ui->graphBytes->setAntialiasedElements(QCP::aeNone);
} }
installEventFilter(this); installEventFilter(this);
for (int i = 0; i < 8; i++)
{
bytePens[i].setColor(byteGraphColors[i]);
bytePens[i].setWidth(1);
}
} }
void FrameInfoWindow::showEvent(QShowEvent* event) void FrameInfoWindow::showEvent(QShowEvent* event)
@@ -93,7 +118,7 @@ void FrameInfoWindow::readSettings()
QSettings settings; QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool()) 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()); move(settings.value("FrameInfo/WindowPos", QPoint(50, 50)).toPoint());
} }
useOpenGL = settings.value("Main/UseOpenGL", false).toBool(); useOpenGL = settings.value("Main/UseOpenGL", false).toBool();
@@ -187,7 +212,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
int maxData[8]; int maxData[8];
int dataHistogram[256][8]; int dataHistogram[256][8];
int bitfieldHistogram[64]; int bitfieldHistogram[64];
QVector<double> graphX, graphY; QVector<double> histGraphX, histGraphY;
QVector<double> byteGraphX, byteGraphY[8];
double maxY = -1000.0; double maxY = -1000.0;
uint8_t changedBits[8]; uint8_t changedBits[8];
uint8_t referenceBits[8]; uint8_t referenceBits[8];
@@ -247,7 +273,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
baseNode->addChild(tempItem); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); 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); baseNode->addChild(tempItem);
tempItem = new QTreeWidgetItem(); tempItem = new QTreeWidgetItem();
@@ -286,6 +312,12 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
//then find all data points //then find all data points
for (int j = 0; j < frameCache.count(); j++) 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) if (j != 0)
{ {
thisInterval = (frameCache[j].timestamp - frameCache[j-1].timestamp); 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])); + QString::number(c % 8) + ") :" + QString::number(bitfieldHistogram[c]));
dataBase->addChild(tempItem); dataBase->addChild(tempItem);
graphX.append(c); histGraphX.append(c);
graphY.append(bitfieldHistogram[c]); histGraphY.append(bitfieldHistogram[c]);
if (bitfieldHistogram[c] > maxY) maxY = bitfieldHistogram[c]; if (bitfieldHistogram[c] > maxY) maxY = bitfieldHistogram[c];
} }
baseNode->addChild(dataBase); baseNode->addChild(dataBase);
ui->treeDetails->insertTopLevelItem(0, baseNode); ui->treeDetails->insertTopLevelItem(0, baseNode);
ui->graphHistogram->clearGraphs(); ui->graphHistogram->clearGraphs();
ui->graphHistogram->addGraph(); 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 ui->graphHistogram->graph()->setLineStyle(QCPGraph::lsStepLeft); //connect points with lines
QBrush graphBrush; QBrush graphBrush;
graphBrush.setColor(Qt::red); graphBrush.setColor(Qt::red);
@@ -399,6 +432,16 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
ui->graphHistogram->yAxis->setRange(0, maxY * 1.02); ui->graphHistogram->yAxis->setRange(0, maxY * 1.02);
ui->graphHistogram->axisRect()->setupFullAxesBox(); ui->graphHistogram->axisRect()->setupFullAxesBox();
ui->graphHistogram->replot(); 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 else
{ {
+2
View File
@@ -33,6 +33,8 @@ private:
QList<CANFrame> frameCache; QList<CANFrame> frameCache;
const QVector<CANFrame> *modelFrames; const QVector<CANFrame> *modelFrames;
bool useOpenGL; bool useOpenGL;
static const QColor byteGraphColors[8];
static QPen bytePens[8];
void refreshIDList(); void refreshIDList();
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
+412 -7
View File
@@ -13,9 +13,11 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Detailed Frame Information</string> <string>Detailed Frame Information</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="10,1,5"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,1">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
@@ -61,10 +63,6 @@
</column> </column>
</widget> </widget>
</item> </item>
</layout>
</item>
</layout>
</item>
<item> <item>
<widget class="QPushButton" name="btnSave"> <widget class="QPushButton" name="btnSave">
<property name="text"> <property name="text">
@@ -72,9 +70,417 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,1,0,1,0">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Bit Histograph</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item> <item>
<widget class="QCustomPlot" name="graphHistogram" native="true"/> <widget class="QCustomPlot" name="graphHistogram" native="true"/>
</item> </item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Bytes Graph</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QCustomPlot" name="graphBytes" native="true"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_6">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>52</red>
<green>101</green>
<blue>164</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>52</red>
<green>101</green>
<blue>164</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>78</red>
<green>154</green>
<blue>6</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>78</red>
<green>154</green>
<blue>6</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>204</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>136</red>
<green>138</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>136</red>
<green>138</green>
<blue>133</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>252</red>
<green>233</green>
<blue>79</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>252</red>
<green>233</green>
<blue>79</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>114</red>
<green>159</green>
<blue>207</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>114</red>
<green>159</green>
<blue>207</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>173</red>
<green>127</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>173</red>
<green>127</green>
<blue>168</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>190</red>
<green>190</green>
<blue>190</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>7</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
@@ -88,7 +494,6 @@
<tabstops> <tabstops>
<tabstop>listFrameID</tabstop> <tabstop>listFrameID</tabstop>
<tabstop>treeDetails</tabstop> <tabstop>treeDetails</tabstop>
<tabstop>btnSave</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>