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:
@@ -54,6 +54,7 @@ MainSettingsDialog::MainSettingsDialog(QWidget *parent) :
|
|||||||
|
|
||||||
ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt());
|
ui->comboSendingBus->setCurrentIndex(settings->value("Playback/SendingBus", 4).toInt());
|
||||||
ui->cbUseFiltered->setChecked(settings->value("Main/UseFiltered", false).toBool());
|
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
|
//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()));
|
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->comboSendingBus, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSettings()));
|
||||||
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
connect(ui->cbUseFiltered, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
connect(ui->lineClockFormat, SIGNAL(editingFinished()), this, SLOT(updateSettings()));
|
connect(ui->lineClockFormat, SIGNAL(editingFinished()), this, SLOT(updateSettings()));
|
||||||
|
connect(ui->cbUseOpenGL, SIGNAL(toggled(bool)), this, SLOT(updateSettings()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainSettingsDialog::~MainSettingsDialog()
|
MainSettingsDialog::~MainSettingsDialog()
|
||||||
@@ -100,6 +102,7 @@ void MainSettingsDialog::updateSettings()
|
|||||||
settings->setValue("Main/TimeClock", ui->rbSysClock->isChecked());
|
settings->setValue("Main/TimeClock", ui->rbSysClock->isChecked());
|
||||||
settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
|
settings->setValue("Playback/SendingBus", ui->comboSendingBus->currentIndex());
|
||||||
settings->setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
|
settings->setValue("Main/UseFiltered", ui->cbUseFiltered->isChecked());
|
||||||
|
settings->setValue("Main/UseOpenGL", ui->cbUseOpenGL->isChecked());
|
||||||
settings->setValue("Main/TimeFormat", ui->lineClockFormat->text());
|
settings->setValue("Main/TimeFormat", ui->lineClockFormat->text());
|
||||||
|
|
||||||
settings->sync();
|
settings->sync();
|
||||||
|
|||||||
+18
-4
@@ -68,8 +68,17 @@ GraphingWindow::GraphingWindow(const QVector<CANFrame> *frames, QWidget *parent)
|
|||||||
|
|
||||||
ui->graphingView->setAttribute(Qt::WA_AcceptTouchEvents);
|
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
|
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);
|
ui->graphingView->setAntialiasedElements(QCP::aeNone);
|
||||||
|
}
|
||||||
|
|
||||||
needScaleSetup = true;
|
needScaleSetup = true;
|
||||||
followGraphEnd = false;
|
followGraphEnd = false;
|
||||||
@@ -104,6 +113,7 @@ void GraphingWindow::readSettings()
|
|||||||
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
|
move(settings.value("Graphing/WindowPos", QPoint(50, 50)).toPoint());
|
||||||
}
|
}
|
||||||
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
secondsMode = settings.value("Main/TimeSeconds", false).toBool();
|
||||||
|
useOpenGL = settings.value("Main/UseOpenGL", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingWindow::writeSettings()
|
void GraphingWindow::writeSettings()
|
||||||
@@ -120,6 +130,7 @@ void GraphingWindow::writeSettings()
|
|||||||
void GraphingWindow::updatedFrames(int numFrames)
|
void GraphingWindow::updatedFrames(int numFrames)
|
||||||
{
|
{
|
||||||
CANFrame thisFrame;
|
CANFrame thisFrame;
|
||||||
|
QVector<double> x, y;
|
||||||
if (numFrames == -1) //all frames deleted. Kill the display
|
if (numFrames == -1) //all frames deleted. Kill the display
|
||||||
{
|
{
|
||||||
//removeAllGraphs();
|
//removeAllGraphs();
|
||||||
@@ -156,7 +167,7 @@ void GraphingWindow::updatedFrames(int numFrames)
|
|||||||
{
|
{
|
||||||
if (graphParams[j].ID == thisFrame.ID)
|
if (graphParams[j].ID == thisFrame.ID)
|
||||||
{
|
{
|
||||||
appendToGraph(graphParams[j], thisFrame);
|
appendToGraph(graphParams[j], thisFrame, x, y);
|
||||||
appendedToGraph = true;
|
appendedToGraph = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,7 +175,8 @@ void GraphingWindow::updatedFrames(int numFrames)
|
|||||||
if (appendedToGraph) {
|
if (appendedToGraph) {
|
||||||
for (int j = 0; j < graphParams.count(); j++)
|
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)
|
if (followGraphEnd)
|
||||||
{
|
{
|
||||||
@@ -987,7 +999,7 @@ void GraphingWindow::addNewGraph()
|
|||||||
showParamsDialog(-1);
|
showParamsDialog(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphingWindow::appendToGraph(GraphParams ¶ms, CANFrame &frame)
|
void GraphingWindow::appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector<double> &x, QVector<double> &y)
|
||||||
{
|
{
|
||||||
params.strideSoFar++;
|
params.strideSoFar++;
|
||||||
if (params.strideSoFar >= params.stride)
|
if (params.strideSoFar >= params.stride)
|
||||||
@@ -1007,6 +1019,8 @@ void GraphingWindow::appendToGraph(GraphParams ¶ms, CANFrame &frame)
|
|||||||
yVal = (tempVal * params.scale) + params.bias;
|
yVal = (tempVal * params.scale) + params.bias;
|
||||||
params.x.append(xVal);
|
params.x.append(xVal);
|
||||||
params.y.append(yVal);
|
params.y.append(yVal);
|
||||||
|
x.append(xVal);
|
||||||
|
y.append(yVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -60,7 +60,7 @@ private slots:
|
|||||||
void toggleFollowMode();
|
void toggleFollowMode();
|
||||||
void addNewGraph();
|
void addNewGraph();
|
||||||
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
|
void createGraph(GraphParams ¶ms, bool createGraphParam = true);
|
||||||
void appendToGraph(GraphParams ¶ms, CANFrame &frame);
|
void appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector<double> &x, QVector<double> &y);
|
||||||
void editSelectedGraph();
|
void editSelectedGraph();
|
||||||
void updatedFrames(int);
|
void updatedFrames(int);
|
||||||
void gotCenterTimeID(int32_t ID, double timestamp);
|
void gotCenterTimeID(int32_t ID, double timestamp);
|
||||||
@@ -81,6 +81,7 @@ private:
|
|||||||
QCPSelectionDecorator *selDecorator;
|
QCPSelectionDecorator *selDecorator;
|
||||||
bool needScaleSetup; //do we need to set x,y graphing extents?
|
bool needScaleSetup; //do we need to set x,y graphing extents?
|
||||||
bool secondsMode;
|
bool secondsMode;
|
||||||
|
bool useOpenGL;
|
||||||
bool followGraphEnd;
|
bool followGraphEnd;
|
||||||
|
|
||||||
void showParamsDialog(int idx);
|
void showParamsDialog(int idx);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>691</height>
|
<height>720</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -116,6 +116,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbUseOpenGL">
|
||||||
|
<property name="text">
|
||||||
|
<string>OpenGL Accelerated AntiAliased Graphing</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -222,6 +229,16 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
Reference in New Issue
Block a user