Add openGL mode to flowview, add histogram graphing to frame info
window (also openGL accelerated if you choose)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#ifndef CONFIG
|
||||
#define CONFIG
|
||||
|
||||
#define VERSION 175
|
||||
#define VERSION 176
|
||||
|
||||
//try to keep this in sync.
|
||||
//SavvyCAN will complain if you connect a GVRET board with a revision
|
||||
|
||||
@@ -62,6 +62,17 @@ FlowViewWindow::FlowViewWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
||||
//ui->graphView->xAxis->setTickStep(5.0);
|
||||
//ui->graphView->xAxis->setSubTickCount(0);
|
||||
|
||||
if (openGLMode)
|
||||
{
|
||||
ui->graphView->setAntialiasedElements(QCP::aeAll);
|
||||
ui->graphView->setOpenGl(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->graphView->setOpenGl(false);
|
||||
ui->graphView->setAntialiasedElements(QCP::aeNone);
|
||||
}
|
||||
|
||||
connect(ui->btnBackOne, SIGNAL(clicked(bool)), this, SLOT(btnBackOneClick()));
|
||||
connect(ui->btnPause, SIGNAL(clicked(bool)), this, SLOT(btnPauseClick()));
|
||||
connect(ui->btnReverse, SIGNAL(clicked(bool)), this, SLOT(btnReverseClick()));
|
||||
@@ -146,6 +157,7 @@ void FlowViewWindow::readSettings()
|
||||
}
|
||||
|
||||
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||
openGLMode = settings.value("Main/UseOpenGL", false).toBool();
|
||||
}
|
||||
|
||||
void FlowViewWindow::writeSettings()
|
||||
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
bool playbackForward;
|
||||
static const QColor graphColors[8];
|
||||
bool secondsMode;
|
||||
bool openGLMode;
|
||||
QVector<double> x[8], y[8];
|
||||
QCPGraph *graphRef[8];
|
||||
|
||||
|
||||
+44
-1
@@ -17,6 +17,31 @@ FrameInfoWindow::FrameInfoWindow(const QVector<CANFrame> *frames, QWidget *paren
|
||||
connect(MainWindow::getReference(), &MainWindow::framesUpdated, this, &FrameInfoWindow::updatedFrames);
|
||||
connect(ui->btnSave, &QAbstractButton::clicked, this, &FrameInfoWindow::saveDetails);
|
||||
|
||||
|
||||
ui->graphHistogram->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes |
|
||||
QCP::iSelectLegend | QCP::iSelectPlottables);
|
||||
|
||||
ui->graphHistogram->xAxis->setRange(0, 63);
|
||||
ui->graphHistogram->yAxis->setRange(0, 100);
|
||||
ui->graphHistogram->axisRect()->setupFullAxesBox();
|
||||
|
||||
ui->graphHistogram->xAxis->setLabel("Bits");
|
||||
ui->graphHistogram->yAxis->setLabel("Instances");
|
||||
|
||||
ui->graphHistogram->legend->setVisible(false);
|
||||
|
||||
if (useOpenGL)
|
||||
{
|
||||
ui->graphHistogram->setAntialiasedElements(QCP::aeAll);
|
||||
//ui->graphingView->setNoAntialiasingOnDrag(true);
|
||||
ui->graphHistogram->setOpenGl(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->graphHistogram->setOpenGl(false);
|
||||
ui->graphHistogram->setAntialiasedElements(QCP::aeNone);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FrameInfoWindow::showEvent(QShowEvent* event)
|
||||
@@ -50,6 +75,7 @@ void FrameInfoWindow::readSettings()
|
||||
resize(settings.value("FrameInfo/WindowSize", QSize(794, 494)).toSize());
|
||||
move(settings.value("FrameInfo/WindowPos", QPoint(50, 50)).toPoint());
|
||||
}
|
||||
useOpenGL = settings.value("Main/UseOpenGL", false).toBool();
|
||||
}
|
||||
|
||||
void FrameInfoWindow::writeSettings()
|
||||
@@ -121,6 +147,8 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
int maxData[8];
|
||||
int dataHistogram[256][8];
|
||||
int bitfieldHistogram[64];
|
||||
QVector<double> graphX, graphY;
|
||||
double maxY = -1000.0;
|
||||
uint8_t changedBits[8];
|
||||
uint8_t referenceBits[8];
|
||||
QTreeWidgetItem *baseNode, *dataBase, *histBase, *tempItem;
|
||||
@@ -300,7 +328,7 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
tempItem->setText(0, QString::number(d) + "/0x" + QString::number(d, 16) +" (" + Utility::formatByteAsBinary(d) +") -> " + QString::number(dataHistogram[d][c]));
|
||||
histBase->addChild(tempItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dataBase = new QTreeWidgetItem();
|
||||
@@ -312,10 +340,25 @@ void FrameInfoWindow::updateDetailsWindow(QString newID)
|
||||
+ QString::number(c % 8) + ") :" + QString::number(bitfieldHistogram[c]));
|
||||
|
||||
dataBase->addChild(tempItem);
|
||||
graphX.append(c);
|
||||
graphY.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()->setLineStyle(QCPGraph::lsStepLeft); //connect points with lines
|
||||
QBrush graphBrush;
|
||||
graphBrush.setColor(Qt::red);
|
||||
graphBrush.setStyle(Qt::SolidPattern);
|
||||
ui->graphHistogram->graph()->setPen(Qt::NoPen);
|
||||
ui->graphHistogram->graph()->setBrush(graphBrush);
|
||||
ui->graphHistogram->yAxis->setRange(0, maxY * 1.02);
|
||||
ui->graphHistogram->axisRect()->setupFullAxesBox();
|
||||
ui->graphHistogram->replot();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ private:
|
||||
QList<int> foundID;
|
||||
QList<CANFrame> frameCache;
|
||||
const QVector<CANFrame> *modelFrames;
|
||||
bool useOpenGL;
|
||||
|
||||
void refreshIDList();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1078</width>
|
||||
<height>621</height>
|
||||
<height>623</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -67,7 +67,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/NavBack.png</normaloff>:/icons/images/NavBack.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -78,7 +78,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/StopHS.png</normaloff>:/icons/images/StopHS.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -89,7 +89,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/NavForward.png</normaloff>:/icons/images/NavForward.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -104,7 +104,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/ReverseHS.png</normaloff>:/icons/images/ReverseHS.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -115,7 +115,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/PauseHS.png</normaloff>:/icons/images/PauseHS.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -126,7 +126,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="icons.qrc">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/PlayHS.png</normaloff>:/icons/images/PlayHS.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -1389,7 +1389,7 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
+12
-1
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Detailed Frame Information</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="10,1,5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -72,8 +72,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCustomPlot" name="graphHistogram" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QCustomPlot</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qcustomplot.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<slots>
|
||||
|
||||
Reference in New Issue
Block a user