From fe340ac6202987b9ff4496e1cfb2504dcc215165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Thu, 15 Dec 2022 00:00:15 +0100 Subject: [PATCH] Add virtual destructors, fix warnings --- .../Calibration/LibreCAL/usbdevice.cpp | 7 ----- .../Calibration/LibreCAL/usbdevice.h | 1 - .../LibreVNA-GUI/Device/virtualdevice.cpp | 2 +- .../SpectrumAnalyzer/spectrumanalyzer.cpp | 4 +-- .../LibreVNA-GUI/Traces/Math/tracemath.h | 1 + .../LibreVNA-GUI/Traces/trace.cpp | 1 + .../LibreVNA-GUI/Traces/traceaxis.h | 1 + .../LibreVNA-GUI/Traces/tracemodel.cpp | 2 +- .../LibreVNA-GUI/Traces/traceplot.h | 2 +- .../LibreVNA-GUI/Traces/tracepolarchart.cpp | 29 ------------------- .../LibreVNA-GUI/Traces/tracewaterfall.cpp | 2 +- .../LibreVNA-GUI/Traces/tracewidget.h | 2 +- .../LibreVNA-GUI/Traces/tracexyplot.cpp | 2 +- .../VNA/Deembedding/deembeddingoption.h | 1 + .../PC_Application/LibreVNA-GUI/VNA/vna.cpp | 4 +-- Software/PC_Application/LibreVNA-GUI/mode.h | 2 +- Software/PC_Application/LibreVNA-GUI/scpi.h | 2 +- 17 files changed, 16 insertions(+), 49 deletions(-) diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp index 14dcdf5..b62afba 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.cpp @@ -245,13 +245,6 @@ bool USBDevice::receive(QString *s) } } -bool USBDevice::flushRX() -{ - char data[512]; -// libusb_bulk_transfer(m_handle, LIBUSB_ENDPOINT_IN | 0x03, (unsigned char*) data, sizeof(data), &actual, 1); -} - - QString USBDevice::serial() const { return m_serial; diff --git a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h index 9217fa2..b8aefab 100644 --- a/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h +++ b/Software/PC_Application/LibreVNA-GUI/Calibration/LibreCAL/usbdevice.h @@ -30,7 +30,6 @@ private: static void SearchDevices(std::function foundCallback, libusb_context *context, bool ignoreOpenError); bool send(const QString &s); bool receive(QString *s); - bool flushRX(); libusb_device_handle *m_handle; libusb_context *m_context; diff --git a/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp b/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp index 9dea9ac..6d7f742 100644 --- a/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Device/virtualdevice.cpp @@ -577,7 +577,7 @@ void VirtualDevice::singleDatapointReceived(Device *dev, Protocol::VNADatapoint< // map.first is the port (starts at zero) // map.second is the stage at which this port had the stimulus (starts at zero) complex ref = res->getValue(map.second, map.first, true); - for(int i=0;i input = res->getValue(map.second, i, false); if(!std::isnan(ref.real()) && !std::isnan(input.real())) { // got both required measurements diff --git a/Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.cpp b/Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.cpp index d31a4d9..765036d 100644 --- a/Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.cpp +++ b/Software/PC_Application/LibreVNA-GUI/SpectrumAnalyzer/spectrumanalyzer.cpp @@ -46,9 +46,9 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name) : Mode(window, name, "SA"), + firstPointTime(0), central(new QScrollArea), - tiles(new TileWidget(traceModel, window)), - firstPointTime(0) + tiles(new TileWidget(traceModel, window)) { central->setWidget(tiles); central->setWidgetResizable(true); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/Math/tracemath.h b/Software/PC_Application/LibreVNA-GUI/Traces/Math/tracemath.h index 05f68f8..3a043b9 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/Math/tracemath.h +++ b/Software/PC_Application/LibreVNA-GUI/Traces/Math/tracemath.h @@ -50,6 +50,7 @@ class TraceMath : public QObject, public Savable { Q_OBJECT public: TraceMath(); + virtual ~TraceMath(){} class Data { public: diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp index dbdcaa2..02810a2 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/trace.cpp @@ -36,6 +36,7 @@ Trace::Trace(QString name, QColor color, QString live) paused(false), reference_impedance(50.0), domain(DataType::Frequency), + deembeddingActive(false), lastMath(nullptr) { settings.valid = false; diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h index 1b2abe4..53e8570 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h +++ b/Software/PC_Application/LibreVNA-GUI/Traces/traceaxis.h @@ -9,6 +9,7 @@ class Axis { public: Axis(); + virtual ~Axis(){} virtual double sampleToCoordinate(Trace::Data data, Trace *t = nullptr, unsigned int sample = 0) = 0; double transform(double value, double to_low, double to_high); double inverseTransform(double value, double to_low, double to_high); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/tracemodel.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/tracemodel.cpp index b2eacf4..99b5f48 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/tracemodel.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/tracemodel.cpp @@ -359,7 +359,7 @@ void TraceModel::setSource(const DataSource &value) double TraceModel::getSweepPosition() const { auto t = QDateTime::currentDateTimeUtc(); - constexpr uint64_t timeout_ms = 1000; + constexpr qint64 timeout_ms = 1000; if(lastReceivedData.msecsTo(t) > timeout_ms) { return std::numeric_limits::quiet_NaN(); } else { diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/traceplot.h b/Software/PC_Application/LibreVNA-GUI/Traces/traceplot.h index 8e0665c..6282e8e 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/traceplot.h +++ b/Software/PC_Application/LibreVNA-GUI/Traces/traceplot.h @@ -25,7 +25,7 @@ public: }; TracePlot(TraceModel &model, QWidget *parent = nullptr); - ~TracePlot(); + virtual ~TracePlot(); void setParentTile(TileWidget *tile); diff --git a/Software/PC_Application/LibreVNA-GUI/Traces/tracepolarchart.cpp b/Software/PC_Application/LibreVNA-GUI/Traces/tracepolarchart.cpp index 556a152..042a185 100644 --- a/Software/PC_Application/LibreVNA-GUI/Traces/tracepolarchart.cpp +++ b/Software/PC_Application/LibreVNA-GUI/Traces/tracepolarchart.cpp @@ -114,35 +114,6 @@ void TracePolarChart::draw(QPainter &p) { drawArc(PolarArc(offset, radius, 0, 2*M_PI)); } - auto constraintLineToCircle = [&](PolarArc cir) { // PolarArc - if ( (cir.spanAngle == 90 )&& (offset == QPointF(0.0, 0.0))) { - auto angle = acos(offset.x() / cir.radius); - auto p1 = complex(offset.x(), cir.center.y() + cir.radius*sin(angle)); - auto p2 = complex(offset.x(), cir.center.y() - cir.radius*sin(angle)); - p.drawLine(dataToPixel(p1),dataToPixel(p2)); - } - else { - auto slope = tan(cir.spanAngle*2*M_PI/360); - auto y0 = cir.center.y(); - auto f = offset.x(); - auto a = 1 + (slope*slope); - auto b = (-2*cir.center.x())-(2*f*slope*slope)+(2*slope*y0)-(2*cir.center.y()*slope); - auto c = (cir.center.x()*cir.center.x()) +(cir.center.y()*cir.center.y()) - (cir.radius*cir.radius) + (y0*y0) \ - + (slope*slope*f*f) - (2 * slope * f * y0 ) \ - + (2*cir.center.y()*slope*f)-(2*cir.center.y()*y0); - auto D = (b*b) - (4 * a * c); - - auto x1 = (-b + sqrt(D))/(2*a); - auto x2 = (-b - sqrt(D))/(2*a); - auto y1 = slope*(x1-f)+y0; - auto y2 = slope*(x2-f)+y0; - - auto p1 = complex(x1,y1); - auto p2 = complex(x2,y2); - p.drawLine(dataToPixel(p1),dataToPixel(p2)); - } - }; - constexpr int Lines = 6; for(int i=0;isetWidget(tiles); central->setWidgetResizable(true); diff --git a/Software/PC_Application/LibreVNA-GUI/mode.h b/Software/PC_Application/LibreVNA-GUI/mode.h index b9e9614..ee863f1 100644 --- a/Software/PC_Application/LibreVNA-GUI/mode.h +++ b/Software/PC_Application/LibreVNA-GUI/mode.h @@ -26,7 +26,7 @@ public: }; Mode(AppWindow *window, QString name, QString SCPIname); - ~Mode(); + virtual ~Mode(); virtual void shutdown(){} // called when the application is about to exit QString getName() const; diff --git a/Software/PC_Application/LibreVNA-GUI/scpi.h b/Software/PC_Application/LibreVNA-GUI/scpi.h index b81f267..8a7f37d 100644 --- a/Software/PC_Application/LibreVNA-GUI/scpi.h +++ b/Software/PC_Application/LibreVNA-GUI/scpi.h @@ -29,7 +29,7 @@ class SCPINode { public: SCPINode(QString name) : name(name), parent(nullptr){} - ~SCPINode(); + virtual ~SCPINode(); bool add(SCPINode *node); bool remove(SCPINode *node);