1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

Multi device support: sort of works but plugin manager is not fixed

This commit is contained in:
f4exb 2016-05-16 21:51:53 +02:00
parent 00864bfb6c
commit 3f2b3cdea3
2 changed files with 22 additions and 18 deletions

View File

@ -188,21 +188,26 @@ void DeviceAPI::renameChannelInstances()
void DeviceAPI::freeAll()
{
m_deviceEngine->stopAcquistion();
// while(!m_channelInstanceRegistrations.isEmpty())
// {
// ChannelInstanceRegistration reg(m_channelInstanceRegistrations.takeLast());
// reg.m_gui->destroy();
// }
while(!m_channelInstanceRegistrations.isEmpty())
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{
ChannelInstanceRegistration reg(m_channelInstanceRegistrations.takeLast());
reg.m_gui->destroy();
qDebug("PluginManager::loadSettings: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
m_channelInstanceRegistrations[i].m_gui->destroy();
}
if(m_sampleSourcePluginGUI != 0)
{
m_deviceEngine->setSource(0);
m_sampleSourcePluginGUI->destroy();
m_sampleSourcePluginGUI = 0;
m_sampleSourceId.clear();
}
// if(m_sampleSourcePluginGUI != 0)
// {
// m_deviceEngine->setSource(0);
// m_sampleSourcePluginGUI->destroy();
// m_sampleSourcePluginGUI = 0;
// m_sampleSourceId.clear();
// }
}
void DeviceAPI::loadSourceSettings(const Preset* preset)

View File

@ -229,25 +229,24 @@ void MainWindow::removeLastDevice()
lastDeviceEngine->stopAcquistion();
lastDeviceEngine->removeSink(m_deviceUIs.back()->m_spectrumVis);
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
ui->tabSpectraGUI->removeTab(ui->tabSpectraGUI->count() - 1);
ui->tabSpectra->removeTab(ui->tabSpectra->count() - 1);
// PluginManager destructor does freeAll() which does stopAcquistion() but stopAcquistion()
// can be done several times only the first is active so it is fine to do it here
// On the other hand freeAll() must be executed only once
delete m_deviceUIs.back()->m_pluginManager;
//delete m_deviceUIs.back()->m_pluginManager;
//m_deviceUIs.back()->m_pluginManager->freeAll();
//delete m_deviceUIs.back()->m_deviceAPI; // TODO: reinstate when plugin manager is not created for each device
m_deviceUIs.back()->m_deviceAPI->freeAll();
ui->tabChannels->removeTab(ui->tabChannels->count() - 1);
lastDeviceEngine->stop();
m_dspEngine->removeLastDeviceEngine();
if (ui->tabInputsView->count() == ui->tabInputsSelect->count())
{
ui->tabInputsView->removeTab(ui->tabInputsView->count() - 1);
}
ui->tabInputsView->removeTab(ui->tabInputsView->count() - 1);
ui->tabInputsSelect->removeTab(ui->tabInputsSelect->count() - 1);
delete m_deviceUIs.back();