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

Source handling refactoring: re-organize new source selection steps between main window and plugin manager

This commit is contained in:
f4exb 2017-04-12 22:12:34 +02:00
parent 8203b7ded9
commit 39ca753dff
2 changed files with 11 additions and 24 deletions

View File

@ -797,24 +797,11 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked)
void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value<void *>(); void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value<void *>();
deviceUI->m_deviceSourceAPI->stopAcquisition(); 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 deviceUI->m_deviceSourceAPI->clearBuddiesLists(); // clear old API buddies lists
m_pluginManager->selectSampleSourceByDevice(devicePtr, deviceUI->m_deviceSourceAPI); // sets the new API 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 // add to buddies list
std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin(); std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin();
for (; it != m_deviceUIs.end(); ++it) 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) if (currentSourceTabIndex == 0)
{ {
m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex()); m_settings.setSourceIndex(deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex());

View File

@ -697,21 +697,11 @@ void PluginManager::selectSampleSourceByDevice(void *devicePtr, DeviceSourceAPI
<< " ser: " << sampleSourceDevice->m_deviceSerial.toStdString().c_str() << " ser: " << sampleSourceDevice->m_deviceSerial.toStdString().c_str()
<< " seq: " << sampleSourceDevice->m_deviceSequence; << " seq: " << sampleSourceDevice->m_deviceSequence;
deviceAPI->setSampleSourcePluginGUI(0); // this effectively destroys the previous GUI if it exists // TODO: move out
// m_sampleSourcePluginGUI = pluginGUI; // m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSourceSequence(sampleSourceDevice->m_deviceSequence); deviceAPI->setSampleSourceSequence(sampleSourceDevice->m_deviceSequence);
deviceAPI->setHardwareId(sampleSourceDevice->m_hadrwareId); deviceAPI->setHardwareId(sampleSourceDevice->m_hadrwareId);
deviceAPI->setSampleSourceId(sampleSourceDevice->m_deviceId); deviceAPI->setSampleSourceId(sampleSourceDevice->m_deviceId);
deviceAPI->setSampleSourceSerial(sampleSourceDevice->m_deviceSerial); 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) void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *deviceAPI)