diff --git a/sdrbase/plugin/pluginmanager.cpp b/sdrbase/plugin/pluginmanager.cpp index d827939f9..3ce2e22eb 100644 --- a/sdrbase/plugin/pluginmanager.cpp +++ b/sdrbase/plugin/pluginmanager.cpp @@ -276,46 +276,6 @@ void PluginManager::listFeatures(QList& 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) diff --git a/sdrbase/plugin/pluginmanager.h b/sdrbase/plugin/pluginmanager.h index 84a64aede..e65e5ad0b 100644 --- a/sdrbase/plugin/pluginmanager.h +++ b/sdrbase/plugin/pluginmanager.h @@ -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& list); - - void createTxChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI); void listTxChannels(QList& list); - - void createMIMOChannelInstance(int channelPluginIndex, DeviceUISet *deviceUISet, DeviceAPI *deviceAPI); void listMIMOChannels(QList& list); - - void createFeatureInstance(int featurePluginIndex, FeatureUISet *featureUISet, WebAPIAdapterInterface *webAPIAdapterInterface); void listFeatures(QList& list); const PluginInterface *getChannelPluginInterface(const QString& channelIdURI) const; diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index ca9c7aa42..b57761108 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -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); } } diff --git a/sdrgui/mainwindow.h b/sdrgui/mainwindow.h index 43cc7e45e..dd42822ff 100644 --- a/sdrgui/mainwindow.h +++ b/sdrgui/mainwindow.h @@ -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; }