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

PluginManager::selectSampleSourceBySerialOrSequence: removed GUI interaction

This commit is contained in:
f4exb 2017-09-15 01:24:51 +02:00
parent 0010b987bc
commit 6b6b99f30e
5 changed files with 31 additions and 10 deletions

View File

@ -162,6 +162,11 @@ void DeviceSourceAPI::setSampleSourceSerial(const QString& serial)
m_sampleSourceSerial = serial; m_sampleSourceSerial = serial;
} }
void DeviceSourceAPI::setSampleSourceDisplayName(const QString& name)
{
m_sampleSourceDisplayName = name;
}
void DeviceSourceAPI::setSampleSourceSequence(int sequence) void DeviceSourceAPI::setSampleSourceSequence(int sequence)
{ {
m_sampleSourceSequence = sequence; m_sampleSourceSequence = sequence;

View File

@ -70,12 +70,14 @@ public:
void setHardwareId(const QString& id); void setHardwareId(const QString& id);
void setSampleSourceId(const QString& id); void setSampleSourceId(const QString& id);
void setSampleSourceSerial(const QString& serial); void setSampleSourceSerial(const QString& serial);
void setSampleSourceDisplayName(const QString& serial);
void setSampleSourceSequence(int sequence); void setSampleSourceSequence(int sequence);
void setSampleSourcePluginInstanceUI(PluginInstanceUI *gui); void setSampleSourcePluginInstanceUI(PluginInstanceUI *gui);
const QString& getHardwareId() const { return m_hardwareId; } const QString& getHardwareId() const { return m_hardwareId; }
const QString& getSampleSourceId() const { return m_sampleSourceId; } const QString& getSampleSourceId() const { return m_sampleSourceId; }
const QString& getSampleSourceSerial() const { return m_sampleSourceSerial; } const QString& getSampleSourceSerial() const { return m_sampleSourceSerial; }
const QString& getSampleSourceDisplayName() const { return m_sampleSourceDisplayName; }
uint32_t getSampleSourceSequence() const { return m_sampleSourceSequence; } uint32_t getSampleSourceSequence() const { return m_sampleSourceSequence; }
void registerChannelInstance(const QString& channelName, PluginInstanceUI* pluginGUI); void registerChannelInstance(const QString& channelName, PluginInstanceUI* pluginGUI);
@ -144,6 +146,7 @@ protected:
QString m_hardwareId; QString m_hardwareId;
QString m_sampleSourceId; QString m_sampleSourceId;
QString m_sampleSourceSerial; QString m_sampleSourceSerial;
QString m_sampleSourceDisplayName;
uint32_t m_sampleSourceSequence; uint32_t m_sampleSourceSequence;
PluginInstanceUI* m_sampleSourcePluginInstanceUI; PluginInstanceUI* m_sampleSourcePluginInstanceUI;

View File

@ -212,7 +212,13 @@ void MainWindow::addSourceDevice()
ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr); ui->tabInputsSelect->addTab(m_deviceUIs.back()->m_samplingDeviceControl, tabNameCStr);
ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr)); ui->tabInputsSelect->setTabToolTip(deviceTabIndex, QString(uidCStr));
m_pluginManager->selectSampleSourceBySerialOrSequence("sdrangel.samplesource.filesource", "0", 0, m_deviceUIs.back()->m_deviceSourceAPI); int deviceIndex = m_pluginManager->selectSampleSourceBySerialOrSequence("sdrangel.samplesource.filesource", "0", 0, m_deviceUIs.back()->m_deviceSourceAPI);
QWidget *gui;
PluginInstanceUI *pluginGUI = m_pluginManager->getPluginInterfaceAt(deviceIndex)->createSampleSourcePluginInstanceGUI(
m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceId(), &gui, m_deviceUIs.back()->m_deviceSourceAPI);
m_deviceUIs.back()->m_deviceSourceAPI->setSampleSourcePluginInstanceUI(pluginGUI);
m_deviceUIs.back()->m_deviceSourceAPI->setInputGUI(gui, m_deviceUIs.back()->m_deviceSourceAPI->getSampleSourceDisplayName());
} }
void MainWindow::addSinkDevice() void MainWindow::addSinkDevice()

