1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Removed PluginInstanceGUI reference in PluginInterface implementationo

This commit is contained in:
f4exb 2020-10-03 07:24:56 +02:00
parent 315c64c8c7
commit 9a64bb3b75
3 changed files with 15 additions and 30 deletions

View File

@ -1,35 +1,19 @@
#include <plugin/plugininstancegui.h>
#include "dsp/devicesamplesource.h"
#include "dsp/devicesamplesink.h"
#include "dsp/devicesamplemimo.h"
#include "plugin/plugininterface.h"
void PluginInterface::deleteSampleSourcePluginInstanceGUI(PluginInstanceGUI *ui)
{
if (ui) { ui->destroy(); }
}
void PluginInterface::deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source)
{
if (source) { source->destroy(); }
}
void PluginInterface::deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui)
{
if (ui) { ui->destroy(); }
}
void PluginInterface::deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink)
{
if (sink) { sink->destroy(); }
}
void PluginInterface::deleteSampleMIMOPluginInstanceGUI(PluginInstanceGUI *ui)
{
if (ui) { ui->destroy(); }
}
void PluginInterface::deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo)
{
if (mimo) { mimo->destroy(); }

View File

@ -235,7 +235,6 @@ public:
(void) deviceAPI;
return nullptr;
}
virtual void deleteSampleSourcePluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source);
virtual int getDefaultRxNbItems() const {
@ -270,7 +269,6 @@ public:
return nullptr;
}
virtual void deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink);
virtual int getDefaultTxNbItems() const {
@ -305,7 +303,6 @@ public:
return nullptr;
}
virtual void deleteSampleMIMOPluginInstanceGUI(PluginInstanceGUI *ui);
virtual void deleteSampleMIMOPluginInstanceMIMO(DeviceSampleMIMO *mimo);
// Callback to allow plugin to add elements to top-level GUI (such as menu items)

View File

@ -358,8 +358,10 @@ void MainWindow::addSourceDevice(int deviceIndex)
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, deviceIndex);
// delete previous plugin GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
// delete previous plugin GUI if it exists
if (m_deviceUIs.back()->m_deviceGUI) {
m_deviceUIs.back()->m_deviceGUI->destroy();
}
DeviceSampleSource *source = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSourcePluginInstance(
m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceId(), m_deviceUIs.back()->m_deviceAPI);
@ -429,7 +431,9 @@ void MainWindow::addSinkDevice()
ui->inputViewDock->setSelectedDeviceIndex(deviceTabIndex, fileSinkDeviceIndex);
// delete previous plugin GUI if it exists
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
if (m_deviceUIs.back()->m_deviceGUI) {
m_deviceUIs.back()->m_deviceGUI->destroy();
}
DeviceSampleSink *sink = m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->createSampleSinkPluginInstance(
m_deviceUIs.back()->m_deviceAPI->getSamplingDeviceId(), m_deviceUIs.back()->m_deviceAPI);
@ -459,8 +463,8 @@ void MainWindow::removeLastDevice()
// deletes old UI and input object
m_deviceUIs.back()->freeChannels(); // destroys the channel instances
m_deviceUIs.back()->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(0); // have source stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(nullptr); // have source stop sending messages to the GUI
m_deviceUIs.back()->m_deviceGUI->destroy();
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(
m_deviceUIs.back()->m_deviceAPI->getSampleSource());
@ -498,8 +502,8 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(nullptr); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceGUI->destroy();
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(
m_deviceUIs.back()->m_deviceAPI->getSampleSink());
@ -539,7 +543,7 @@ void MainWindow::removeLastDevice()
// deletes old UI and output object
m_deviceUIs.back()->freeChannels();
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO()->setMessageQueueToGUI(nullptr); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceGUI(m_deviceUIs.back()->m_deviceGUI);
m_deviceUIs.back()->m_deviceGUI->destroy();
m_deviceUIs.back()->m_deviceAPI->resetSamplingDeviceId();
m_deviceUIs.back()->m_deviceAPI->getPluginInterface()->deleteSampleMIMOPluginInstanceMIMO(
m_deviceUIs.back()->m_deviceAPI->getSampleMIMO());
@ -1706,7 +1710,7 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex)
// deletes old UI and input object
deviceUI->m_deviceAPI->getSampleSource()->setMessageQueueToGUI(nullptr); // have source stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceGUI);
m_deviceUIs.back()->m_deviceGUI->destroy();
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceInput(deviceUI->m_deviceAPI->getSampleSource());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists
@ -1812,8 +1816,8 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex)
deviceUI->m_deviceAPI->stopDeviceEngine();
// deletes old UI and output object
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(0); // have sink stop sending messages to the GUI
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(deviceUI->m_deviceGUI);
deviceUI->m_deviceAPI->getSampleSink()->setMessageQueueToGUI(nullptr); // have sink stop sending messages to the GUI
m_deviceUIs.back()->m_deviceGUI->destroy();
deviceUI->m_deviceAPI->resetSamplingDeviceId();
deviceUI->m_deviceAPI->getPluginInterface()->deleteSampleSinkPluginInstanceOutput(deviceUI->m_deviceAPI->getSampleSink());
deviceUI->m_deviceAPI->clearBuddiesLists(); // clear old API buddies lists