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

pull/27/head
f4exb 2017-04-12 22:12:34 +02:00
rodzic 8203b7ded9
commit 39ca753dff
2 zmienionych plików z 11 dodań i 24 usunięć

Wyświetl plik

@ -797,24 +797,11 @@ void MainWindow::on_sampleSource_confirmClicked(bool checked)
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->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<DeviceUISet*>::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());

Wyświetl plik

@ -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)