From 3f2b3cdea364abfb4a8a59a3edb1667418e61dd1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 16 May 2016 21:51:53 +0200 Subject: [PATCH] Multi device support: sort of works but plugin manager is not fixed --- sdrbase/device/deviceapi.cpp | 27 ++++++++++++++++----------- sdrbase/mainwindow.cpp | 13 ++++++------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/sdrbase/device/deviceapi.cpp b/sdrbase/device/deviceapi.cpp index 54455230a..873efb473 100644 --- a/sdrbase/device/deviceapi.cpp +++ b/sdrbase/device/deviceapi.cpp @@ -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) diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index d02e1c07e..7d3f7916b 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -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();