1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Separate construction/destruction for the source input plugin core and the GUI

This commit is contained in:
f4exb 2017-09-16 10:45:08 +02:00
parent 121fe4df60
commit 1d4cb21bb5
49 changed files with 90 additions and 82 deletions

View File

@ -41,7 +41,7 @@ class ChannelAnalyzerGUI : public RollupWidget, public PluginInstanceUI {
public:
static ChannelAnalyzerGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -41,7 +41,7 @@ class ChannelAnalyzerNGGUI : public RollupWidget, public PluginInstanceUI {
public:
static ChannelAnalyzerNGGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -22,7 +22,7 @@ class AMDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static AMDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -42,7 +42,7 @@ class ATVDemodGUI : public RollupWidget, public PluginInstanceUI
public:
static ATVDemodGUI* create(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& strName);
QString getName() const;

View File

@ -42,7 +42,7 @@ class BFMDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static BFMDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -43,7 +43,7 @@ class DSDDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static DSDDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -23,7 +23,7 @@ class LoRaDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static LoRaDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -23,7 +23,7 @@ class NFMDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static NFMDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -24,7 +24,7 @@ class SSBDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static SSBDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -22,7 +22,7 @@ class WFMDemodGUI : public RollupWidget, public PluginInstanceUI {
public:
static WFMDemodGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -25,7 +25,7 @@ class TCPSrcGUI : public RollupWidget, public PluginInstanceUI {
public:
static TCPSrcGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -42,7 +42,7 @@ class UDPSrcGUI : public RollupWidget, public PluginInstanceUI {
public:
static UDPSrcGUI* create(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -39,7 +39,7 @@ class AMModGUI : public RollupWidget, public PluginInstanceUI {
public:
static AMModGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,7 +40,7 @@ class ATVModGUI : public RollupWidget, public PluginInstanceUI {
public:
static ATVModGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,7 +40,7 @@ class NFMModGUI : public RollupWidget, public PluginInstanceUI {
public:
static NFMModGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,7 +40,7 @@ class SSBModGUI : public RollupWidget, public PluginInstanceUI {
public:
static SSBModGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,7 +40,7 @@ class WFMModGUI : public RollupWidget, public PluginInstanceUI {
public:
static WFMModGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -41,7 +41,7 @@ class UDPSinkGUI : public RollupWidget, public PluginInstanceUI {
public:
static UDPSinkGUI* create(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI);
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -36,7 +36,7 @@ class BladerfOutputGui : public QWidget, public PluginInstanceUI {
public:
explicit BladerfOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
virtual ~BladerfOutputGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -38,7 +38,7 @@ class FileSinkGui : public QWidget, public PluginInstanceUI {
public:
explicit FileSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
virtual ~FileSinkGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -46,7 +46,7 @@ public:
explicit HackRFOutputGui(DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
virtual ~HackRFOutputGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -36,7 +36,7 @@ class LimeSDROutputGUI : public QWidget, public PluginInstanceUI {
public:
explicit LimeSDROutputGUI(DeviceSinkAPI *deviceAPI, QWidget* parent = 0);
virtual ~LimeSDROutputGUI();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -39,7 +39,7 @@ class SDRdaemonSinkGui : public QWidget, public PluginInstanceUI {
public:
explicit SDRdaemonSinkGui(DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
virtual ~SDRdaemonSinkGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -38,8 +38,7 @@ AirspyGui::AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleSource(0),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new AirspyInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (AirspyInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -59,7 +58,6 @@ AirspyGui::AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
AirspyGui::~AirspyGui()
{
delete m_sampleSource; // Valgrind memcheck
delete ui;
}

View File

@ -38,7 +38,7 @@ class AirspyGui : public QWidget, public PluginInstanceUI {
public:
explicit AirspyGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~AirspyGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -37,8 +37,7 @@ BladerfInputGui::BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleRate(0),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new BladerfInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (BladerfInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -65,7 +64,6 @@ BladerfInputGui::BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
BladerfInputGui::~BladerfInputGui()
{
delete m_sampleSource; // Valgrind memcheck
delete ui;
}

View File

@ -35,7 +35,7 @@ class BladerfInputGui : public QWidget, public PluginInstanceUI {
public:
explicit BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~BladerfInputGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -34,8 +34,7 @@ FCDProGui::FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleSource(NULL),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new FCDProInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (FCDProInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));

View File

@ -36,7 +36,7 @@ class FCDProGui : public QWidget, public PluginInstanceUI {
public:
explicit FCDProGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~FCDProGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -35,8 +35,7 @@ FCDProPlusGui::FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleSource(NULL),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new FCDProPlusInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (FCDProPlusInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);

View File

@ -35,7 +35,7 @@ class FCDProPlusGui : public QWidget, public PluginInstanceUI {
public:
explicit FCDProPlusGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~FCDProPlusGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -66,9 +66,8 @@ FileSourceGui::FileSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui->playLoop->setChecked(true); // FIXME: always play in a loop
ui->playLoop->setEnabled(false);
m_sampleSource = new FileSourceInput(m_deviceAPI);
m_sampleSource = m_deviceAPI->getSampleSource();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
m_deviceAPI->setSampleSource(m_sampleSource);
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
}

View File

@ -35,7 +35,7 @@ class FileSourceGui : public QWidget, public PluginInstanceUI {
public:
explicit FileSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~FileSourceGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,8 +40,7 @@ HackRFInputGui::HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleSource(NULL),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new HackRFInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (HackRFInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -64,7 +63,6 @@ HackRFInputGui::HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
HackRFInputGui::~HackRFInputGui()
{
delete m_sampleSource; // Valgrind memcheck
delete ui;
}

View File

@ -45,7 +45,7 @@ public:
explicit HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~HackRFInputGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,9 +40,8 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_statusCounter(0),
m_deviceStatusCounter(0)
{
m_limeSDRInput = new LimeSDRInput(m_deviceAPI);
m_sampleSource = (DeviceSampleSource *) m_limeSDRInput;
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = m_deviceAPI->getSampleSource();
m_limeSDRInput = (LimeSDRInput*) m_sampleSource;
ui->setupUi(this);
@ -81,7 +80,6 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent) :
LimeSDRInputGUI::~LimeSDRInputGUI()
{
delete m_sampleSource; // Valgrind memcheck
delete ui;
}

View File

@ -35,7 +35,7 @@ class LimeSDRInputGUI : public QWidget, public PluginInstanceUI {
public:
explicit LimeSDRInputGUI(DeviceSourceAPI *deviceAPI, QWidget* parent = 0);
virtual ~LimeSDRInputGUI();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -40,8 +40,7 @@ PlutoSDRInputGui::PlutoSDRInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent)
m_doApplySettings(true),
m_statusCounter(0)
{
m_sampleSource = new PlutoSDRInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (PlutoSDRInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));

View File

@ -36,8 +36,7 @@ RTLSDRGui::RTLSDRGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
m_sampleSource(0),
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
{
m_sampleSource = new RTLSDRInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (RTLSDRInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -61,7 +60,6 @@ RTLSDRGui::RTLSDRGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
RTLSDRGui::~RTLSDRGui()
{
delete ui;
delete m_sampleSource;
}
void RTLSDRGui::destroy()

View File

@ -36,7 +36,7 @@ class RTLSDRGui : public QWidget, public PluginInstanceUI {
public:
explicit RTLSDRGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~RTLSDRGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -102,9 +102,8 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* pare
connect(&(deviceAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
m_sampleSource = new SDRdaemonSourceInput(m_deviceAPI);
m_sampleSource = (SDRdaemonSourceInput*) m_deviceAPI->getSampleSource();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
m_deviceAPI->setSampleSource(m_sampleSource);
displaySettings();
@ -121,7 +120,6 @@ SDRdaemonSourceGui::SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* pare
SDRdaemonSourceGui::~SDRdaemonSourceGui()
{
delete m_sampleSource;
delete ui;
}

View File

@ -36,7 +36,7 @@ class SDRdaemonSourceGui : public QWidget, public PluginInstanceUI {
public:
explicit SDRdaemonSourceGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~SDRdaemonSourceGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -33,8 +33,7 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
ui(new Ui::SDRPlayGui),
m_deviceAPI(deviceAPI)
{
m_sampleSource = new SDRPlayInput(m_deviceAPI);
m_deviceAPI->setSampleSource(m_sampleSource);
m_sampleSource = (SDRPlayInput*) m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));

View File

@ -38,7 +38,7 @@ class SDRPlayGui : public QWidget, public PluginInstanceUI {
public:
explicit SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~SDRPlayGui();
void destroy();
virtual void destroy();
void setName(const QString& name);
QString getName() const;

View File

@ -212,7 +212,7 @@ void DeviceSourceAPI::renameChannelInstances()
}
}
void DeviceSourceAPI::freeAll()
void DeviceSourceAPI::freeChannels()
{
// while(!m_channelInstanceRegistrations.isEmpty())
// {
@ -225,16 +225,6 @@ void DeviceSourceAPI::freeAll()
qDebug("DeviceSourceAPI::freeAll: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
m_channelInstanceRegistrations[i].m_gui->destroy();
}
if(m_sampleSourcePluginInstanceUI != 0)
{
qDebug("DeviceSourceAPI::freeAll: destroying m_sampleSourcePluginGUI");
m_deviceSourceEngine->setSource(0);
m_sampleSourcePluginInstanceUI->destroy();
m_sampleSourcePluginInstanceUI = 0;
m_sampleSourceId.clear();
}
}
void DeviceSourceAPI::loadSourceSettings(const Preset* preset)

View File

@ -87,7 +87,7 @@ public:
void registerChannelInstance(const QString& channelName, PluginInstanceUI* pluginGUI);
void removeChannelInstance(PluginInstanceUI* pluginGUI);
void freeAll();
void freeChannels();
void loadSourceSettings(const Preset* preset);
void saveSourceSettings(Preset* preset);

View File

@ -140,6 +140,9 @@ MainWindow::MainWindow(QWidget* parent) :
exit(0);
}
DeviceSampleSource *source = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI);
@ -218,8 +221,11 @@ void MainWindow::addSourceDevice()
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
// Create a file source instance by default
m_pluginManager->selectSampleSourceBySerialOrSequence("sdrangel.samplesource.filesource", "0", 0, m_deviceUIs.back()->m_deviceSourceAPI);
DeviceSampleSource *source = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceUI *pluginGUI = m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI);
@ -290,8 +296,14 @@ void MainWindow::removeLastDevice()
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
m_deviceUIs.back()->m_deviceSourceAPI->freeAll();
m_deviceUIs.back()->m_deviceSourceAPI->clearBuddiesLists(); // remove old API from buddies lists
// deletes old UI and input object
m_deviceUIs.back()->m_deviceSourceAPI->freeChannels(); // destroys the channel instances
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
m_deviceUIs.back()->m_deviceSourceAPI->resetSampleSourceId();
m_deviceUIs.back()->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSource());
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
@ -821,6 +833,7 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus
deviceUI->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
deviceUI->m_deviceSourceAPI->resetSampleSourceId();
deviceUI->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists
deviceUI->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(deviceUI->m_deviceSourceAPI->getSampleSource());
m_pluginManager->selectSampleSourceByDevice(devicePtr, deviceUI->m_deviceSourceAPI); // sets the new API
@ -859,8 +872,12 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked __attribute__((unus
}
// constructs new GUI and input object
DeviceSampleSource *source = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceInput(
deviceUI->m_deviceSourceAPI->getSampleSourceId(), deviceUI->m_deviceSourceAPI);
deviceUI->m_deviceSourceAPI->setSampleSource(source);
QWidget *gui;
PluginInstanceUI *pluginUI = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(deviceUI->m_deviceSourceAPI->getSampleSourceId(), &gui, deviceUI->m_deviceSourceAPI);
PluginInstanceUI *pluginUI = deviceUI->m_deviceSourceAPI->getPluginInterface()->createSampleSourcePluginInstanceGUI(
deviceUI->m_deviceSourceAPI->getSampleSourceId(), &gui, deviceUI->m_deviceSourceAPI);
deviceUI->m_deviceSourceAPI->setSampleSourcePluginInstanceGUI(pluginUI);
setDeviceGUI(currentSourceTabIndex, gui, deviceUI->m_deviceSourceAPI->getSampleSourceDisplayName());

View File

@ -1 +1,20 @@
#include "dsp/devicesamplesource.h"
#include "plugin/plugininterface.h"
#include "plugininstanceui.h"
void PluginInterface::deleteSampleSourcePluginInstanceGUI(PluginInstanceUI *ui)
{
ui->destroy();
}
void PluginInterface::deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source)
{
source->destroy();
}
void PluginInterface::deleteSampleSinkPluginInstanceGUI(PluginInstanceUI *ui)
{
ui->destroy();
}

View File

@ -4,8 +4,6 @@
#include <QtPlugin>
#include <QString>
#include "plugininstanceui.h"
struct PluginDescriptor {
// general plugin description
const QString displayedName;
@ -63,13 +61,14 @@ 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(); }
virtual void deleteSampleSourcePluginInstanceGUI(PluginInstanceUI *ui);
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
// 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(); }
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceUI *ui);
};
Q_DECLARE_INTERFACE(PluginInterface, "SDRangel.PluginInterface/0.1");