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

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

This commit is contained in:
f4exb 2017-04-12 22:46:16 +02:00
parent 39ca753dff
commit 729ba1b1f9
2 changed files with 13 additions and 9 deletions

View File

@ -858,9 +858,11 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked)
int selectedComboIndex = deviceUI->m_samplingDeviceControl->getDeviceSelector()->currentIndex();
void *devicePtr = deviceUI->m_samplingDeviceControl->getDeviceSelector()->itemData(selectedComboIndex).value<void *>();
deviceUI->m_deviceSinkAPI->stopGeneration();
deviceUI->m_deviceSinkAPI->setSampleSinkPluginGUI(0); // deletes old GUI and input object
deviceUI->m_deviceSinkAPI->clearBuddiesLists(); // remove old API from buddies lists
m_pluginManager->selectSampleSinkByDevice(devicePtr, deviceUI->m_deviceSinkAPI); // sets the new API
deviceUI->m_deviceSinkAPI->loadSinkSettings(m_settings.getWorkingPreset()); // load new API settings
// add to buddies list
std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin();
@ -887,6 +889,16 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked)
}
}
}
// constructs new GUI and output object
QWidget *gui;
PluginManager::SamplingDevice *sampleSinkDevice = (PluginManager::SamplingDevice *) devicePtr;
PluginGUI *pluginGUI = sampleSinkDevice->m_plugin->createSampleSinkPluginGUI(sampleSinkDevice->m_deviceId, &gui, deviceUI->m_deviceSinkAPI);
deviceUI->m_deviceSinkAPI->setSampleSinkPluginGUI(pluginGUI);
deviceUI->m_deviceSinkAPI->setOutputGUI(gui, sampleSinkDevice->m_displayName);
deviceUI->m_deviceSinkAPI->loadSinkSettings(m_settings.getWorkingPreset()); // load new API settings
}
}

View File

@ -714,19 +714,11 @@ void PluginManager::selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *dev
<< " ser: " << sampleSinkDevice->m_deviceSerial.toStdString().c_str()
<< " seq: " << sampleSinkDevice->m_deviceSequence;
deviceAPI->setSampleSinkPluginGUI(0); // this effectively destroys the previous GUI if it exists
// 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);
}
void PluginManager::loadPlugins(const QDir& dir)