From aba0650d25fee70ce751fb89841a93d3cc46e31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Sun, 5 Dec 2021 18:26:32 +0100 Subject: [PATCH] Add preference option for trace line width --- .../PC_Application/Traces/tracesmithchart.cpp | 2 +- Software/PC_Application/Traces/tracexyplot.cpp | 2 +- Software/PC_Application/preferences.cpp | 3 +++ Software/PC_Application/preferences.h | 4 +++- Software/PC_Application/preferencesdialog.ui | 16 +++++++++++++++- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Software/PC_Application/Traces/tracesmithchart.cpp b/Software/PC_Application/Traces/tracesmithchart.cpp index 949430e..70213ed 100644 --- a/Software/PC_Application/Traces/tracesmithchart.cpp +++ b/Software/PC_Application/Traces/tracesmithchart.cpp @@ -186,7 +186,7 @@ void TraceSmithChart::draw(QPainter &p) { // trace marked invisible continue; } - pen = QPen(trace->color(), 1); + pen = QPen(trace->color(), pref.Graphs.lineWidth); pen.setCosmetic(true); p.setPen(pen); int nPoints = trace->size(); diff --git a/Software/PC_Application/Traces/tracexyplot.cpp b/Software/PC_Application/Traces/tracexyplot.cpp index 4f59d7e..a6d5277 100644 --- a/Software/PC_Application/Traces/tracexyplot.cpp +++ b/Software/PC_Application/Traces/tracexyplot.cpp @@ -457,7 +457,7 @@ void TraceXYPlot::draw(QPainter &p) if(!t->isVisible()) { continue; } - pen = QPen(t->color(), 1); + pen = QPen(t->color(), pref.Graphs.lineWidth); pen.setCosmetic(true); if(i == 1) { pen.setStyle(Qt::DotLine); diff --git a/Software/PC_Application/preferences.cpp b/Software/PC_Application/preferences.cpp index 492f38c..81db186 100644 --- a/Software/PC_Application/preferences.cpp +++ b/Software/PC_Application/preferences.cpp @@ -143,6 +143,7 @@ PreferencesDialog::PreferencesDialog(Preferences *pref, QWidget *parent) : p->Graphs.domainChangeBehavior = (GraphDomainChangeBehavior) ui->GraphsDomainChangeBehavior->currentIndex(); p->Graphs.markerBehavior.showDataOnGraphs = ui->GraphsShowMarkerData->isChecked(); p->Graphs.markerBehavior.showAllData = ui->GraphsShowAllMarkerData->isChecked(); + p->Graphs.lineWidth = ui->GraphsLineWidth->value(); p->SCPIServer.enabled = ui->SCPIServerEnabled->isChecked(); p->SCPIServer.port = ui->SCPIServerPort->value(); accept(); @@ -210,6 +211,8 @@ void PreferencesDialog::setInitialGUIState() ui->GraphsDomainChangeBehavior->setCurrentIndex((int) p->Graphs.domainChangeBehavior); ui->GraphsShowMarkerData->setChecked(p->Graphs.markerBehavior.showDataOnGraphs); ui->GraphsShowAllMarkerData->setChecked(p->Graphs.markerBehavior.showAllData); + ui->GraphsLineWidth->setValue(p->Graphs.lineWidth); + ui->SCPIServerEnabled->setChecked(p->SCPIServer.enabled); ui->SCPIServerPort->setValue(p->SCPIServer.port); diff --git a/Software/PC_Application/preferences.h b/Software/PC_Application/preferences.h index 5ef0ede..35f0444 100644 --- a/Software/PC_Application/preferences.h +++ b/Software/PC_Application/preferences.h @@ -85,6 +85,7 @@ public: bool showDataOnGraphs; bool showAllData; } markerBehavior; + double lineWidth; } Graphs; struct { bool enabled; @@ -101,7 +102,7 @@ private: QString name; QVariant def; }; - const std::array descr = {{ + const std::array descr = {{ {&Startup.ConnectToFirstDevice, "Startup.ConnectToFirstDevice", true}, {&Startup.RememberSweepSettings, "Startup.RememberSweepSettings", false}, {&Startup.DefaultSweep.type, "Startup.DefaultSweep.type", "Frequency"}, @@ -138,6 +139,7 @@ private: {&Graphs.domainChangeBehavior, "Graphs.domainChangeBehavior", GraphDomainChangeBehavior::AdjustGraphs}, {&Graphs.markerBehavior.showDataOnGraphs, "Graphs.markerBehavior.ShowDataOnGraphs", true}, {&Graphs.markerBehavior.showAllData, "Graphs.markerBehavior.ShowAllData", false}, + {&Graphs.lineWidth, "Graphs.lineWidth", 1.0}, {&SCPIServer.enabled, "SCPIServer.enabled", true}, {&SCPIServer.port, "SCPIServer.port", 19542}, }}; diff --git a/Software/PC_Application/preferencesdialog.ui b/Software/PC_Application/preferencesdialog.ui index fff4aa0..1cd937a 100644 --- a/Software/PC_Application/preferencesdialog.ui +++ b/Software/PC_Application/preferencesdialog.ui @@ -78,7 +78,7 @@ - 1 + 2 @@ -769,6 +769,20 @@ + + + + Line Width: + + + + + + + 0.100000000000000 + + +