Make OpenGL graphing mode a setting so you can turn it on/off, sped up

realtime graphing in Graphing Window.

OpenGL mode is pretty and you'll like it if you have a good video
card. But, don't enable it if you do a lot of complex graphing and
you have a crappy built-in Intel or AMD graphics card - your
performance will suffer. Otherwise, if you have a nice card enable it
for a nice graphical boost and maybe a little more speed.
This commit is contained in:
Collin Kidder
2017-08-30 20:55:33 -04:00
parent df804fa15e
commit cbc6115ec4
4 changed files with 42 additions and 7 deletions
+3
View File
@@ -54,6 +54,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt());
ui->cbUseFiltered->setChecked(settings->value("Main/UseFiltered", false).toBool());
ui->cbUseOpenGL->setChecked(settings->value("Main/UseOpenGL", false).toBool());
//just for simplicity they all call the same function and that function updates all settings at once
connect(ui->cbDisplayHex, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
@@ -71,6 +72,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
connect(ui->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings()));
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
connect(ui->lineClockFormat, SIGNAL(editingFinished()), this, SLOT(updateSettings()));
connect(ui->cbUseOpenGL, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
}
MainSettingsDialog::~MainSettingsDialog()
@@ -100,6 +102,7 @@ void MainSettingsDialog::updateSettings()
settings->setValue("Main/TimeClock", ui->rbSysClock->isChecked());
settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
settings->setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
settings->setValue("Main/UseOpenGL", ui->cbUseOpenGL->isChecked());
settings->setValue("Main/TimeFormat", ui->lineClockFormat->text());
settings->sync();
+19 -5
View File
@@ -68,8 +68,17 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
ui->graphingView->setAttribute(Qt::WA_AcceptTouchEvents);
//ui->graphingView->setOpenGl(true); //purdy and fast drawing courtesy of your video card - pretty everyone has 3D accel these days
ui->graphingView->setAntialiasedElements(QCP::aeNone);
if (useOpenGL)
{
ui->graphingView->setAntialiasedElements(QCP::aeAll);
//ui->graphingView->setNoAntialiasingOnDrag(true);
ui->graphingView->setOpenGl(true);
}
else
{
ui->graphingView->setOpenGl(false);
ui->graphingView->setAntialiasedElements(QCP::aeNone);
}
needScaleSetup = true;
followGraphEnd = false;
@@ -104,6 +113,7 @@ void GraphingWindow::readSettings()
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
}
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
useOpenGL = settings.value("Main/UseOpenGL", false).toBool();
}
void GraphingWindow::writeSettings()
@@ -120,6 +130,7 @@ void GraphingWindow::writeSettings()
void GraphingWindow::updatedFrames(int numFrames)
{
CANFrame thisFrame;
QVector<double> x, y;
if (numFrames == -1) //all frames deleted. Kill the display
{
//removeAllGraphs();
@@ -156,7 +167,7 @@ void GraphingWindow::updatedFrames(int numFrames)
{
if (graphParams[j].ID == thisFrame.ID)
{
appendToGraph(graphParams[j], thisFrame);
appendToGraph(graphParams[j], thisFrame, x, y);
appendedToGraph = true;
}
}
@@ -164,7 +175,8 @@ void GraphingWindow::updatedFrames(int numFrames)
if (appendedToGraph) {
for (int j = 0; j < graphParams.count(); j++)
{
graphParams[j].ref->setData(graphParams[j].x, graphParams[j].y);
//graphParams[j].ref->setData(graphParams[j].x, graphParams[j].y);
graphParams[j].ref->addData(x, y, true);
}
if (followGraphEnd)
{
@@ -987,7 +999,7 @@ void GraphingWindow::addNewGraph()
showParamsDialog(-1);
}
void GraphingWindow::appendToGraph(GraphParams &params, CANFrame &frame)
void GraphingWindow::appendToGraph(GraphParams &params, CANFrame &frame, QVector<double> &x, QVector<double> &y)
{
params.strideSoFar++;
if (params.strideSoFar >= params.stride)
@@ -1007,6 +1019,8 @@ void GraphingWindow::appendToGraph(GraphParams &params, CANFrame &frame)
yVal = (tempVal * params.scale) + params.bias;
params.x.append(xVal);
params.y.append(yVal);
x.append(xVal);
y.append(yVal);
}
}
+2 -1
View File
@@ -60,7 +60,7 @@ private slots:
void toggleFollowMode();
void addNewGraph();
void createGraph(GraphParams &params, bool createGraphParam = true);
void appendToGraph(GraphParams &params, CANFrame &frame);
void appendToGraph(GraphParams &params, CANFrame &frame, QVector<double> &x, QVector<double> &y);
void editSelectedGraph();
void updatedFrames(int);
void gotCenterTimeID(int32_t ID, double timestamp);
@@ -81,6 +81,7 @@ private:
QCPSelectionDecorator *selDecorator;
bool needScaleSetup; //do we need to set x,y graphing extents?
bool secondsMode;
bool useOpenGL;
bool followGraphEnd;
void showParamsDialog(int idx);
+18 -1
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>691</height>
<height>720</height>
</rect>
</property>
<property name="windowTitle">
@@ -116,6 +116,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbUseOpenGL">
<property name="text">
<string>OpenGL Accelerated AntiAliased Graphing</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -222,6 +229,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Some settings will not take effect until the application is restarted</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>