diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index a89d506c9..e201b82ac 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -797,24 +797,11 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked) void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value(); deviceUI->m_deviceSourceAPI->stopAcquisition(); - // TODO: deviceUI->m_deviceSourceAPI->setSampleSourcePluginGUI(0); // deletes old GUI and input object + deviceUI->m_deviceSourceAPI->setSampleSourcePluginGUI(0); // deletes old GUI and input object deviceUI->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists m_pluginManager->selectSampleSourceByDevice(devicePtr, deviceUI->m_deviceSourceAPI); // sets the new API - // TODO: move up add to buddies list - - // TODO: -// // constructs new GUI and input object -// QWidget *gui; -// PluginManager::SamplingDevice *sampleSourceDevice = (PluginManager::SamplingDevice *) devicePtr; -// PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_deviceId, &gui, deviceUI->m_deviceSourceAPI); -// -// deviceUI->m_deviceSourceAPI->setSampleSourcePluginGUI(pluginGUI); -// deviceUI->m_deviceSourceAPI->setInputGUI(gui, sampleSourceDevice->m_displayName); - - deviceUI->m_deviceSourceAPI->loadSourceSettings(m_settings.getWorkingPreset()); // load new API settings - // add to buddies list std::vector::iterator it = m_deviceUIs.begin(); for (; it != m_deviceUIs.end(); ++it) @@ -841,6 +828,16 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked) } } + // constructs new GUI and input object + QWidget *gui; + PluginManager::SamplingDevice *sampleSourceDevice = (PluginManager::SamplingDevice *) devicePtr; + PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_deviceId, &gui, deviceUI->m_deviceSourceAPI); + + deviceUI->m_deviceSourceAPI->setSampleSourcePluginGUI(pluginGUI); + deviceUI->m_deviceSourceAPI->setInputGUI(gui, sampleSourceDevice->m_displayName); + + deviceUI->m_deviceSourceAPI->loadSourceSettings(m_settings.getWorkingPreset()); // load new API settings + if (currentSourceTabIndex == 0) { m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex()); diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index 82753217d..c66de8ff7 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -697,21 +697,11 @@ void PluginManager::selectSampleSourceByDevice(void *devicePtr, DeviceSourceAPI << " ser: " << sampleSourceDevice->m_deviceSerial.toStdString().c_str() << " seq: " << sampleSourceDevice->m_deviceSequence; - deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists // TODO: move out - // m_sampleSourcePluginGUI = pluginGUI; deviceAPI->setSampleSourceSequence(sampleSourceDevice->m_deviceSequence); deviceAPI->setHardwareId(sampleSourceDevice->m_hadrwareId); deviceAPI->setSampleSourceId(sampleSourceDevice->m_deviceId); deviceAPI->setSampleSourceSerial(sampleSourceDevice->m_deviceSerial); - - // TOOD: move out the rest - - QWidget *gui; - PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_deviceId, &gui, deviceAPI); - - deviceAPI->setSampleSourcePluginGUI(pluginGUI); - deviceAPI->setInputGUI(gui, sampleSourceDevice->m_displayName); } void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *deviceAPI)