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

Unimplement main window reload devices

This commit is contained in:
f4exb 2017-11-01 22:40:41 +01:00
parent 55cc8ed33d
commit 467e87730b

View File

@ -1070,61 +1070,64 @@ void MainWindow::on_action_removeLastDevice_triggered()
void MainWindow::on_action_reloadDevices_triggered() void MainWindow::on_action_reloadDevices_triggered()
{ {
// all devices must be stopped QMessageBox::information(this, tr("Message"), tr("Not implemented"));
std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin(); return;
for (; it != m_deviceUIs.end(); ++it)
{
if ((*it)->m_deviceSourceEngine) // it is a source device
{
if ((*it)->m_deviceSourceEngine->state() == DSPDeviceSourceEngine::StRunning)
{
QMessageBox::information(this, tr("Message"), tr("Stop all devices for reload to take effect"));
return;
}
}
if ((*it)->m_deviceSinkEngine) // it is a sink device // // all devices must be stopped
{ // std::vector<DeviceUISet*>::iterator it = m_deviceUIs.begin();
if ((*it)->m_deviceSinkEngine->state() == DSPDeviceSinkEngine::StRunning) // for (; it != m_deviceUIs.end(); ++it)
{ // {
QMessageBox::information(this, tr("Message"), tr("Stop all devices for reload to take effect")); // if ((*it)->m_deviceSourceEngine) // it is a source device
return; // {
} // if ((*it)->m_deviceSourceEngine->state() == DSPDeviceSourceEngine::StRunning)
} // {
} // QMessageBox::information(this, tr("Message"), tr("Stop all devices for reload to take effect"));
// return;
// re-scan devices // }
m_pluginManager->updateSampleSourceDevices(); // }
m_pluginManager->updateSampleSinkDevices(); //
// if ((*it)->m_deviceSinkEngine) // it is a sink device
// re-populate device selectors keeping the same selection // {
it = m_deviceUIs.begin(); // if ((*it)->m_deviceSinkEngine->state() == DSPDeviceSinkEngine::StRunning)
for (; it != m_deviceUIs.end(); ++it) // {
{ // QMessageBox::information(this, tr("Message"), tr("Stop all devices for reload to take effect"));
if ((*it)->m_deviceSourceEngine) // it is a source device // return;
{ // }
QComboBox *deviceSelectorComboBox = (*it)->m_samplingDeviceControl->getDeviceSelector(); // }
bool sampleSourceSignalsBlocked = deviceSelectorComboBox->blockSignals(true); // }
uint dspDeviceSourceEngineUID = (*it)->m_deviceSourceEngine->getUID(); //
m_pluginManager->duplicateLocalSampleSourceDevices(dspDeviceSourceEngineUID); // // re-scan devices
m_pluginManager->fillSampleSourceSelector(deviceSelectorComboBox, dspDeviceSourceEngineUID); // m_pluginManager->updateSampleSourceDevices();
int newIndex = m_pluginManager->getSampleSourceSelectorIndex(deviceSelectorComboBox, (*it)->m_deviceSourceAPI); // m_pluginManager->updateSampleSinkDevices();
deviceSelectorComboBox->setCurrentIndex(newIndex); //
deviceSelectorComboBox->blockSignals(sampleSourceSignalsBlocked); // // re-populate device selectors keeping the same selection
} // it = m_deviceUIs.begin();
// for (; it != m_deviceUIs.end(); ++it)
if ((*it)->m_deviceSinkEngine) // it is a sink device // {
{ // if ((*it)->m_deviceSourceEngine) // it is a source device
QComboBox *deviceSelectorComboBox = (*it)->m_samplingDeviceControl->getDeviceSelector(); // {
bool sampleSinkSignalsBlocked = deviceSelectorComboBox->blockSignals(true); // QComboBox *deviceSelectorComboBox = (*it)->m_samplingDeviceControl->getDeviceSelector();
uint dspDeviceSinkEngineUID = (*it)->m_deviceSinkEngine->getUID(); // bool sampleSourceSignalsBlocked = deviceSelectorComboBox->blockSignals(true);
m_pluginManager->duplicateLocalSampleSinkDevices(dspDeviceSinkEngineUID); // uint dspDeviceSourceEngineUID = (*it)->m_deviceSourceEngine->getUID();
m_pluginManager->fillSampleSinkSelector(deviceSelectorComboBox, dspDeviceSinkEngineUID); // m_pluginManager->duplicateLocalSampleSourceDevices(dspDeviceSourceEngineUID);
int newIndex = m_pluginManager->getSampleSinkSelectorIndex(deviceSelectorComboBox, (*it)->m_deviceSinkAPI); // m_pluginManager->fillSampleSourceSelector(deviceSelectorComboBox, dspDeviceSourceEngineUID);
deviceSelectorComboBox->setCurrentIndex(newIndex); // int newIndex = m_pluginManager->getSampleSourceSelectorIndex(deviceSelectorComboBox, (*it)->m_deviceSourceAPI);
deviceSelectorComboBox->blockSignals(sampleSinkSignalsBlocked); // deviceSelectorComboBox->setCurrentIndex(newIndex);
} // deviceSelectorComboBox->blockSignals(sampleSourceSignalsBlocked);
} // }
//
// if ((*it)->m_deviceSinkEngine) // it is a sink device
// {
// QComboBox *deviceSelectorComboBox = (*it)->m_samplingDeviceControl->getDeviceSelector();
// bool sampleSinkSignalsBlocked = deviceSelectorComboBox->blockSignals(true);
// uint dspDeviceSinkEngineUID = (*it)->m_deviceSinkEngine->getUID();
// m_pluginManager->duplicateLocalSampleSinkDevices(dspDeviceSinkEngineUID);
// m_pluginManager->fillSampleSinkSelector(deviceSelectorComboBox, dspDeviceSinkEngineUID);
// int newIndex = m_pluginManager->getSampleSinkSelectorIndex(deviceSelectorComboBox, (*it)->m_deviceSinkAPI);
// deviceSelectorComboBox->setCurrentIndex(newIndex);
// deviceSelectorComboBox->blockSignals(sampleSinkSignalsBlocked);
// }
// }
} }
void MainWindow::on_action_Exit_triggered() void MainWindow::on_action_Exit_triggered()