mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Make channels and features creation consistent between GUI and Server flavors
This commit is contained in:
parent
05cd1460e9
commit
e4f2c80172
@ -276,46 +276,6 @@ void PluginManager::listFeatures(QList<QString>& list)
|
||||
}
|
||||
}
|
||||
|
||||
void PluginManager::createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI)
|
||||
{
|
||||
if (channelPluginIndex < m_rxChannelRegistrations.size())
|
||||
{
|
||||
PluginInterface *pluginInterface = m_rxChannelRegistrations[channelPluginIndex].m_plugin;
|
||||
BasebandSampleSink *rxChannel = pluginInterface->createRxChannelBS(deviceAPI);
|
||||
pluginInterface->createRxChannelGUI(deviceUISet, rxChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void PluginManager::createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI)
|
||||
{
|
||||
if (channelPluginIndex < m_txChannelRegistrations.size())
|
||||
{
|
||||
PluginInterface *pluginInterface = m_txChannelRegistrations[channelPluginIndex].m_plugin;
|
||||
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceAPI);
|
||||
pluginInterface->createTxChannelGUI(deviceUISet, txChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void PluginManager::createMIMOChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI)
|
||||
{
|
||||
if (channelPluginIndex < m_mimoChannelRegistrations.size())
|
||||
{
|
||||
PluginInterface *pluginInterface = m_mimoChannelRegistrations[channelPluginIndex].m_plugin;
|
||||
MIMOChannel *mimoChannel = pluginInterface->createMIMOChannelBS(deviceAPI);
|
||||
pluginInterface->createMIMOChannelGUI(deviceUISet, mimoChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void PluginManager::createFeatureInstance(int featurePluginIndex, FeatureUISet *featureUISet, WebAPIAdapterInterface *webAPIAdapterInterface)
|
||||
{
|
||||
if (featurePluginIndex < m_featureRegistrations.size())
|
||||
{
|
||||
PluginInterface *pluginInterface = m_featureRegistrations[featurePluginIndex].m_plugin;
|
||||
Feature *feature = pluginInterface->createFeature(webAPIAdapterInterface);
|
||||
pluginInterface->createFeatureGUI(featureUISet, feature);
|
||||
}
|
||||
}
|
||||
|
||||
const PluginInterface *PluginManager::getChannelPluginInterface(const QString& channelIdURI) const
|
||||
{
|
||||
for (PluginAPI::ChannelRegistrations::const_iterator it = m_rxChannelRegistrations.begin(); it != m_rxChannelRegistrations.end(); ++it)
|
||||
|
@ -80,16 +80,9 @@ public:
|
||||
PluginAPI::ChannelRegistrations *getMIMOChannelRegistrations() { return &m_mimoChannelRegistrations; }
|
||||
PluginAPI::FeatureRegistrations *getFeatureRegistrations() { return &m_featureRegistrations; }
|
||||
|
||||
void createRxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI);
|
||||
void listRxChannels(QList<QString>& list);
|
||||
|
||||
void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI);
|
||||
void listTxChannels(QList<QString>& list);
|
||||
|
||||
void createMIMOChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI);
|
||||
void listMIMOChannels(QList<QString>& list);
|
||||
|
||||
void createFeatureInstance(int featurePluginIndex, FeatureUISet *featureUISet, WebAPIAdapterInterface *webAPIAdapterInterface);
|
||||
void listFeatures(QList<QString>& list);
|
||||
|
||||
const PluginInterface *getChannelPluginInterface(const QString& channelIdURI) const;
|
||||
|
@ -606,17 +606,6 @@ void MainWindow::deleteChannel(int deviceSetIndex, int channelIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addChannelRollup(int deviceTabIndex, QWidget* widget)
|
||||
{
|
||||
if (deviceTabIndex < ui->tabInputsView->count())
|
||||
{
|
||||
DeviceUISet *deviceUI = m_deviceUIs[deviceTabIndex];
|
||||
deviceUI->m_channelWindow->addRollupWidget(widget);
|
||||
ui->channelDock->show();
|
||||
ui->channelDock->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addViewAction(QAction* action)
|
||||
{
|
||||
ui->menu_Window->addAction(action);
|
||||
@ -1931,13 +1920,17 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
|
||||
if (deviceUI->m_deviceSourceEngine) // source device => Rx channels
|
||||
{
|
||||
m_pluginManager->createRxChannelInstance(
|
||||
channelIndex, deviceUI, deviceUI->m_deviceAPI);
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSink *rxChannel = pluginInterface->createRxChannelBS(deviceUI->m_deviceAPI);
|
||||
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
}
|
||||
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
||||
{
|
||||
m_pluginManager->createTxChannelInstance(
|
||||
channelIndex, deviceUI, deviceUI->m_deviceAPI);
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceUI->m_deviceAPI);
|
||||
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
}
|
||||
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
|
||||
{
|
||||
@ -1946,12 +1939,19 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
qDebug("MainWindow::channelAddClicked: MIMO: tab: %d nbRx: %d nbTx: %d selected: %d",
|
||||
currentChannelTabIndex, nbRxChannels, nbTxChannels, channelIndex);
|
||||
|
||||
if (channelIndex < nbRxChannels) {
|
||||
m_pluginManager->createRxChannelInstance(
|
||||
channelIndex, deviceUI, deviceUI->m_deviceAPI);
|
||||
} else if (channelIndex < nbRxChannels + nbTxChannels) {
|
||||
m_pluginManager->createTxChannelInstance(
|
||||
channelIndex - nbRxChannels, deviceUI, deviceUI->m_deviceAPI);
|
||||
if (channelIndex < nbRxChannels)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getRxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex].m_plugin;
|
||||
BasebandSampleSink *rxChannel = pluginInterface->createRxChannelBS(deviceUI->m_deviceAPI);
|
||||
pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
}
|
||||
else if (channelIndex < nbRxChannels + nbTxChannels)
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = m_pluginManager->getTxChannelRegistrations(); // Available channel plugins
|
||||
PluginInterface *pluginInterface = (*channelRegistrations)[channelIndex - nbRxChannels].m_plugin;
|
||||
BasebandSampleSource *txChannel = pluginInterface->createTxChannelBS(deviceUI->m_deviceAPI);
|
||||
pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1967,7 +1967,10 @@ void MainWindow::featureAddClicked(int featureIndex)
|
||||
{
|
||||
FeatureUISet *featureUISet = m_featureUIs[currentFeatureTabIndex];
|
||||
qDebug("MainWindow::featureAddClicked: m_apiAdapter: %p", m_apiAdapter);
|
||||
m_pluginManager->createFeatureInstance(featureIndex, featureUISet, m_apiAdapter);
|
||||
PluginAPI::FeatureRegistrations *featureRegistrations = m_pluginManager->getFeatureRegistrations(); // Available feature plugins
|
||||
PluginInterface *pluginInterface = (*featureRegistrations)[featureIndex].m_plugin;
|
||||
Feature *feature = pluginInterface->createFeature(m_apiAdapter);
|
||||
pluginInterface->createFeatureGUI(featureUISet, feature);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,6 @@ public:
|
||||
|
||||
void addViewAction(QAction* action);
|
||||
|
||||
void addChannelRollup(int deviceTabIndex, QWidget* widget);
|
||||
void setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, int deviceType = 0);
|
||||
|
||||
const QTimer& getMasterTimer() const { return m_masterTimer; }
|
||||
|
Loading…
Reference in New Issue
Block a user