From 3606ab2cf26dfd477b0c60332ae78ff033910d56 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 15 Sep 2017 02:32:30 +0200 Subject: [PATCH] Added a destroy virtual method to all source input plugin main classes --- plugins/samplesource/airspy/airspyinput.cpp | 5 +++++ plugins/samplesource/airspy/airspyinput.h | 1 + plugins/samplesource/bladerfinput/bladerfinput.cpp | 5 +++++ plugins/samplesource/bladerfinput/bladerfinput.h | 1 + plugins/samplesource/fcdpro/fcdproinput.cpp | 5 +++++ plugins/samplesource/fcdpro/fcdproinput.h | 1 + plugins/samplesource/fcdproplus/fcdproplusinput.cpp | 5 +++++ plugins/samplesource/fcdproplus/fcdproplusinput.h | 1 + plugins/samplesource/filesource/filesourceinput.cpp | 5 +++++ plugins/samplesource/filesource/filesourceinput.h | 1 + plugins/samplesource/hackrfinput/hackrfinput.cpp | 5 +++++ plugins/samplesource/hackrfinput/hackrfinput.h | 1 + plugins/samplesource/limesdrinput/limesdrinput.cpp | 5 +++++ plugins/samplesource/limesdrinput/limesdrinput.h | 1 + plugins/samplesource/plutosdrinput/plutosdrinput.cpp | 5 +++++ plugins/samplesource/plutosdrinput/plutosdrinput.h | 1 + plugins/samplesource/rtlsdr/rtlsdrinput.cpp | 5 +++++ plugins/samplesource/rtlsdr/rtlsdrinput.h | 1 + .../samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp | 5 +++++ plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h | 1 + plugins/samplesource/sdrplay/sdrplayinput.cpp | 5 +++++ plugins/samplesource/sdrplay/sdrplayinput.h | 1 + sdrbase/dsp/devicesamplesource.h | 1 + sdrbase/plugin/plugininterface.h | 4 ++++ 24 files changed, 71 insertions(+) diff --git a/plugins/samplesource/airspy/airspyinput.cpp b/plugins/samplesource/airspy/airspyinput.cpp index b40777aea..8c7e4865f 100644 --- a/plugins/samplesource/airspy/airspyinput.cpp +++ b/plugins/samplesource/airspy/airspyinput.cpp @@ -56,6 +56,11 @@ AirspyInput::~AirspyInput() closeDevice(); } +void AirspyInput::destroy() +{ + delete this; +} + bool AirspyInput::openDevice() { if (m_dev != 0) diff --git a/plugins/samplesource/airspy/airspyinput.h b/plugins/samplesource/airspy/airspyinput.h index 805d4e028..d8af4f729 100644 --- a/plugins/samplesource/airspy/airspyinput.h +++ b/plugins/samplesource/airspy/airspyinput.h @@ -90,6 +90,7 @@ public: AirspyInput(DeviceSourceAPI *deviceAPI); virtual ~AirspyInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/bladerfinput/bladerfinput.cpp b/plugins/samplesource/bladerfinput/bladerfinput.cpp index 3895c8829..1abc397f2 100644 --- a/plugins/samplesource/bladerfinput/bladerfinput.cpp +++ b/plugins/samplesource/bladerfinput/bladerfinput.cpp @@ -60,6 +60,11 @@ BladerfInput::~BladerfInput() m_deviceAPI->setBuddySharedPtr(0); } +void BladerfInput::destroy() +{ + delete this; +} + bool BladerfInput::openDevice() { if (m_dev != 0) diff --git a/plugins/samplesource/bladerfinput/bladerfinput.h b/plugins/samplesource/bladerfinput/bladerfinput.h index 379197a0f..14d4b6761 100644 --- a/plugins/samplesource/bladerfinput/bladerfinput.h +++ b/plugins/samplesource/bladerfinput/bladerfinput.h @@ -73,6 +73,7 @@ public: BladerfInput(DeviceSourceAPI *deviceAPI); virtual ~BladerfInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/fcdpro/fcdproinput.cpp b/plugins/samplesource/fcdpro/fcdproinput.cpp index 6a24a20c4..2a374dae7 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.cpp +++ b/plugins/samplesource/fcdpro/fcdproinput.cpp @@ -60,6 +60,11 @@ FCDProInput::~FCDProInput() closeDevice(); } +void FCDProInput::destroy() +{ + delete this; +} + bool FCDProInput::openDevice() { int device = m_deviceAPI->getSampleSourceSequence(); diff --git a/plugins/samplesource/fcdpro/fcdproinput.h b/plugins/samplesource/fcdpro/fcdproinput.h index ab1ce4d61..7c757f894 100644 --- a/plugins/samplesource/fcdpro/fcdproinput.h +++ b/plugins/samplesource/fcdpro/fcdproinput.h @@ -77,6 +77,7 @@ public: FCDProInput(DeviceSourceAPI *deviceAPI); virtual ~FCDProInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/fcdproplus/fcdproplusinput.cpp b/plugins/samplesource/fcdproplus/fcdproplusinput.cpp index 5c8a09720..d17641487 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusinput.cpp +++ b/plugins/samplesource/fcdproplus/fcdproplusinput.cpp @@ -59,6 +59,11 @@ FCDProPlusInput::~FCDProPlusInput() closeDevice(); } +void FCDProPlusInput::destroy() +{ + delete this; +} + bool FCDProPlusInput::openDevice() { int device = m_deviceAPI->getSampleSourceSequence(); diff --git a/plugins/samplesource/fcdproplus/fcdproplusinput.h b/plugins/samplesource/fcdproplus/fcdproplusinput.h index ad862569c..6b24396f0 100644 --- a/plugins/samplesource/fcdproplus/fcdproplusinput.h +++ b/plugins/samplesource/fcdproplus/fcdproplusinput.h @@ -76,6 +76,7 @@ public: FCDProPlusInput(DeviceSourceAPI *deviceAPI); virtual ~FCDProPlusInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/filesource/filesourceinput.cpp b/plugins/samplesource/filesource/filesourceinput.cpp index 59c788c03..41ba249a9 100644 --- a/plugins/samplesource/filesource/filesourceinput.cpp +++ b/plugins/samplesource/filesource/filesourceinput.cpp @@ -91,6 +91,11 @@ FileSourceInput::~FileSourceInput() stop(); } +void FileSourceInput::destroy() +{ + delete this; +} + void FileSourceInput::openFileStream() { //stopInput(); diff --git a/plugins/samplesource/filesource/filesourceinput.h b/plugins/samplesource/filesource/filesourceinput.h index f388f37a3..e6ff9c170 100644 --- a/plugins/samplesource/filesource/filesourceinput.h +++ b/plugins/samplesource/filesource/filesourceinput.h @@ -212,6 +212,7 @@ public: FileSourceInput(DeviceSourceAPI *deviceAPI); virtual ~FileSourceInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/hackrfinput/hackrfinput.cpp b/plugins/samplesource/hackrfinput/hackrfinput.cpp index 41a318d80..0c8b3a6a1 100644 --- a/plugins/samplesource/hackrfinput/hackrfinput.cpp +++ b/plugins/samplesource/hackrfinput/hackrfinput.cpp @@ -63,6 +63,11 @@ HackRFInput::~HackRFInput() m_deviceAPI->setBuddySharedPtr(0); } +void HackRFInput::destroy() +{ + delete this; +} + bool HackRFInput::openDevice() { if (m_dev != 0) diff --git a/plugins/samplesource/hackrfinput/hackrfinput.h b/plugins/samplesource/hackrfinput/hackrfinput.h index d373076cc..33f7bc6cd 100644 --- a/plugins/samplesource/hackrfinput/hackrfinput.h +++ b/plugins/samplesource/hackrfinput/hackrfinput.h @@ -93,6 +93,7 @@ public: HackRFInput(DeviceSourceAPI *deviceAPI); virtual ~HackRFInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/limesdrinput/limesdrinput.cpp b/plugins/samplesource/limesdrinput/limesdrinput.cpp index c4d0d732d..8bdbade79 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinput.cpp @@ -67,6 +67,11 @@ LimeSDRInput::~LimeSDRInput() resumeBuddies(); } +void LimeSDRInput::destroy() +{ + delete this; +} + bool LimeSDRInput::openDevice() { if (!m_sampleFifo.setSize(96000 * 4)) diff --git a/plugins/samplesource/limesdrinput/limesdrinput.h b/plugins/samplesource/limesdrinput/limesdrinput.h index 64a91d4f0..3fc6c4987 100644 --- a/plugins/samplesource/limesdrinput/limesdrinput.h +++ b/plugins/samplesource/limesdrinput/limesdrinput.h @@ -230,6 +230,7 @@ public: LimeSDRInput(DeviceSourceAPI *deviceAPI); virtual ~LimeSDRInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/plutosdrinput/plutosdrinput.cpp b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp index cda1a3e9a..30877df0f 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinput.cpp +++ b/plugins/samplesource/plutosdrinput/plutosdrinput.cpp @@ -58,6 +58,11 @@ PlutoSDRInput::~PlutoSDRInput() resumeBuddies(); } +void PlutoSDRInput::destroy() +{ + delete this; +} + bool PlutoSDRInput::start() { if (!m_deviceShared.m_deviceParams->getBox()) { diff --git a/plugins/samplesource/plutosdrinput/plutosdrinput.h b/plugins/samplesource/plutosdrinput/plutosdrinput.h index 14c204287..634ccc249 100644 --- a/plugins/samplesource/plutosdrinput/plutosdrinput.h +++ b/plugins/samplesource/plutosdrinput/plutosdrinput.h @@ -76,6 +76,7 @@ public: PlutoSDRInput(DeviceSourceAPI *deviceAPI); ~PlutoSDRInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index 3bbbc9377..76d61af94 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -57,6 +57,11 @@ RTLSDRInput::~RTLSDRInput() closeDevice(); } +void RTLSDRInput::destroy() +{ + delete this; +} + bool RTLSDRInput::openDevice() { if (m_dev != 0) diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.h b/plugins/samplesource/rtlsdr/rtlsdrinput.h index 0fc21b17e..4f140d3ce 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.h +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.h @@ -106,6 +106,7 @@ public: RTLSDRInput(DeviceSourceAPI *deviceAPI); virtual ~RTLSDRInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp index fc6faab3b..2b88f86fe 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.cpp @@ -69,6 +69,11 @@ SDRdaemonSourceInput::~SDRdaemonSourceInput() delete m_SDRdaemonUDPHandler; } +void SDRdaemonSourceInput::destroy() +{ + delete this; +} + bool SDRdaemonSourceInput::start() { qDebug() << "SDRdaemonInput::start"; diff --git a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h index c96e4194c..91de78fc8 100644 --- a/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h +++ b/plugins/samplesource/sdrdaemonsource/sdrdaemonsourceinput.h @@ -305,6 +305,7 @@ public: SDRdaemonSourceInput(DeviceSourceAPI *deviceAPI); virtual ~SDRdaemonSourceInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/plugins/samplesource/sdrplay/sdrplayinput.cpp b/plugins/samplesource/sdrplay/sdrplayinput.cpp index 4ff31a8a8..a63965147 100644 --- a/plugins/samplesource/sdrplay/sdrplayinput.cpp +++ b/plugins/samplesource/sdrplay/sdrplayinput.cpp @@ -58,6 +58,11 @@ SDRPlayInput::~SDRPlayInput() closeDevice(); } +void SDRPlayInput::destroy() +{ + delete this; +} + bool SDRPlayInput::openDevice() { m_devNumber = m_deviceAPI->getSampleSourceSequence(); diff --git a/plugins/samplesource/sdrplay/sdrplayinput.h b/plugins/samplesource/sdrplay/sdrplayinput.h index 4af92bccb..1290d8259 100644 --- a/plugins/samplesource/sdrplay/sdrplayinput.h +++ b/plugins/samplesource/sdrplay/sdrplayinput.h @@ -100,6 +100,7 @@ public: SDRPlayInput(DeviceSourceAPI *deviceAPI); virtual ~SDRPlayInput(); + virtual void destroy(); virtual bool start(); virtual void stop(); diff --git a/sdrbase/dsp/devicesamplesource.h b/sdrbase/dsp/devicesamplesource.h index 0594deaa3..00fb2d93e 100644 --- a/sdrbase/dsp/devicesamplesource.h +++ b/sdrbase/dsp/devicesamplesource.h @@ -30,6 +30,7 @@ class SDRANGEL_API DeviceSampleSource : public QObject { public: DeviceSampleSource(); virtual ~DeviceSampleSource(); + virtual void destroy() = 0; virtual bool start() = 0; virtual void stop() = 0; diff --git a/sdrbase/plugin/plugininterface.h b/sdrbase/plugin/plugininterface.h index 6818c76b4..37f59eb06 100644 --- a/sdrbase/plugin/plugininterface.h +++ b/sdrbase/plugin/plugininterface.h @@ -4,6 +4,8 @@ #include #include +#include "plugininstanceui.h" + struct PluginDescriptor { // general plugin description const QString displayedName; @@ -61,11 +63,13 @@ public: virtual SamplingDevices enumSampleSources() { return SamplingDevices(); } virtual PluginInstanceUI* createSampleSourcePluginInstanceGUI(const QString& sourceId __attribute__((unused)), QWidget **widget __attribute__((unused)), DeviceSourceAPI *deviceAPI __attribute__((unused))) { return 0; } virtual DeviceSampleSource* createSampleSourcePluginInstanceInput(const QString& sourceId __attribute__((unused)), DeviceSourceAPI *deviceAPI __attribute__((unused))) { return 0; } // creates the input "core" + virtual void deleteSampleSourcePluginInstanceGUI(PluginInstanceUI *ui) { ui->destroy(); } // device sink plugins only virtual SamplingDevices enumSampleSinks() { return SamplingDevices(); } virtual PluginInstanceUI* createSampleSinkPluginInstanceGUI(const QString& sinkId __attribute__((unused)), QWidget **widget __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused))) { return 0; } virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput(const QString& sinkId __attribute__((unused)), DeviceSinkAPI *deviceAPI __attribute__((unused))) { return 0; } // creates the output "core" + virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceUI *ui) { ui->destroy(); } }; Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");