diff --git a/mainsettingsdialog.cpp b/mainsettingsdialog.cpp index 7e2745b..a6189e9 100644 --- a/mainsettingsdialog.cpp +++ b/mainsettingsdialog.cpp @@ -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(); diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index 6bc3b79..627a6f8 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -68,8 +68,17 @@ GraphingWindow::GraphingWindow(const QVector *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 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 ¶ms, CANFrame &frame) +void GraphingWindow::appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector &x, QVector &y) { params.strideSoFar++; if (params.strideSoFar >= params.stride) @@ -1007,6 +1019,8 @@ void GraphingWindow::appendToGraph(GraphParams ¶ms, CANFrame &frame) yVal = (tempVal * params.scale) + params.bias; params.x.append(xVal); params.y.append(yVal); + x.append(xVal); + y.append(yVal); } } diff --git a/re/graphingwindow.h b/re/graphingwindow.h index 1294e62..795780b 100644 --- a/re/graphingwindow.h +++ b/re/graphingwindow.h @@ -60,7 +60,7 @@ private slots: void toggleFollowMode(); void addNewGraph(); void createGraph(GraphParams ¶ms, bool createGraphParam = true); - void appendToGraph(GraphParams ¶ms, CANFrame &frame); + void appendToGraph(GraphParams ¶ms, CANFrame &frame, QVector &x, QVector &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); diff --git a/ui/mainsettingsdialog.ui b/ui/mainsettingsdialog.ui index 6399632..2abf92c 100644 --- a/ui/mainsettingsdialog.ui +++ b/ui/mainsettingsdialog.ui @@ -7,7 +7,7 @@ 0 0 400 - 691 + 720 @@ -116,6 +116,13 @@ + + + + OpenGL Accelerated AntiAliased Graphing + + + @@ -222,6 +229,16 @@ + + + + Some settings will not take effect until the application is restarted + + + true + + +