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

Source handling refactoring (1)

This commit is contained in:
f4exb 2017-04-12 18:59:26 +02:00
parent 371bf9a5ec
commit 8203b7ded9
2 changed files with 1885 additions and 1866 deletions

View File

@ -796,8 +796,23 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked)
int selectedComboIndex = deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex();
void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value<void *>();
deviceUI->m_deviceSourceAPI->stopAcquisition();
// TODO: 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

View File

@ -697,16 +697,19 @@ 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
QWidget *gui;
PluginGUI *pluginGUI = sampleSourceDevice->m_plugin->createSampleSourcePluginGUI(sampleSourceDevice->m_deviceId, &gui, deviceAPI);
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);
}
@ -723,14 +726,15 @@ void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *dev
deviceAPI->setSampleSinkPluginGUI(0); // this effectively destroys the previous GUI if it exists
QWidget *gui;
PluginGUI *pluginGUI = sampleSinkDevice->m_plugin->createSampleSinkPluginGUI(sampleSinkDevice->m_deviceId, &gui, deviceAPI);
// m_sampleSourcePluginGUI = pluginGUI;
deviceAPI->setSampleSinkSequence(sampleSinkDevice->m_deviceSequence);
deviceAPI->setHardwareId(sampleSinkDevice->m_hadrwareId);
deviceAPI->setSampleSinkId(sampleSinkDevice->m_deviceId);
deviceAPI->setSampleSinkSerial(sampleSinkDevice->m_deviceSerial);
QWidget *gui;
PluginGUI *pluginGUI = sampleSinkDevice->m_plugin->createSampleSinkPluginGUI(sampleSinkDevice->m_deviceId, &gui, deviceAPI);
deviceAPI->setSampleSinkPluginGUI(pluginGUI);
deviceAPI->setOutputGUI(gui, sampleSinkDevice->m_displayName);
}