mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-22 03:19:25 -04:00
Delete channel API from DeviceUISet. Update FeatureUISet
This commit is contained in:
parent
e9a32528d7
commit
6ebf4569bf
plugins
channelrx
chanalyzer
demodam
demodatv
demodbfm
demoddatv
demoddsd
demodfreedv
demodlora
demodnfm
demodssb
demodwfm
filesink
freqtracker
localsink
remotesink
udpsink
channeltx
filesource
localsource
modam
modatv
modfreedv
modnfm
modpacket
modssb
modwfm
remotesource
udpsource
feature
sdrgui
@ -424,7 +424,6 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
|
||||
|
||||
ChannelAnalyzerGUI::~ChannelAnalyzerGUI()
|
||||
{
|
||||
delete m_channelAnalyzer; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_scopeVis;
|
||||
delete m_spectrumScopeComboVis;
|
||||
delete ui;
|
||||
|
@ -64,6 +64,7 @@ AMDemod::AMDemod(DeviceAPI *deviceAPI) :
|
||||
|
||||
AMDemod::~AMDemod()
|
||||
{
|
||||
qDebug("AMDemod::~AMDemod");
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
m_deviceAPI->removeChannelSinkAPI(this);
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
};
|
||||
|
||||
AMDemod(DeviceAPI *deviceAPI);
|
||||
~AMDemod();
|
||||
virtual ~AMDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
|
@ -289,7 +289,6 @@ AMDemodGUI::AMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
||||
|
||||
AMDemodGUI::~AMDemodGUI()
|
||||
{
|
||||
delete m_amDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
};
|
||||
|
||||
ATVDemod(DeviceAPI *deviceAPI);
|
||||
~ATVDemod();
|
||||
virtual ~ATVDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
|
@ -275,7 +275,6 @@ ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Base
|
||||
|
||||
ATVDemodGUI::~ATVDemodGUI()
|
||||
{
|
||||
delete m_atvDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_scopeVis;
|
||||
delete ui;
|
||||
}
|
||||
|
@ -420,7 +420,6 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
BFMDemodGUI::~BFMDemodGUI()
|
||||
{
|
||||
delete m_bfmDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class DATVDemod : public BasebandSampleSink, public ChannelAPI
|
||||
public:
|
||||
|
||||
DATVDemod(DeviceAPI *);
|
||||
~DATVDemod();
|
||||
virtual ~DATVDemod();
|
||||
|
||||
virtual void destroy() { delete this; }
|
||||
virtual void getIdentifier(QString& id) { id = m_channelId; }
|
||||
|
@ -244,7 +244,6 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba
|
||||
|
||||
DATVDemodGUI::~DATVDemodGUI()
|
||||
{
|
||||
delete m_objDATVDemod;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
};
|
||||
|
||||
DSDDemod(DeviceAPI *deviceAPI);
|
||||
~DSDDemod();
|
||||
virtual ~DSDDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
|
@ -381,7 +381,6 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
DSDDemodGUI::~DSDDemodGUI()
|
||||
{
|
||||
delete m_dsdDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete m_scopeVisXY;
|
||||
delete ui;
|
||||
}
|
||||
|
@ -308,7 +308,6 @@ FreeDVDemodGUI::FreeDVDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B
|
||||
|
||||
FreeDVDemodGUI::~FreeDVDemodGUI()
|
||||
{
|
||||
delete m_freeDVDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,6 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
|
||||
LoRaDemodGUI::~LoRaDemodGUI()
|
||||
{
|
||||
m_deviceUISet->removeRxChannelInstance(this);
|
||||
delete m_LoRaDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
};
|
||||
|
||||
NFMDemod(DeviceAPI *deviceAPI);
|
||||
~NFMDemod();
|
||||
virtual ~NFMDemod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positive);
|
||||
|
@ -333,7 +333,6 @@ NFMDemodGUI::NFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
NFMDemodGUI::~NFMDemodGUI()
|
||||
{
|
||||
delete m_nfmDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,6 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
SSBDemodGUI::~SSBDemodGUI()
|
||||
{
|
||||
delete m_ssbDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -246,8 +246,6 @@ WFMDemodGUI::WFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
WFMDemodGUI::~WFMDemodGUI()
|
||||
{
|
||||
delete m_wfmDemod; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
//delete m_channelMarker;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,6 @@ FileSinkGUI::FileSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
|
||||
FileSinkGUI::~FileSinkGUI()
|
||||
{
|
||||
delete m_fileSink; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
};
|
||||
|
||||
FreqTracker(DeviceAPI *deviceAPI);
|
||||
~FreqTracker();
|
||||
virtual ~FreqTracker();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
|
@ -332,7 +332,6 @@ FreqTrackerGUI::FreqTrackerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B
|
||||
|
||||
FreqTrackerGUI::~FreqTrackerGUI()
|
||||
{
|
||||
delete m_freqTracker; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,6 @@ LocalSinkGUI::LocalSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
|
||||
LocalSinkGUI::~LocalSinkGUI()
|
||||
{
|
||||
delete m_localSink; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,6 @@ RemoteSinkGUI::RemoteSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
|
||||
|
||||
RemoteSinkGUI::~RemoteSinkGUI()
|
||||
{
|
||||
delete m_remoteSink; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,6 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
||||
|
||||
UDPSinkGUI::~UDPSinkGUI()
|
||||
{
|
||||
delete m_udpSink; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public:
|
||||
};
|
||||
|
||||
FileSource(DeviceAPI *deviceAPI);
|
||||
~FileSource();
|
||||
virtual ~FileSource();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -216,7 +216,6 @@ FileSourceGUI::FileSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
|
||||
|
||||
FileSourceGUI::~FileSourceGUI()
|
||||
{
|
||||
delete m_fileSource;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,6 @@ LocalSourceGUI::LocalSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, B
|
||||
|
||||
LocalSourceGUI::~LocalSourceGUI()
|
||||
{
|
||||
delete m_localSource; // TODO: check this: when the GUI closes it has to delete the demodulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
AMMod(DeviceAPI *deviceAPI);
|
||||
~AMMod();
|
||||
virtual ~AMMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -385,7 +385,6 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
|
||||
|
||||
AMModGUI::~AMModGUI()
|
||||
{
|
||||
delete m_amMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
ATVMod(DeviceAPI *deviceAPI);
|
||||
~ATVMod();
|
||||
virtual ~ATVMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -116,7 +116,6 @@ ATVModGUI::ATVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
|
||||
ATVModGUI::~ATVModGUI()
|
||||
{
|
||||
delete m_atvMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
FreeDVMod(DeviceAPI *deviceAPI);
|
||||
~FreeDVMod();
|
||||
virtual ~FreeDVMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -396,7 +396,6 @@ FreeDVModGUI::FreeDVModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
|
||||
FreeDVModGUI::~FreeDVModGUI()
|
||||
{
|
||||
delete m_freeDVMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
NFMMod(DeviceAPI *deviceAPI);
|
||||
~NFMMod();
|
||||
virtual ~NFMMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -418,7 +418,6 @@ NFMModGUI::NFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
|
||||
NFMModGUI::~NFMModGUI()
|
||||
{
|
||||
delete m_nfmMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
PacketMod(DeviceAPI *deviceAPI);
|
||||
~PacketMod();
|
||||
virtual ~PacketMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -465,7 +465,6 @@ PacketModGUI::PacketModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
|
||||
PacketModGUI::~PacketModGUI()
|
||||
{
|
||||
delete m_packetMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
SSBMod(DeviceAPI *deviceAPI);
|
||||
~SSBMod();
|
||||
virtual ~SSBMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -464,7 +464,6 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
|
||||
SSBModGUI::~SSBModGUI()
|
||||
{
|
||||
delete m_ssbMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public:
|
||||
//=================================================================
|
||||
|
||||
WFMMod(DeviceAPI *deviceAPI);
|
||||
~WFMMod();
|
||||
virtual ~WFMMod();
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
virtual void start();
|
||||
|
@ -402,7 +402,6 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
|
||||
WFMModGUI::~WFMModGUI()
|
||||
{
|
||||
delete m_wfmMod; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
};
|
||||
|
||||
RemoteSource(DeviceAPI *deviceAPI);
|
||||
~RemoteSource();
|
||||
virtual ~RemoteSource();
|
||||
|
||||
virtual void destroy() { delete this; }
|
||||
|
||||
|
@ -190,7 +190,6 @@ RemoteSourceGUI::RemoteSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet,
|
||||
|
||||
RemoteSourceGUI::~RemoteSourceGUI()
|
||||
{
|
||||
delete m_remoteSrc;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,6 @@ UDPSourceGUI::UDPSourceGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
|
||||
UDPSourceGUI::~UDPSourceGUI()
|
||||
{
|
||||
delete m_udpSource; // TODO: check this: when the GUI closes it has to delete the modulator
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
};
|
||||
|
||||
RigCtlServer(WebAPIAdapterInterface *webAPIAdapterInterface);
|
||||
~RigCtlServer();
|
||||
virtual ~RigCtlServer();
|
||||
virtual void destroy() { delete this; }
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
};
|
||||
|
||||
SimplePTT(WebAPIAdapterInterface *webAPIAdapterInterface);
|
||||
~SimplePTT();
|
||||
virtual ~SimplePTT();
|
||||
virtual void destroy() { delete this; }
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
|
@ -94,63 +94,49 @@ void DeviceUISet::addRollupWidget(QWidget *widget)
|
||||
m_channelWindow->addRollupWidget(widget);
|
||||
}
|
||||
|
||||
void DeviceUISet::registerRxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* pluginGUI)
|
||||
void DeviceUISet::registerRxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, pluginGUI, 0));
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 0));
|
||||
QObject::connect(
|
||||
channelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
|
||||
void DeviceUISet::registerTxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* pluginGUI)
|
||||
void DeviceUISet::registerTxChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, pluginGUI, 1));
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 1));
|
||||
QObject::connect(
|
||||
channelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
|
||||
void DeviceUISet::registerChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* pluginGUI)
|
||||
void DeviceUISet::registerChannelInstance(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, pluginGUI, 2));
|
||||
}
|
||||
|
||||
void DeviceUISet::removeRxChannelInstance(ChannelGUI* pluginGUI)
|
||||
{
|
||||
for (ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == pluginGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUISet::removeTxChannelInstance(ChannelGUI* pluginGUI)
|
||||
{
|
||||
for (ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == pluginGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUISet::removeChannelInstance(ChannelGUI* pluginGUI)
|
||||
{
|
||||
for (ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == pluginGUI)
|
||||
{
|
||||
m_channelInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_channelInstanceRegistrations.append(ChannelInstanceRegistration(channelName, channelAPI, channelGUI, 2));
|
||||
QObject::connect(
|
||||
channelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(channelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
|
||||
void DeviceUISet::freeChannels()
|
||||
{
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceUISet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelName));
|
||||
qDebug("DeviceUISet::freeChannels: destroying channel [%s]", qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy();
|
||||
m_channelInstanceRegistrations[i].m_channelAPI->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,9 +145,10 @@ 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_channelName),
|
||||
qPrintable(m_channelInstanceRegistrations[channelIndex].m_channelURI),
|
||||
channelIndex);
|
||||
m_channelInstanceRegistrations[channelIndex].m_gui->destroy();
|
||||
m_channelInstanceRegistrations[channelIndex].m_channelAPI->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,21 +156,22 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
{
|
||||
if (preset->isSourcePreset())
|
||||
{
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s]", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: Loading preset [%s | %s]",
|
||||
qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
// Available channel plugins
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getRxChannelRegistrations();
|
||||
|
||||
// copy currently open channels and clear list
|
||||
ChannelInstanceRegistrations openChannels = m_channelInstanceRegistrations;
|
||||
m_channelInstanceRegistrations.clear();
|
||||
|
||||
for(int i = 0; i < openChannels.count(); i++)
|
||||
// clear list
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: destroying old channel [%s]", qPrintable(openChannels[i].m_channelName));
|
||||
openChannels[i].m_gui->destroy(); // FIXME: stop channel before
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: destroying old channel [%s]",
|
||||
qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy(); // FIXME: stop channel before
|
||||
m_channelInstanceRegistrations[i].m_channelAPI->destroy();
|
||||
}
|
||||
|
||||
m_channelInstanceRegistrations.clear();
|
||||
qDebug("DeviceUISet::loadRxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||
|
||||
for (int i = 0; i < preset->getChannelCount(); i++)
|
||||
@ -206,6 +194,13 @@ void DeviceUISet::loadRxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
(*channelRegistrations)[i].m_plugin->createRxChannel(m_deviceAPI, &rxChannel, &channelAPI);
|
||||
rxChannelGUI = (*channelRegistrations)[i].m_plugin->createRxChannelGUI(this, rxChannel);
|
||||
registerRxChannelInstance(channelAPI->getURI(), channelAPI, rxChannelGUI);
|
||||
QObject::connect(
|
||||
rxChannelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(rxChannelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -231,8 +226,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_channelName));
|
||||
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
|
||||
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());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -245,21 +240,22 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
{
|
||||
if (preset->isSinkPreset())
|
||||
{
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s]", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: Loading preset [%s | %s]",
|
||||
qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
// Available channel plugins
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getTxChannelRegistrations();
|
||||
|
||||
// copy currently open channels and clear list
|
||||
ChannelInstanceRegistrations openChannels = m_channelInstanceRegistrations;
|
||||
m_channelInstanceRegistrations.clear();
|
||||
|
||||
for(int i = 0; i < openChannels.count(); i++)
|
||||
// clear list
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: destroying old channel [%s]", qPrintable(openChannels[i].m_channelName));
|
||||
openChannels[i].m_gui->destroy();
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: destroying old channel [%s]",
|
||||
qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy();
|
||||
m_channelInstanceRegistrations[i].m_channelAPI->destroy();
|
||||
}
|
||||
|
||||
m_channelInstanceRegistrations.clear();
|
||||
qDebug("DeviceUISet::loadTxChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||
|
||||
for(int i = 0; i < preset->getChannelCount(); i++)
|
||||
@ -281,6 +277,13 @@ void DeviceUISet::loadTxChannelSettings(const Preset *preset, PluginAPI *pluginA
|
||||
(*channelRegistrations)[i].m_plugin->createTxChannel(m_deviceAPI, &txChannel, &channelAPI);
|
||||
txChannelGUI = (*channelRegistrations)[i].m_plugin->createTxChannelGUI(this, txChannel);
|
||||
registerTxChannelInstance(channelAPI->getURI(), channelAPI, txChannelGUI);
|
||||
QObject::connect(
|
||||
txChannelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(txChannelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -307,8 +310,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_channelName));
|
||||
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
|
||||
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());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -321,21 +324,22 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
||||
{
|
||||
if (preset->isMIMOPreset())
|
||||
{
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s]", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: Loading preset [%s | %s]",
|
||||
qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
||||
|
||||
// Available channel plugins
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = pluginAPI->getMIMOChannelRegistrations();
|
||||
|
||||
// copy currently open channels and clear list
|
||||
ChannelInstanceRegistrations openChannels = m_channelInstanceRegistrations;
|
||||
m_channelInstanceRegistrations.clear();
|
||||
|
||||
for(int i = 0; i < openChannels.count(); i++)
|
||||
// clear list
|
||||
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
|
||||
{
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s]", qPrintable(openChannels[i].m_channelName));
|
||||
openChannels[i].m_gui->destroy(); // FIXME: stop channel before
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: destroying old channel [%s]",
|
||||
qPrintable(m_channelInstanceRegistrations[i].m_channelURI));
|
||||
m_channelInstanceRegistrations[i].m_gui->destroy(); // FIXME: stop channel before
|
||||
m_channelInstanceRegistrations[i].m_channelAPI->destroy();
|
||||
}
|
||||
|
||||
m_channelInstanceRegistrations.clear();
|
||||
qDebug("DeviceUISet::loadMIMOChannelSettings: %d channel(s) in preset", preset->getChannelCount());
|
||||
|
||||
for (int i = 0; i < preset->getChannelCount(); i++)
|
||||
@ -359,6 +363,13 @@ void DeviceUISet::loadMIMOChannelSettings(const Preset *preset, PluginAPI *plugi
|
||||
mimoChannelGUI = (*channelRegistrations)[i].m_plugin->createMIMOChannelGUI(this, mimoChannel);
|
||||
(*channelRegistrations)[i].m_plugin->createMIMOChannel(m_deviceAPI, &mimoChannel, &channelAPI);
|
||||
registerChannelInstance(channelAPI->getURI(), channelAPI, mimoChannelGUI);
|
||||
QObject::connect(
|
||||
mimoChannelGUI,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleChannelGUIClosing(mimoChannelGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -384,8 +395,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_channelName));
|
||||
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
|
||||
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());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -414,3 +425,15 @@ bool DeviceUISet::ChannelInstanceRegistration::operator<(const ChannelInstanceRe
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
|
||||
{
|
||||
for (ChannelInstanceRegistrations::iterator it = m_channelInstanceRegistrations.begin(); it != m_channelInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == channelGUI)
|
||||
{
|
||||
it->m_channelAPI->destroy();
|
||||
m_channelInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef SDRGUI_DEVICE_DEVICEUISET_H_
|
||||
#define SDRGUI_DEVICE_DEVICEUISET_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QByteArray>
|
||||
|
||||
@ -38,8 +39,9 @@ class ChannelAPI;
|
||||
class ChannelGUI;
|
||||
class Preset;
|
||||
|
||||
class SDRGUI_API DeviceUISet
|
||||
class SDRGUI_API DeviceUISet : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpectrumVis *m_spectrumVis;
|
||||
GLSpectrum *m_spectrum;
|
||||
@ -72,9 +74,6 @@ public:
|
||||
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 removeRxChannelInstance(ChannelGUI* channelGUI);
|
||||
void removeTxChannelInstance(ChannelGUI* channelGUI);
|
||||
void removeChannelInstance(ChannelGUI* channelGUI);
|
||||
|
||||
// These are the number of channel types available for selection
|
||||
void setNumberOfAvailableRxChannels(int number) { m_nbAvailableRxChannels = number; }
|
||||
@ -87,22 +86,22 @@ public:
|
||||
private:
|
||||
struct ChannelInstanceRegistration
|
||||
{
|
||||
QString m_channelName;
|
||||
QString m_channelURI;
|
||||
ChannelAPI *m_channelAPI;
|
||||
ChannelGUI* m_gui;
|
||||
int m_channelType;
|
||||
|
||||
ChannelInstanceRegistration() :
|
||||
m_channelName(),
|
||||
m_channelAPI(nullptr),
|
||||
m_channelURI(),
|
||||
m_gui(nullptr),
|
||||
m_channelAPI(nullptr),
|
||||
m_channelType(0)
|
||||
{ }
|
||||
|
||||
ChannelInstanceRegistration(const QString& channelName, ChannelAPI *channelAPI, ChannelGUI* channelGUI, int channelType) :
|
||||
m_channelName(channelName),
|
||||
m_channelAPI(channelAPI),
|
||||
m_channelURI(channelName),
|
||||
m_gui(channelGUI),
|
||||
m_channelAPI(channelAPI),
|
||||
m_channelType(channelType)
|
||||
{ }
|
||||
|
||||
@ -118,6 +117,9 @@ private:
|
||||
int m_nbAvailableRxChannels; //!< Number of Rx channels available for selection
|
||||
int m_nbAvailableTxChannels; //!< Number of Tx channels available for selection
|
||||
int m_nbAvailableMIMOChannels; //!< Number of MIMO channels available for selection
|
||||
|
||||
private slots:
|
||||
void handleChannelGUIClosing(ChannelGUI* channelGUI);
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,23 +49,11 @@ void FeatureUISet::registerFeatureInstance(const QString& featureURI, FeatureGUI
|
||||
featureGUI,
|
||||
&FeatureGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleClosingFeatureGUI(featureGUI, feature); },
|
||||
[=](){ this->handleClosingFeatureGUI(featureGUI); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
|
||||
void FeatureUISet::removeFeatureInstance(FeatureGUI* featureGUI)
|
||||
{
|
||||
for (FeatureInstanceRegistrations::iterator it = m_featureInstanceRegistrations.begin(); it != m_featureInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == featureGUI)
|
||||
{
|
||||
m_featureInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sort by name
|
||||
bool FeatureUISet::FeatureInstanceRegistration::operator<(const FeatureInstanceRegistration& other) const
|
||||
{
|
||||
@ -179,8 +167,15 @@ void FeatureUISet::saveFeatureSetSettings(FeatureSetPreset *preset)
|
||||
}
|
||||
|
||||
|
||||
void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI, Feature *feature)
|
||||
void FeatureUISet::handleClosingFeatureGUI(FeatureGUI *featureGUI)
|
||||
{
|
||||
removeFeatureInstance(featureGUI);
|
||||
feature->destroy();
|
||||
for (FeatureInstanceRegistrations::iterator it = m_featureInstanceRegistrations.begin(); it != m_featureInstanceRegistrations.end(); ++it)
|
||||
{
|
||||
if (it->m_gui == featureGUI)
|
||||
{
|
||||
it->m_feature->destroy();
|
||||
m_featureInstanceRegistrations.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ public:
|
||||
void addRollupWidget(QWidget *widget); //!< Add feature rollup widget to feature window
|
||||
int getNumberOfFeatures() const { return m_featureInstanceRegistrations.size(); }
|
||||
void registerFeatureInstance(const QString& featureURI, FeatureGUI* featureGUI, Feature *feature);
|
||||
void removeFeatureInstance(FeatureGUI* featureGUI);
|
||||
void deleteFeature(int featureIndex);
|
||||
const Feature *getFeatureAt(int featureIndex) const;
|
||||
Feature *getFeatureAt(int featureIndex);
|
||||
@ -81,7 +80,7 @@ private:
|
||||
void freeFeatures();
|
||||
|
||||
private slots:
|
||||
void handleClosingFeatureGUI(FeatureGUI *featureGUI, Feature *feature);
|
||||
void handleClosingFeatureGUI(FeatureGUI *featureGUI);
|
||||
};
|
||||
|
||||
#endif // SDRGUI_FEATURE_FEATUREUISET_H_
|
||||
|
@ -1924,13 +1924,6 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
|
||||
ChannelGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
deviceUI->registerRxChannelInstance(channelAPI->getURI(), channelAPI, gui);
|
||||
QObject::connect(
|
||||
gui,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleClosingRxChannelGUI(deviceUI, gui); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
else if (deviceUI->m_deviceSinkEngine) // sink device => Tx channels
|
||||
{
|
||||
@ -1941,13 +1934,6 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
|
||||
ChannelGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
deviceUI->registerTxChannelInstance(channelAPI->getURI(), channelAPI, gui);
|
||||
QObject::connect(
|
||||
gui,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleClosingTxChannelGUI(deviceUI, gui); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
else if (deviceUI->m_deviceMIMOEngine) // MIMO device => all possible channels. Depends on index range
|
||||
{
|
||||
@ -1965,13 +1951,6 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
|
||||
ChannelGUI *gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
|
||||
deviceUI->registerRxChannelInstance(channelAPI->getURI(), channelAPI, gui);
|
||||
QObject::connect(
|
||||
gui,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleClosingRxChannelGUI(deviceUI, gui); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
else if (channelIndex < nbRxChannels + nbTxChannels)
|
||||
{
|
||||
@ -1982,13 +1961,6 @@ void MainWindow::channelAddClicked(int channelIndex)
|
||||
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
|
||||
ChannelGUI *gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
|
||||
deviceUI->registerTxChannelInstance(channelAPI->getURI(), channelAPI, gui);
|
||||
QObject::connect(
|
||||
gui,
|
||||
&ChannelGUI::closing,
|
||||
this,
|
||||
[=](){ this->handleClosingTxChannelGUI(deviceUI, gui); },
|
||||
Qt::QueuedConnection
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2177,18 +2149,3 @@ void MainWindow::commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::handleClosingRxChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui)
|
||||
{
|
||||
deviceUISet->removeRxChannelInstance(gui);
|
||||
}
|
||||
|
||||
void MainWindow::handleClosingTxChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui)
|
||||
{
|
||||
deviceUISet->removeTxChannelInstance(gui);
|
||||
}
|
||||
|
||||
void MainWindow::handleClosingMIMOChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui)
|
||||
{
|
||||
deviceUISet->removeChannelInstance(gui);
|
||||
}
|
||||
|
@ -533,9 +533,6 @@ private slots:
|
||||
void tabInputViewIndexChanged();
|
||||
void tabChannelsIndexChanged();
|
||||
void commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release);
|
||||
void handleClosingRxChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui);
|
||||
void handleClosingTxChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui);
|
||||
void handleClosingMIMOChannelGUI(DeviceUISet *deviceUISet, ChannelGUI *gui);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_MAINWINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user