mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 05:41:56 -05:00
Better fix previous source plugin GUI delete by doing it explicitly in the main window
This commit is contained in:
parent
7e2f302909
commit
c3b9c268ee
@ -176,10 +176,6 @@ void DeviceSourceAPI::setSampleSourcePluginInterface(PluginInterface *iface)
|
||||
|
||||
void DeviceSourceAPI::setSampleSourcePluginInstanceGUI(PluginInstanceGUI *gui)
|
||||
{
|
||||
if (m_sampleSourcePluginInstanceUI && (gui != m_sampleSourcePluginInstanceUI)) {
|
||||
m_sampleSourcePluginInstanceUI->destroy();
|
||||
}
|
||||
|
||||
m_sampleSourcePluginInstanceUI = gui;
|
||||
}
|
||||
|
||||
|
@ -147,6 +147,10 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// delete previous plugin GUI
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
|
||||
|
||||
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);
|
||||
@ -233,6 +237,11 @@ void MainWindow::addSourceDevice()
|
||||
|
||||
// Create a file source instance by default
|
||||
m_pluginManager->selectSampleSourceBySerialOrSequence("sdrangel.samplesource.filesource", "0", 0, m_deviceUIs.back()->m_deviceSourceAPI);
|
||||
|
||||
// delete previous plugin GUI
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->getPluginInterface()->deleteSampleSourcePluginInstanceGUI(
|
||||
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourcePluginInstanceGUI());
|
||||
|
||||
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);
|
||||
|
@ -6,20 +6,20 @@
|
||||
|
||||
void PluginInterface::deleteSampleSourcePluginInstanceGUI(PluginInstanceGUI *ui)
|
||||
{
|
||||
ui->destroy();
|
||||
if (ui) { ui->destroy(); }
|
||||
}
|
||||
|
||||
void PluginInterface::deleteSampleSourcePluginInstanceInput(DeviceSampleSource *source)
|
||||
{
|
||||
source->destroy();
|
||||
if (source) { source->destroy(); }
|
||||
}
|
||||
|
||||
void PluginInterface::deleteSampleSinkPluginInstanceGUI(PluginInstanceGUI *ui)
|
||||
{
|
||||
ui->destroy();
|
||||
if (ui) { ui->destroy(); }
|
||||
}
|
||||
|
||||
void PluginInterface::deleteSampleSinkPluginInstanceOutput(DeviceSampleSink *sink)
|
||||
{
|
||||
sink->destroy();
|
||||
if (sink) { sink->destroy(); }
|
||||
}
|
||||
|
@ -355,7 +355,6 @@ int PluginManager::selectSampleSourceByIndex(int index, DeviceSourceAPI *deviceA
|
||||
<< " seq: " << m_sampleSourceDevices[index].m_deviceSequence;
|
||||
|
||||
deviceAPI->stopAcquisition();
|
||||
deviceAPI->setSampleSourcePluginInstanceGUI(0); // this effectively destroys the previous GUI if it exists
|
||||
|
||||
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_deviceSequence);
|
||||
deviceAPI->setHardwareId(m_sampleSourceDevices[index].m_hadrwareId);
|
||||
@ -427,7 +426,6 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
|
||||
<< " seq: " << m_sampleSourceDevices[index].m_deviceSequence;
|
||||
|
||||
deviceAPI->stopAcquisition();
|
||||
deviceAPI->setSampleSourcePluginInstanceGUI(0); // this effectively destroys the previous GUI if it exists
|
||||
|
||||
// m_sampleSourcePluginGUI = pluginGUI;
|
||||
deviceAPI->setSampleSourceSequence(m_sampleSourceDevices[index].m_deviceSequence);
|
||||
|
Loading…
Reference in New Issue
Block a user