Add virtual destructors, fix warnings

This commit is contained in:
Jan Käberich 2022-12-15 00:00:15 +01:00
parent 4568be8ff4
commit fe340ac620
17 changed files with 16 additions and 49 deletions

View File

@ -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 QString USBDevice::serial() const
{ {
return m_serial; return m_serial;

View File

@ -30,7 +30,6 @@ private:
static void SearchDevices(std::function<bool (libusb_device_handle *, QString)> foundCallback, libusb_context *context, bool ignoreOpenError); static void SearchDevices(std::function<bool (libusb_device_handle *, QString)> foundCallback, libusb_context *context, bool ignoreOpenError);
bool send(const QString &s); bool send(const QString &s);
bool receive(QString *s); bool receive(QString *s);
bool flushRX();
libusb_device_handle *m_handle; libusb_device_handle *m_handle;
libusb_context *m_context; libusb_context *m_context;

View File

@ -577,7 +577,7 @@ void VirtualDevice::singleDatapointReceived(Device *dev, Protocol::VNADatapoint<
// map.first is the port (starts at zero) // map.first is the port (starts at zero)
// map.second is the stage at which this port had the stimulus (starts at zero) // map.second is the stage at which this port had the stimulus (starts at zero)
complex<double> ref = res->getValue(map.second, map.first, true); complex<double> ref = res->getValue(map.second, map.first, true);
for(int i=0;i<info.ports;i++) { for(unsigned int i=0;i<info.ports;i++) {
complex<double> input = res->getValue(map.second, i, false); complex<double> input = res->getValue(map.second, i, false);
if(!std::isnan(ref.real()) && !std::isnan(input.real())) { if(!std::isnan(ref.real()) && !std::isnan(input.real())) {
// got both required measurements // got both required measurements

View File

@ -46,9 +46,9 @@
SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name) SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
: Mode(window, name, "SA"), : Mode(window, name, "SA"),
firstPointTime(0),
central(new QScrollArea), central(new QScrollArea),
tiles(new TileWidget(traceModel, window)), tiles(new TileWidget(traceModel, window))
firstPointTime(0)
{ {
central->setWidget(tiles); central->setWidget(tiles);
central->setWidgetResizable(true); central->setWidgetResizable(true);

View File

@ -50,6 +50,7 @@ class TraceMath : public QObject, public Savable {
Q_OBJECT Q_OBJECT
public: public:
TraceMath(); TraceMath();
virtual ~TraceMath(){}
class Data { class Data {
public: public:

View File

@ -36,6 +36,7 @@ Trace::Trace(QString name, QColor color, QString live)
paused(false), paused(false),
reference_impedance(50.0), reference_impedance(50.0),
domain(DataType::Frequency), domain(DataType::Frequency),
deembeddingActive(false),
lastMath(nullptr) lastMath(nullptr)
{ {
settings.valid = false; settings.valid = false;

View File

@ -9,6 +9,7 @@
class Axis { class Axis {
public: public:
Axis(); Axis();
virtual ~Axis(){}
virtual double sampleToCoordinate(Trace::Data data, Trace *t = nullptr, unsigned int sample = 0) = 0; 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 transform(double value, double to_low, double to_high);
double inverseTransform(double value, double to_low, double to_high); double inverseTransform(double value, double to_low, double to_high);

View File

@ -359,7 +359,7 @@ void TraceModel::setSource(const DataSource &value)
double TraceModel::getSweepPosition() const double TraceModel::getSweepPosition() const
{ {
auto t = QDateTime::currentDateTimeUtc(); auto t = QDateTime::currentDateTimeUtc();
constexpr uint64_t timeout_ms = 1000; constexpr qint64 timeout_ms = 1000;
if(lastReceivedData.msecsTo(t) > timeout_ms) { if(lastReceivedData.msecsTo(t) > timeout_ms) {
return std::numeric_limits<double>::quiet_NaN(); return std::numeric_limits<double>::quiet_NaN();
} else { } else {

View File

@ -25,7 +25,7 @@ public:
}; };
TracePlot(TraceModel &model, QWidget *parent = nullptr); TracePlot(TraceModel &model, QWidget *parent = nullptr);
~TracePlot(); virtual ~TracePlot();
void setParentTile(TileWidget *tile); void setParentTile(TileWidget *tile);

View File

@ -114,35 +114,6 @@ void TracePolarChart::draw(QPainter &p) {
drawArc(PolarArc(offset, radius, 0, 2*M_PI)); 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<double>(offset.x(), cir.center.y() + cir.radius*sin(angle));
auto p2 = complex<double>(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<double>(x1,y1);
auto p2 = complex<double>(x2,y2);
p.drawLine(dataToPixel(p1),dataToPixel(p2));
}
};
constexpr int Lines = 6; constexpr int Lines = 6;
for(int i=0;i<Lines;i++) { for(int i=0;i<Lines;i++) {
auto angle = (double) i * 30 / 180.0 * M_PI; auto angle = (double) i * 30 / 180.0 * M_PI;

View File

@ -462,7 +462,7 @@ void TraceWaterfall::draw(QPainter &p)
p.drawLine(xpos, plotAreaTop, xpos, plotAreaBottom); p.drawLine(xpos, plotAreaTop, xpos, plotAreaBottom);
} }
if(pref.Graphs.SweepIndicator.triangle) { if(pref.Graphs.SweepIndicator.triangle) {
for(unsigned int i=0;i<pref.Graphs.SweepIndicator.triangleSize;i++) { for(int i=0;i<pref.Graphs.SweepIndicator.triangleSize;i++) {
p.drawLine(xpos - i,plotAreaBottom+i+1, xpos + i, plotAreaBottom+i+1); p.drawLine(xpos - i,plotAreaBottom+i+1, xpos + i, plotAreaBottom+i+1);
} }
} }

View File

@ -16,7 +16,7 @@ class TraceWidget : public QWidget, public SCPINode
public: public:
explicit TraceWidget(TraceModel &model, QWidget *parent = nullptr); explicit TraceWidget(TraceModel &model, QWidget *parent = nullptr);
~TraceWidget(); virtual ~TraceWidget();
protected slots: protected slots:
void on_add_clicked(); void on_add_clicked();

View File

@ -774,7 +774,7 @@ void TraceXYPlot::draw(QPainter &p)
p.drawLine(xpos.x(), plotAreaTop, xpos.x(), plotAreaBottom); p.drawLine(xpos.x(), plotAreaTop, xpos.x(), plotAreaBottom);
} }
if(pref.Graphs.SweepIndicator.triangle) { if(pref.Graphs.SweepIndicator.triangle) {
for(unsigned int i=0;i<pref.Graphs.SweepIndicator.triangleSize;i++) { for(int i=0;i<pref.Graphs.SweepIndicator.triangleSize;i++) {
p.drawLine(xpos.x() - i,plotAreaBottom+i+1, xpos.x() + i, plotAreaBottom+i+1); p.drawLine(xpos.x() - i,plotAreaBottom+i+1, xpos.x() + i, plotAreaBottom+i+1);
} }
} }

View File

@ -12,6 +12,7 @@ class DeembeddingOption : public QObject, public Savable, public SCPINode
{ {
Q_OBJECT Q_OBJECT
public: public:
virtual ~DeembeddingOption(){}
enum class Type { enum class Type {
PortExtension, PortExtension,
TwoThru, TwoThru,

View File

@ -58,8 +58,8 @@ VNA::VNA(AppWindow *window, QString name)
: Mode(window, name, "VNA"), : Mode(window, name, "VNA"),
deembedding(traceModel), deembedding(traceModel),
deembedding_active(false), deembedding_active(false),
central(new QScrollArea), tiles(new TileWidget(traceModel)),
tiles(new TileWidget(traceModel)) central(new QScrollArea)
{ {
central->setWidget(tiles); central->setWidget(tiles);
central->setWidgetResizable(true); central->setWidgetResizable(true);

View File

@ -26,7 +26,7 @@ public:
}; };
Mode(AppWindow *window, QString name, QString SCPIname); Mode(AppWindow *window, QString name, QString SCPIname);
~Mode(); virtual ~Mode();
virtual void shutdown(){} // called when the application is about to exit virtual void shutdown(){} // called when the application is about to exit
QString getName() const; QString getName() const;

View File

@ -29,7 +29,7 @@ class SCPINode {
public: public:
SCPINode(QString name) : SCPINode(QString name) :
name(name), parent(nullptr){} name(name), parent(nullptr){}
~SCPINode(); virtual ~SCPINode();
bool add(SCPINode *node); bool add(SCPINode *node);
bool remove(SCPINode *node); bool remove(SCPINode *node);