diff --git a/sdrbase/device/deviceset.cpp b/sdrbase/device/deviceset.cpp index 5aaafed33..c8a7aa6f3 100644 --- a/sdrbase/device/deviceset.cpp +++ b/sdrbase/device/deviceset.cpp @@ -430,9 +430,8 @@ bool DeviceSet::compareChannels(const ChannelAPI *channelA, const ChannelAPI *ch } } -void DeviceSet::addChannelInstance(const QString& channelURI, ChannelAPI *channelAPI) +void DeviceSet::addChannelInstance(ChannelAPI *channelAPI) { - (void) channelURI; m_channelInstanceRegistrations.append(channelAPI); } diff --git a/sdrbase/device/deviceset.h b/sdrbase/device/deviceset.h index 666452a17..377f45bfa 100644 --- a/sdrbase/device/deviceset.h +++ b/sdrbase/device/deviceset.h @@ -56,7 +56,7 @@ public: void addTxChannel(int selectedChannelIndex, PluginAPI *pluginAPI); void addMIMOChannel(int selectedChannelIndex, PluginAPI *pluginAPI); // slave mode - void addChannelInstance(const QString& channelURI, ChannelAPI *channelAPI); + void addChannelInstance(ChannelAPI *channelAPI); void removeChannelInstanceAt(int index); void removeChannelInstance(ChannelAPI *channelAPI); void clearChannels(); diff --git a/sdrgui/device/deviceuiset.cpp b/sdrgui/device/deviceuiset.cpp index 3efa85082..469901c39 100644 --- a/sdrgui/device/deviceuiset.cpp +++ b/sdrgui/device/deviceuiset.cpp @@ -96,10 +96,10 @@ void DeviceUISet::addRollupWidget(QWidget *widget) m_channelWindow->addRollupWidget(widget); } -void DeviceUISet::registerRxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI) +void DeviceUISet::registerRxChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI) { - m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 0)); - m_deviceSet->addChannelInstance(channelName, channelAPI); + m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelAPI, channelGUI, 0)); + m_deviceSet->addChannelInstance(channelAPI); QObject::connect( channelGUI, &ChannelGUI::closing, @@ -109,10 +109,10 @@ void DeviceUISet::registerRxChannelInstance(const QString& channelName, ChannelA ); } -void DeviceUISet::registerTxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI) +void DeviceUISet::registerTxChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI) { - m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 1)); - m_deviceSet->addChannelInstance(channelName, channelAPI); + m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelAPI, channelGUI, 1)); + m_deviceSet->addChannelInstance(channelAPI); QObject::connect( channelGUI, &ChannelGUI::closing, @@ -122,10 +122,10 @@ void DeviceUISet::registerTxChannelInstance(const QString& channelName, ChannelA ); } -void DeviceUISet::registerChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI) +void DeviceUISet::registerChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI) { - m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 2)); - m_deviceSet->addChannelInstance(channelName, channelAPI); + m_channelInstanceRegistrations.append(ChannelInstanceRegistration( channelAPI, channelGUI, 2)); + m_deviceSet->addChannelInstance(channelAPI); QObject::connect( channelGUI, &ChannelGUI::closing, @@ -139,7 +139,7 @@ void DeviceUISet::freeChannels() { for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { - qDebug("DeviceUISet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); + qDebug("DeviceUISet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_gui->destroy(); m_channelInstanceRegistrations[i].m_channelAPI->destroy(); } @@ -152,7 +152,7 @@ void DeviceUISet::deleteChannel(int channelIndex) if ((channelIndex >= 0) && (channelIndex < m_channelInstanceRegistrations.count())) { qDebug("DeviceUISet::deleteChannel: delete channel [%s] at %d", - qPrintable(m_channelInstanceRegistrations[channelIndex].m_channelURI), + qPrintable(m_channelInstanceRegistrations[channelIndex].m_channelAPI->getURI()), channelIndex); m_channelInstanceRegistrations[channelIndex].m_gui->destroy(); m_channelInstanceRegistrations[channelIndex].m_channelAPI->destroy(); @@ -175,7 +175,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { qDebug("DeviceUISet::loadRxChannelSettings: destroying old channel [%s]", - qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); + qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_gui->destroy(); // FIXME: stop channel before m_channelInstanceRegistrations[i].m_channelAPI->destroy(); } @@ -203,7 +203,7 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA BasebandSampleSink *rxChannel; (*channelRegistrations)[i].m_plugin->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI); rxChannelGUI = (*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel); - registerRxChannelInstance(channelAPI->getURI(), channelAPI, rxChannelGUI); + registerRxChannelInstance(channelAPI, rxChannelGUI); QObject::connect( rxChannelGUI, &ChannelGUI::closing, @@ -236,8 +236,8 @@ void DeviceUISet::saveRxChannelSettings(Preset *preset) for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { - qDebug("DeviceUISet::saveRxChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); - preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_gui->serialize()); + qDebug("DeviceUISet::saveRxChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); + preset->addChannel(m_channelInstanceRegistrations[i].m_channelAPI->getURI(), m_channelInstanceRegistrations[i].m_gui->serialize()); } } else @@ -260,7 +260,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { qDebug("DeviceUISet::loadTxChannelSettings: destroying old channel [%s]", - qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); + qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_gui->destroy(); m_channelInstanceRegistrations[i].m_channelAPI->destroy(); } @@ -287,7 +287,7 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA BasebandSampleSource *txChannel; (*channelRegistrations)[i].m_plugin->createTxChannel(m_deviceAPI, &txChannel, &channelAPI); txChannelGUI = (*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel); - registerTxChannelInstance(channelAPI->getURI(), channelAPI, txChannelGUI); + registerTxChannelInstance(channelAPI, txChannelGUI); QObject::connect( txChannelGUI, &ChannelGUI::closing, @@ -321,8 +321,8 @@ void DeviceUISet::saveTxChannelSettings(Preset *preset) for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { - qDebug("DeviceUISet::saveTxChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); - preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_gui->serialize()); + qDebug("DeviceUISet::saveTxChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); + preset->addChannel(m_channelInstanceRegistrations[i].m_channelAPI->getURI(), m_channelInstanceRegistrations[i].m_gui->serialize()); } } else @@ -345,7 +345,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { qDebug("DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s]", - qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); + qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); m_channelInstanceRegistrations[i].m_gui->destroy(); // FIXME: stop channel before m_channelInstanceRegistrations[i].m_channelAPI->destroy(); } @@ -374,7 +374,7 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi (*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, &mimoChannel, &channelAPI); mimoChannelGUI = (*channelRegistrations)[i].m_plugin->createMIMOChannelGUI(this, mimoChannel); (*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, &mimoChannel, &channelAPI); - registerChannelInstance(channelAPI->getURI(), channelAPI, mimoChannelGUI); + registerChannelInstance(channelAPI, mimoChannelGUI); QObject::connect( mimoChannelGUI, &ChannelGUI::closing, @@ -407,8 +407,8 @@ void DeviceUISet::saveMIMOChannelSettings(Preset *preset) for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) { - qDebug("DeviceUISet::saveMIMOChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI)); - preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_gui->serialize()); + qDebug("DeviceUISet::saveMIMOChannelSettings: saving channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelAPI->getURI())); + preset->addChannel(m_channelInstanceRegistrations[i].m_channelAPI->getURI(), m_channelInstanceRegistrations[i].m_gui->serialize()); } } else diff --git a/sdrgui/device/deviceuiset.h b/sdrgui/device/deviceuiset.h index a2b32177a..d67219ad3 100644 --- a/sdrgui/device/deviceuiset.h +++ b/sdrgui/device/deviceuiset.h @@ -72,9 +72,9 @@ public: void saveTxChannelSettings(Preset* preset); void loadMIMOChannelSettings(const Preset* preset, PluginAPI *pluginAPI); void saveMIMOChannelSettings(Preset* preset); - void registerRxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI); - void registerTxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI); - void registerChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI); + void registerRxChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI); + void registerTxChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI); + void registerChannelInstance(ChannelAPI *channelAPI, ChannelGUI* channelGUI); // These are the number of channel types available for selection void setNumberOfAvailableRxChannels(int number) { m_nbAvailableRxChannels = number; } @@ -87,20 +87,17 @@ public: private: struct ChannelInstanceRegistration { - QString m_channelURI; ChannelAPI *m_channelAPI; ChannelGUI* m_gui; int m_channelType; ChannelInstanceRegistration() : - m_channelURI(), m_gui(nullptr), m_channelAPI(nullptr), m_channelType(0) { } - ChannelInstanceRegistration(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI, int channelType) : - m_channelURI(channelName), + ChannelInstanceRegistration(ChannelAPI *channelAPI, ChannelGUI* channelGUI, int channelType) : m_gui(channelGUI), m_channelAPI(channelAPI), m_channelType(channelType) diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 76d642c81..58d382b69 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -1925,7 +1925,7 @@ void MainWindow::channelAddClicked(int channelIndex) BasebandSampleSink *rxChannel; pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI); ChannelGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel); - deviceUI->registerRxChannelInstance(channelAPI->getURI(), channelAPI, gui); + deviceUI->registerRxChannelInstance(channelAPI, gui); } else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels { @@ -1935,7 +1935,7 @@ void MainWindow::channelAddClicked(int channelIndex) BasebandSampleSource *txChannel; pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI); ChannelGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel); - deviceUI->registerTxChannelInstance(channelAPI->getURI(), channelAPI, gui); + deviceUI->registerTxChannelInstance(channelAPI, gui); } else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range { @@ -1952,7 +1952,7 @@ void MainWindow::channelAddClicked(int channelIndex) BasebandSampleSink *rxChannel; pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI); ChannelGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel); - deviceUI->registerRxChannelInstance(channelAPI->getURI(), channelAPI, gui); + deviceUI->registerRxChannelInstance(channelAPI, gui); } else if (channelIndex < nbRxChannels + nbTxChannels) { @@ -1962,7 +1962,7 @@ void MainWindow::channelAddClicked(int channelIndex) BasebandSampleSource *txChannel; pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI); ChannelGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel); - deviceUI->registerTxChannelInstance(channelAPI->getURI(), channelAPI, gui); + deviceUI->registerTxChannelInstance(channelAPI, gui); } } }