1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Fix warnings and Sky Map connections.

This commit is contained in:
srcejon 2024-02-16 18:08:31 +00:00
parent 483e338614
commit e1817958b5
5 changed files with 14 additions and 44 deletions

View File

@ -70,9 +70,9 @@ RadioAstronomy::RadioAstronomy(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
m_deviceAPI(deviceAPI),
m_basebandSampleRate(0),
m_sweeping(false),
m_availableFeatureHandler({"sdrangel.feature.startracker"}, QStringList{"startracker.target"}),
m_availableRotatorHandler({"sdrangel.feature.gs232controller"})
m_availableRotatorHandler({"sdrangel.feature.gs232controller"}),
m_sweeping(false)
{
qDebug("RadioAstronomy::RadioAstronomy");
setObjectName(m_channelId);

View File

@ -286,40 +286,8 @@ void GS232Controller::applySettings(const GS232ControllerSettings& settings, con
|| (!settings.m_source.isEmpty() && (m_selectedPipe == nullptr)) // Change in available pipes
|| force)
{
MainCore *mainCore = MainCore::instance();
MessagePipes& messagePipes = mainCore->getMessagePipes();
m_availableChannelOrFeatureHandler.deregisterPipes(m_selectedPipe, this, {"target"});
/*if (m_selectedPipe)
{
// Don't deref m_selectedPipe, as plugin may have been deleted
qDebug("GS232Controller::applySettings: unregister (%p)", m_selectedPipe);
messagePipes.unregisterProducerToConsumer(m_selectedPipe, this, "target");
}*/
m_selectedPipe = m_availableChannelOrFeatureHandler.registerPipes(settings.m_source, this, {"target"});
/*if (!settings.m_source.isEmpty())
{
int index = m_availableChannelOrFeatures.indexOfLongId(settings.m_source);
if (index >= 0)
{
QObject *object = m_availableChannelOrFeatures[index].m_object;
registerPipe(object);
m_selectedPipe = object;
}
else
{
m_selectedPipe = nullptr;
qDebug() << "GS232Controller::applySettings: No plugin corresponding to source " << settings.m_source;
}
}
else
{
m_selectedPipe = nullptr;
}*/
m_availableChannelOrFeatureHandler.deregisterPipes(m_selectedPipe, {"target"});
m_selectedPipe = m_availableChannelOrFeatureHandler.registerPipes(settings.m_source, {"target"});
}
GS232ControllerWorker::MsgConfigureGS232ControllerWorker *msg = GS232ControllerWorker::MsgConfigureGS232ControllerWorker::create(

View File

@ -258,6 +258,7 @@ SkyMapGUI::SkyMapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *
m_resizer.enableChildMouseTracking();
QObject::connect(&m_availableChannelOrFeatureHandler, &AvailableChannelOrFeatureHandler::channelsOrFeaturesChanged, this, &SkyMapGUI::updateSourceList);
QObject::connect(&m_availableChannelOrFeatureHandler, &AvailableChannelOrFeatureHandler::messageEnqueued, this, &SkyMapGUI::handlePipeMessageQueue);
m_availableChannelOrFeatureHandler.scanAvailableChannelsAndFeatures();
connect(&m_wtml, &WTML::dataUpdated, this, &SkyMapGUI::wtmlUpdated);
@ -473,10 +474,10 @@ void SkyMapGUI::applySettings(const QStringList& settingsKeys, bool force)
m_skymap->getInputMessageQueue()->push(message);
m_settingsKeys.clear();
m_availableChannelOrFeatureHandler.deregisterPipes(m_source, this, {"target", "skymap.target"});
m_availableChannelOrFeatureHandler.deregisterPipes(m_source, {"target", "skymap.target"});
QObject *oldSource = m_source;
m_source = m_availableChannelOrFeatureHandler.registerPipes(m_settings.m_source, this, {"target", "skymap.target"});
m_source = m_availableChannelOrFeatureHandler.registerPipes(m_settings.m_source, {"target", "skymap.target"});
// When we change plugins, default to current date and time and My Position, until we get something different
if (oldSource && !m_source)
@ -486,7 +487,6 @@ void SkyMapGUI::applySettings(const QStringList& settingsKeys, bool force)
MainCore::instance()->getSettings().getLongitude(),
MainCore::instance()->getSettings().getAltitude());
}
}
}

View File

@ -89,7 +89,7 @@ void AvailableChannelOrFeatureHandler::scanAvailableChannelsAndFeatures()
}
}
QObject* AvailableChannelOrFeatureHandler::registerPipes(const QString& longIdFrom, QObject* to, const QStringList& pipeNames)
QObject* AvailableChannelOrFeatureHandler::registerPipes(const QString& longIdFrom, const QStringList& pipeNames)
{
int index = m_availableChannelOrFeatureList.indexOfLongId(longIdFrom);
if (index >= 0)
@ -106,14 +106,16 @@ QObject* AvailableChannelOrFeatureHandler::registerPipes(const QString& longIdFr
}
}
void AvailableChannelOrFeatureHandler::deregisterPipes(QObject* from, QObject* to, const QStringList& pipeNames)
void AvailableChannelOrFeatureHandler::deregisterPipes(QObject* from, const QStringList& pipeNames)
{
// Don't dereference 'from' here, as it may have been deleted
if (from)
{
qDebug("AvailableChannelOrFeatureHandler::deregisterPipes: unregister (%p)", from);
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
messagePipes.unregisterProducerToConsumer(from, to, "target");
for (const auto& pipeName : pipeNames) {
messagePipes.unregisterProducerToConsumer(from, this, pipeName);
}
}
}

View File

@ -55,8 +55,8 @@ public:
return m_availableChannelOrFeatureList;
}
QObject* registerPipes(const QString& longIdFrom, QObject* to, const QStringList& pipeNames);
void deregisterPipes(QObject* from, QObject* to, const QStringList& pipeNames);
QObject* registerPipes(const QString& longIdFrom, const QStringList& pipeNames);
void deregisterPipes(QObject* from, const QStringList& pipeNames);
private: