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

DeviceSet: call m_channelURI what is a channel URI

This commit is contained in:
f4exb 2020-10-15 00:50:15 +02:00
parent 61d3431095
commit 99af2d8ad7
2 changed files with 26 additions and 26 deletions

View File

@ -29,8 +29,8 @@
#include "deviceset.h" #include "deviceset.h"
DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI) : DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QString& channelURI, ChannelAPI* channelAPI) :
m_channelName(channelName), m_channelURI(channelURI),
m_channelAPI(channelAPI) m_channelAPI(channelAPI)
{} {}
@ -53,7 +53,7 @@ void DeviceSet::freeChannels()
{ {
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{ {
qDebug("DeviceSet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName)); qDebug("DeviceSet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
m_channelInstanceRegistrations[i].m_channelAPI->destroy(); m_channelInstanceRegistrations[i].m_channelAPI->destroy();
} }
} }
@ -140,12 +140,12 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
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)); qDebug("DeviceSet::loadChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelURI), qPrintable(channelConfig.m_channelIdURI));
//if(openChannels[i].m_channelName == channelConfig.m_channelIdURI) //if(openChannels[i].m_channelName == channelConfig.m_channelIdURI)
if (ChannelUtils::compareChannelURIs(openChannels[i].m_channelName, channelConfig.m_channelIdURI)) if (ChannelUtils::compareChannelURIs(openChannels[i].m_channelURI, channelConfig.m_channelIdURI))
{ {
qDebug("DeviceSet::loadChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName)); qDebug("DeviceSet::loadChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelURI));
reg = openChannels.takeAt(i); reg = openChannels.takeAt(i);
m_channelInstanceRegistrations.append(reg); m_channelInstanceRegistrations.append(reg);
break; break;
@ -183,7 +183,7 @@ void DeviceSet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
// everything, that is still "available" is not needed anymore // 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)); qDebug("DeviceSet::loadChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelURI));
openChannels[i].m_channelAPI->destroy(); openChannels[i].m_channelAPI->destroy();
} }
@ -203,8 +203,8 @@ void DeviceSet::saveRxChannelSettings(Preset *preset)
for (int i = 0; i < m_channelInstanceRegistrations.count(); i++) for (int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{ {
qDebug("DeviceSet::saveChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelName)); qDebug("DeviceSet::saveChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_channelAPI->serialize()); preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_channelAPI->serialize());
} }
} }
else else
@ -237,11 +237,11 @@ void DeviceSet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
for (int i = 0; i < openChannels.count(); i++) for (int i = 0; i < openChannels.count(); i++)
{ {
qDebug("DeviceSet::loadTxChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channelIdURI)); qDebug("DeviceSet::loadTxChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelURI), qPrintable(channelConfig.m_channelIdURI));
if (openChannels[i].m_channelName == channelConfig.m_channelIdURI) if (openChannels[i].m_channelURI == channelConfig.m_channelIdURI)
{ {
qDebug("DeviceSet::loadTxChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName)); qDebug("DeviceSet::loadTxChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelURI));
reg = openChannels.takeAt(i); reg = openChannels.takeAt(i);
m_channelInstanceRegistrations.append(reg); m_channelInstanceRegistrations.append(reg);
break; break;
@ -276,7 +276,7 @@ void DeviceSet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginAPI
// everything, that is still "available" is not needed anymore // 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::loadTxChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName)); qDebug("DeviceSet::loadTxChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelURI));
openChannels[i].m_channelAPI->destroy(); openChannels[i].m_channelAPI->destroy();
} }
@ -297,8 +297,8 @@ void DeviceSet::saveTxChannelSettings(Preset *preset)
for (int i = 0; i < m_channelInstanceRegistrations.count(); i++) for (int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{ {
qDebug("DeviceSet::saveTxChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelName)); qDebug("DeviceSet::saveTxChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_channelAPI->serialize()); preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_channelAPI->serialize());
} }
} }
else else
@ -331,12 +331,12 @@ void DeviceSet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *pluginA
for (int i = 0; i < openChannels.count(); i++) for (int i = 0; i < openChannels.count(); i++)
{ {
qDebug("DeviceSet::loadMIMOChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelName), qPrintable(channelConfig.m_channelIdURI)); qDebug("DeviceSet::loadMIMOChannelSettings: channels compare [%s] vs [%s]", qPrintable(openChannels[i].m_channelURI), qPrintable(channelConfig.m_channelIdURI));
//if(openChannels[i].m_channelName == channelConfig.m_channelIdURI) //if(openChannels[i].m_channelName == channelConfig.m_channelIdURI)
if (ChannelUtils::compareChannelURIs(openChannels[i].m_channelName, channelConfig.m_channelIdURI)) if (ChannelUtils::compareChannelURIs(openChannels[i].m_channelURI, channelConfig.m_channelIdURI))
{ {
qDebug("DeviceSet::loadMIMOChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelName)); qDebug("DeviceSet::loadMIMOChannelSettings: channel [%s] found", qPrintable(openChannels[i].m_channelURI));
reg = openChannels.takeAt(i); reg = openChannels.takeAt(i);
m_channelInstanceRegistrations.append(reg); m_channelInstanceRegistrations.append(reg);
break; break;
@ -374,7 +374,7 @@ void DeviceSet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *pluginA
// everything, that is still "available" is not needed anymore // 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::loadMIMOChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelName)); qDebug("DeviceSet::loadMIMOChannelSettings: destroying spare channel [%s]", qPrintable(openChannels[i].m_channelURI));
openChannels[i].m_channelAPI->destroy(); openChannels[i].m_channelAPI->destroy();
} }
@ -394,8 +394,8 @@ void DeviceSet::saveMIMOChannelSettings(Preset *preset)
for (int i = 0; i < m_channelInstanceRegistrations.count(); i++) for (int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{ {
qDebug("DeviceSet::saveMIMOChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelName)); qDebug("DeviceSet::saveMIMOChannelSettings: channel [%s] saved", qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_channelAPI->serialize()); preset->addChannel(m_channelInstanceRegistrations[i].m_channelURI, m_channelInstanceRegistrations[i].m_channelAPI->serialize());
} }
} }
else else
@ -408,7 +408,7 @@ void DeviceSet::renameChannelInstances()
{ {
for (int i = 0; i < m_channelInstanceRegistrations.count(); i++) for (int i = 0; i < m_channelInstanceRegistrations.count(); i++)
{ {
m_channelInstanceRegistrations[i].m_channelAPI->setName(QString("%1:%2").arg(m_channelInstanceRegistrations[i].m_channelName).arg(i)); m_channelInstanceRegistrations[i].m_channelAPI->setName(QString("%1:%2").arg(m_channelInstanceRegistrations[i].m_channelURI).arg(i));
} }
} }

View File

@ -64,18 +64,18 @@ public:
private: private:
struct ChannelInstanceRegistration struct ChannelInstanceRegistration
{ {
QString m_channelName; QString m_channelURI;
ChannelAPI *m_channelAPI; ChannelAPI *m_channelAPI;
ChannelInstanceRegistration() : ChannelInstanceRegistration() :
m_channelName(), m_channelURI(),
m_channelAPI(nullptr) m_channelAPI(nullptr)
{ } { }
ChannelInstanceRegistration(const QString& channelName, ChannelAPI* channelAPI); ChannelInstanceRegistration(const QString& channelURI, ChannelAPI* channelAPI);
ChannelInstanceRegistration(const ChannelInstanceRegistration& other) : ChannelInstanceRegistration(const ChannelInstanceRegistration& other) :
m_channelName(other.m_channelName), m_channelURI(other.m_channelURI),
m_channelAPI(other.m_channelAPI) m_channelAPI(other.m_channelAPI)
{ } { }