From 766e6aac1ce24beadd6793f45709e2ef96ecca33 Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 30 May 2018 11:49:54 +0200 Subject: [PATCH] Renamed Channel Analyzer NG to Channel Analyzer externally (no classes renaming) --- .../channelrx/chanalyzerng/chanalyzerng.cpp | 4 +-- .../chanalyzerng/chanalyzernggui.cpp | 2 +- .../channelrx/chanalyzerng/chanalyzernggui.ui | 2 +- .../chanalyzerng/chanalyzerngplugin.cpp | 4 +-- .../chanalyzerng/chanalyzerngsettings.cpp | 2 +- sdrgui/device/deviceuiset.cpp | 22 ++++++++++---- sdrgui/device/deviceuiset.h | 2 ++ sdrsrv/device/deviceset.cpp | 30 +++++++++++++------ sdrsrv/device/deviceset.h | 2 ++ 9 files changed, 49 insertions(+), 21 deletions(-) diff --git a/plugins/channelrx/chanalyzerng/chanalyzerng.cpp b/plugins/channelrx/chanalyzerng/chanalyzerng.cpp index 958c59b63..66dcda2e9 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerng.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzerng.cpp @@ -30,8 +30,8 @@ MESSAGE_CLASS_DEFINITION(ChannelAnalyzerNG::MsgConfigureChannelAnalyzerOld, Mess MESSAGE_CLASS_DEFINITION(ChannelAnalyzerNG::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(ChannelAnalyzerNG::MsgReportChannelSampleRateChanged, Message) -const QString ChannelAnalyzerNG::m_channelIdURI = "sdrangel.channel.chanalyzerng"; -const QString ChannelAnalyzerNG::m_channelId = "ChannelAnalyzerNG"; +const QString ChannelAnalyzerNG::m_channelIdURI = "sdrangel.channel.chanalyzer"; +const QString ChannelAnalyzerNG::m_channelId = "ChannelAnalyzer"; ChannelAnalyzerNG::ChannelAnalyzerNG(DeviceSourceAPI *deviceAPI) : ChannelSinkAPI(m_channelIdURI), diff --git a/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp b/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp index 50661d3da..56f1d7f95 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzernggui.cpp @@ -417,7 +417,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceUISet *de m_channelMarker.setBandwidth(m_rate); m_channelMarker.setSidebands(ChannelMarker::usb); m_channelMarker.setCenterFrequency(0); - m_channelMarker.setTitle("Channel Analyzer NG"); + m_channelMarker.setTitle("Channel Analyzer"); m_channelMarker.blockSignals(false); m_channelMarker.setVisible(true); // activate signal on the last setting only setTitleColor(m_channelMarker.getColor()); diff --git a/plugins/channelrx/chanalyzerng/chanalyzernggui.ui b/plugins/channelrx/chanalyzerng/chanalyzernggui.ui index f027cbb56..73bb3bdbb 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzernggui.ui +++ b/plugins/channelrx/chanalyzerng/chanalyzernggui.ui @@ -23,7 +23,7 @@ - Channel Analyzer NG + Channel Analyzer diff --git a/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp b/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp index b2450da84..8f3446754 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzerngplugin.cpp @@ -22,8 +22,8 @@ #include "chanalyzerng.h" const PluginDescriptor ChannelAnalyzerNGPlugin::m_pluginDescriptor = { - QString("Channel Analyzer NG"), - QString("3.14.7"), + QString("Channel Analyzer"), + QString("4.0.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/chanalyzerng/chanalyzerngsettings.cpp b/plugins/channelrx/chanalyzerng/chanalyzerngsettings.cpp index aea2c0328..f8173243a 100644 --- a/plugins/channelrx/chanalyzerng/chanalyzerngsettings.cpp +++ b/plugins/channelrx/chanalyzerng/chanalyzerngsettings.cpp @@ -45,7 +45,7 @@ void ChannelAnalyzerNGSettings::resetToDefaults() m_pllPskOrder = 1; m_inputType = InputSignal; m_rgbColor = QColor(128, 128, 128).rgb(); - m_title = "Channel Analyzer NG"; + m_title = "Channel Analyzer"; } QByteArray ChannelAnalyzerNGSettings::serialize() const diff --git a/sdrgui/device/deviceuiset.cpp b/sdrgui/device/deviceuiset.cpp index 7999b2486..8ab6b5d48 100644 --- a/sdrgui/device/deviceuiset.cpp +++ b/sdrgui/device/deviceuiset.cpp @@ -191,9 +191,12 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA for(int i = 0; i < channelRegistrations->count(); i++) { - if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) + //if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) + if (compareRxChannelURIs((*channelRegistrations)[i].m_channelIdURI, channelConfig.m_channelIdURI)) { - qDebug("DeviceUISet::loadRxChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI)); + qDebug("DeviceUISet::loadRxChannelSettings: creating new channel [%s] from config [%s]", + qPrintable((*channelRegistrations)[i].m_channelIdURI), + qPrintable(channelConfig.m_channelIdURI)); BasebandSampleSink *rxChannel = (*channelRegistrations)[i].m_plugin->createRxChannelBS(m_deviceSourceAPI); PluginInstanceGUI *rxChannelGUI = @@ -270,9 +273,11 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA for(int i = 0; i < channelRegistrations->count(); i++) { - if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) + if ((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) { - qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI)); + qDebug("DeviceUISet::loadTxChannelSettings: creating new channel [%s] from config [%s]", + qPrintable((*channelRegistrations)[i].m_channelIdURI), + qPrintable(channelConfig.m_channelIdURI)); BasebandSampleSource *txChannel = (*channelRegistrations)[i].m_plugin->createTxChannelBS(m_deviceSinkAPI); PluginInstanceGUI *txChannelGUI = @@ -347,4 +352,11 @@ bool DeviceUISet::ChannelInstanceRegistration::operator<(const ChannelInstanceRe } } - +bool DeviceUISet::compareRxChannelURIs(const QString& registerdChannelURI, const QString& xChannelURI) +{ + if ((xChannelURI == "sdrangel.channel.chanalyzerng") || (xChannelURI == "sdrangel.channel.chanalyzer")) { // renamed ChanalyzerNG to Chanalyzer in 4.0.0 + return registerdChannelURI == "sdrangel.channel.chanalyzer"; + } else { + return registerdChannelURI == xChannelURI; + } +} diff --git a/sdrgui/device/deviceuiset.h b/sdrgui/device/deviceuiset.h index 2b5b38030..0bb8d32dc 100644 --- a/sdrgui/device/deviceuiset.h +++ b/sdrgui/device/deviceuiset.h @@ -97,6 +97,8 @@ private: void renameRxChannelInstances(); void renameTxChannelInstances(); + /** Use this function to support possible older identifiers in presets */ + bool compareRxChannelURIs(const QString& registerdChannelURI, const QString& xChannelURI); }; diff --git a/sdrsrv/device/deviceset.cpp b/sdrsrv/device/deviceset.cpp index 469628f47..07585b64f 100644 --- a/sdrsrv/device/deviceset.cpp +++ b/sdrsrv/device/deviceset.cpp @@ -152,18 +152,19 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI qDebug("DeviceSet::loadChannelSettings: %d channel(s) in preset", preset->getChannelCount()); - for(int i = 0; i < preset->getChannelCount(); i++) + for (int i = 0; i < preset->getChannelCount(); i++) { const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i); ChannelInstanceRegistration reg; // if we have one instance available already, use it - for(int i = 0; i < openChannels.count(); i++) + for (int i = 0; i < openChannels.count(); i++) { qDebug("DeviceSet::loadChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channelIdURI)); - if(openChannels[i].m_channelName == channelConfig.m_channelIdURI) + //if(openChannels[i].m_channelName == channelConfig.m_channelIdURI) + if (compareRxChannelURIs(openChannels[i].m_channelName, channelConfig.m_channelIdURI)) { qDebug("DeviceSet::loadChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName)); reg = openChannels.takeAt(i); @@ -174,13 +175,16 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI // if we haven't one already, create one - if(reg.m_channelSinkAPI == 0) + if (reg.m_channelSinkAPI == 0) { - for(int i = 0; i < channelRegistrations->count(); i++) + for (int i = 0; i < channelRegistrations->count(); i++) { - if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) + //if((*channelRegistrations)[i].m_channelIdURI == channelConfig.m_channelIdURI) + if (compareRxChannelURIs((*channelRegistrations)[i].m_channelIdURI, channelConfig.m_channelIdURI)) { - qDebug("DeviceSet::loadChannelSettings: creating new channel [%s]", qPrintable(channelConfig.m_channelIdURI)); + qDebug("DeviceSet::loadChannelSettings: creating new channel [%s] from config [%s]", + qPrintable((*channelRegistrations)[i].m_channelIdURI), + qPrintable(channelConfig.m_channelIdURI)); ChannelSinkAPI *rxChannel = (*channelRegistrations)[i].m_plugin->createRxChannelCS(m_deviceSourceAPI); reg = ChannelInstanceRegistration(channelConfig.m_channelIdURI, rxChannel); m_rxChannelInstanceRegistrations.append(reg); @@ -189,7 +193,7 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI } } - if(reg.m_channelSinkAPI != 0) + if (reg.m_channelSinkAPI != 0) { qDebug("DeviceSet::loadChannelSettings: deserializing channel [%s]", qPrintable(channelConfig.m_channelIdURI)); reg.m_channelSinkAPI->deserialize(channelConfig.m_config); @@ -197,7 +201,7 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI } // everything, that is still "available" is not needed anymore - for(int i = 0; i < openChannels.count(); i++) + for (int i = 0; i < openChannels.count(); i++) { qDebug("DeviceSet::loadChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName)); openChannels[i].m_channelSinkAPI->destroy(); @@ -368,3 +372,11 @@ bool DeviceSet::ChannelInstanceRegistration::operator<(const ChannelInstanceRegi } } +bool DeviceSet::compareRxChannelURIs(const QString& registerdChannelURI, const QString& xChannelURI) +{ + if ((xChannelURI == "sdrangel.channel.chanalyzerng") || (xChannelURI == "sdrangel.channel.chanalyzer")) { // renamed ChanalyzerNG to Chanalyzer in 4.0.0 + return registerdChannelURI == "sdrangel.channel.chanalyzer"; + } else { + return registerdChannelURI == xChannelURI; + } +} diff --git a/sdrsrv/device/deviceset.h b/sdrsrv/device/deviceset.h index dd072c0f2..e76ea7f90 100644 --- a/sdrsrv/device/deviceset.h +++ b/sdrsrv/device/deviceset.h @@ -92,6 +92,8 @@ private: void renameRxChannelInstances(); void renameTxChannelInstances(); + /** Use this function to support possible older identifiers in presets */ + bool compareRxChannelURIs(const QString& registerdChannelURI, const QString& xChannelURI); }; #endif /* SDRSRV_DEVICE_DEVICESET_H_ */