View File

@ -508,11 +508,7 @@ int PluginManager::selectSampleSourceBySerialOrSequence(const QString& sourceId,
deviceAPI->setHardwareId(m_sampleSourceDevices[index].m_hadrwareId); deviceAPI->setHardwareId(m_sampleSourceDevices[index].m_hadrwareId);
deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_deviceId); deviceAPI->setSampleSourceId(m_sampleSourceDevices[index].m_deviceId);
deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_deviceSerial); deviceAPI->setSampleSourceSerial(m_sampleSourceDevices[index].m_deviceSerial);
deviceAPI->setSampleSourceDisplayName(m_sampleSourceDevices[index].m_displayName);
QWidget *gui;
PluginInstanceUI *pluginGUI = m_sampleSourceDevices[index].m_plugin->createSampleSourcePluginInstanceGUI(m_sampleSourceDevices[index].m_deviceId, &gui, deviceAPI);
deviceAPI->setSampleSourcePluginInstanceUI(pluginGUI);
deviceAPI->setInputGUI(gui, m_sampleSourceDevices[index].m_displayName);
return index; return index;
} }
@ -585,10 +581,10 @@ int PluginManager::selectSampleSinkBySerialOrSequence(const QString& sinkId, con
deviceAPI->setSampleSinkId(m_sampleSinkDevices[index].m_deviceId); deviceAPI->setSampleSinkId(m_sampleSinkDevices[index].m_deviceId);
deviceAPI->setSampleSinkSerial(m_sampleSinkDevices[index].m_deviceSerial); deviceAPI->setSampleSinkSerial(m_sampleSinkDevices[index].m_deviceSerial);
QWidget *gui; // QWidget *gui;
PluginInstanceUI *pluginGUI = m_sampleSinkDevices[index].m_plugin->createSampleSinkPluginInstanceGUI(m_sampleSinkDevices[index].m_deviceId, &gui, deviceAPI); // PluginInstanceUI *pluginGUI = m_sampleSinkDevices[index].m_plugin->createSampleSinkPluginInstanceGUI(m_sampleSinkDevices[index].m_deviceId, &gui, deviceAPI);
deviceAPI->setSampleSinkPluginInstanceUI(pluginGUI); // deviceAPI->setSampleSinkPluginInstanceUI(pluginGUI);
deviceAPI->setOutputGUI(gui, m_sampleSinkDevices[index].m_displayName); // deviceAPI->setOutputGUI(gui, m_sampleSinkDevices[index].m_displayName);
return index; return index;
} }
@ -670,6 +666,15 @@ void PluginManager::loadPlugins(const QDir& dir)
} }
} }
PluginInterface* PluginManager::getPluginInterfaceAt(int index)
{
if (index < m_sampleSourceDevices.size()) {
return m_sampleSourceDevices[index].m_plugin;
} else {
return 0;
}
}
void PluginManager::populateRxChannelComboBox(QComboBox *channels) void PluginManager::populateRxChannelComboBox(QComboBox *channels)
{ {
for(PluginAPI::ChannelRegistrations::iterator it = m_rxChannelRegistrations.begin(); it != m_rxChannelRegistrations.end(); ++it) for(PluginAPI::ChannelRegistrations::iterator it = m_rxChannelRegistrations.begin(); it != m_rxChannelRegistrations.end(); ++it)

View File

@ -69,6 +69,8 @@ public:
int selectSampleSinkBySerialOrSequence(const QString& sinkId, const QString& sinkSerial, uint32_t sinkSequence, DeviceSinkAPI *deviceAPI); int selectSampleSinkBySerialOrSequence(const QString& sinkId, const QString& sinkSerial, uint32_t sinkSequence, DeviceSinkAPI *deviceAPI);
void selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *deviceAPI); void selectSampleSinkByDevice(void *devicePtr, DeviceSinkAPI *deviceAPI);
PluginInterface* getPluginInterfaceAt(int index);
void populateRxChannelComboBox(QComboBox *channels); void populateRxChannelComboBox(QComboBox *channels);
void createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI); void createRxChannelInstance(int channelPluginIndex, DeviceSourceAPI *deviceAPI);