mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
API: fixes in features processing
This commit is contained in:
parent
31330cc14f
commit
fa1e3c7583
@ -3062,7 +3062,7 @@ int WebAPIAdapter::featuresetFeatureDelete(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
error.init();
|
error.init();
|
||||||
*error.getMessage() = QString("There is no device set with index %1").arg(featureSetIndex);
|
*error.getMessage() = QString("There is no feature set with index %1").arg(featureSetIndex);
|
||||||
return 404;
|
return 404;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,11 +70,14 @@ void FeatureUISet::freeFeatures()
|
|||||||
{
|
{
|
||||||
for(int i = 0; i < m_featureInstanceRegistrations.count(); i++)
|
for(int i = 0; i < m_featureInstanceRegistrations.count(); i++)
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::freeFeatures: destroying feature [%s]", qPrintable(m_featureInstanceRegistrations[i].m_feature->getURI()));
|
qDebug("FeatureUISet::freeFeatures: destroying feature [%s]",
|
||||||
m_featureInstanceRegistrations[i].m_feature->destroy();
|
qPrintable(m_featureInstanceRegistrations.at(i).m_feature->getURI())
|
||||||
m_featureInstanceRegistrations[i].m_gui->destroy();
|
);
|
||||||
|
m_featureInstanceRegistrations.at(i).m_feature->destroy();
|
||||||
|
m_featureInstanceRegistrations.at(i).m_gui->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_featureInstanceRegistrations.clear();
|
||||||
m_featureSet->clearFeatures();
|
m_featureSet->clearFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +86,12 @@ void FeatureUISet::deleteFeature(int featureIndex)
|
|||||||
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count()))
|
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count()))
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::deleteFeature: delete feature [%s] at %d",
|
qDebug("FeatureUISet::deleteFeature: delete feature [%s] at %d",
|
||||||
qPrintable(m_featureInstanceRegistrations[featureIndex].m_feature->getURI()),
|
qPrintable(m_featureInstanceRegistrations.at(featureIndex).m_feature->getURI()),
|
||||||
featureIndex);
|
featureIndex
|
||||||
m_featureInstanceRegistrations[featureIndex].m_feature->destroy();
|
);
|
||||||
m_featureInstanceRegistrations[featureIndex].m_gui->destroy();
|
m_featureInstanceRegistrations.at(featureIndex).m_feature->destroy();
|
||||||
|
m_featureInstanceRegistrations.at(featureIndex).m_gui->destroy();
|
||||||
|
m_featureInstanceRegistrations.removeAt(featureIndex);
|
||||||
m_featureSet->removeFeatureInstanceAt(featureIndex);
|
m_featureSet->removeFeatureInstanceAt(featureIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +99,7 @@ void FeatureUISet::deleteFeature(int featureIndex)
|
|||||||
const Feature *FeatureUISet::getFeatureAt(int featureIndex) const
|
const Feature *FeatureUISet::getFeatureAt(int featureIndex) const
|
||||||
{
|
{
|
||||||
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count())) {
|
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count())) {
|
||||||
return m_featureInstanceRegistrations[featureIndex].m_feature;
|
return m_featureInstanceRegistrations.at(featureIndex).m_feature;
|
||||||
} else{
|
} else{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -103,7 +108,7 @@ const Feature *FeatureUISet::getFeatureAt(int featureIndex) const
|
|||||||
Feature *FeatureUISet::getFeatureAt(int featureIndex)
|
Feature *FeatureUISet::getFeatureAt(int featureIndex)
|
||||||
{
|
{
|
||||||
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count())) {
|
if ((featureIndex >= 0) && (featureIndex < m_featureInstanceRegistrations.count())) {
|
||||||
return m_featureInstanceRegistrations[featureIndex].m_feature;
|
return m_featureInstanceRegistrations.at(featureIndex).m_feature;
|
||||||
} else{
|
} else{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -111,7 +116,10 @@ Feature *FeatureUISet::getFeatureAt(int featureIndex)
|
|||||||
|
|
||||||
void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, PluginAPI *pluginAPI, WebAPIAdapterInterface *apiAdapter)
|
void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, PluginAPI *pluginAPI, WebAPIAdapterInterface *apiAdapter)
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::loadFeatureSetSettings: Loading preset [%s | %s]", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
|
qDebug("FeatureUISet::loadFeatureSetSettings: Loading preset [%s | %s]",
|
||||||
|
qPrintable(preset->getGroup()),
|
||||||
|
qPrintable(preset->getDescription())
|
||||||
|
);
|
||||||
|
|
||||||
// Available feature plugins
|
// Available feature plugins
|
||||||
PluginAPI::FeatureRegistrations *featureRegistrations = pluginAPI->getFeatureRegistrations();
|
PluginAPI::FeatureRegistrations *featureRegistrations = pluginAPI->getFeatureRegistrations();
|
||||||
@ -123,7 +131,9 @@ void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, Plugin
|
|||||||
|
|
||||||
for (int i = 0; i < openFeatures.count(); i++)
|
for (int i = 0; i < openFeatures.count(); i++)
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::loadFeatureSetSettings: destroying old feature [%s]", qPrintable(openFeatures[i].m_feature->getURI()));
|
qDebug("FeatureUISet::loadFeatureSetSettings: destroying old feature [%s]",
|
||||||
|
qPrintable(openFeatures.at(i).m_feature->getURI())
|
||||||
|
);
|
||||||
openFeatures[i].m_feature->destroy();
|
openFeatures[i].m_feature->destroy();
|
||||||
openFeatures[i].m_gui->destroy();
|
openFeatures[i].m_gui->destroy();
|
||||||
}
|
}
|
||||||
@ -142,8 +152,9 @@ void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, Plugin
|
|||||||
if (FeatureUtils::compareFeatureURIs((*featureRegistrations)[i].m_featureIdURI, featureConfig.m_featureIdURI))
|
if (FeatureUtils::compareFeatureURIs((*featureRegistrations)[i].m_featureIdURI, featureConfig.m_featureIdURI))
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::loadFeatureSetSettings: creating new feature [%s] from config [%s]",
|
qDebug("FeatureUISet::loadFeatureSetSettings: creating new feature [%s] from config [%s]",
|
||||||
qPrintable((*featureRegistrations)[i].m_featureIdURI),
|
qPrintable((*featureRegistrations)[i].m_featureIdURI),
|
||||||
qPrintable(featureConfig.m_featureIdURI));
|
qPrintable(featureConfig.m_featureIdURI)
|
||||||
|
);
|
||||||
Feature *feature =
|
Feature *feature =
|
||||||
(*featureRegistrations)[i].m_plugin->createFeature(apiAdapter);
|
(*featureRegistrations)[i].m_plugin->createFeature(apiAdapter);
|
||||||
featureGUI =
|
featureGUI =
|
||||||
@ -155,7 +166,9 @@ void FeatureUISet::loadFeatureSetSettings(const FeatureSetPreset *preset, Plugin
|
|||||||
|
|
||||||
if (featureGUI)
|
if (featureGUI)
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::loadFeatureSetSettings: deserializing feature [%s]", qPrintable(featureConfig.m_featureIdURI));
|
qDebug("FeatureUISet::loadFeatureSetSettings: deserializing feature [%s]",
|
||||||
|
qPrintable(featureConfig.m_featureIdURI)
|
||||||
|
);
|
||||||
featureGUI->deserialize(featureConfig.m_config);
|
featureGUI->deserialize(featureConfig.m_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,8 +178,13 @@ void FeatureUISet::saveFeatureSetSettings(FeatureSetPreset *preset)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < m_featureInstanceRegistrations.count(); i++)
|
for (int i = 0; i < m_featureInstanceRegistrations.count(); i++)
|
||||||
{
|
{
|
||||||
qDebug("FeatureUISet::saveFeatureSetSettings: saving feature [%s]", qPrintable(m_featureInstanceRegistrations[i].m_feature->getURI()));
|
qDebug("FeatureUISet::saveFeatureSetSettings: saving feature [%s]",
|
||||||
preset->addFeature(m_featureInstanceRegistrations[i].m_feature->getURI(), m_featureInstanceRegistrations[i].m_gui->serialize());
|
qPrintable(m_featureInstanceRegistrations.at(i).m_feature->getURI())
|
||||||
|
);
|
||||||
|
preset->addFeature(
|
||||||
|
m_featureInstanceRegistrations.at(i).m_feature->getURI(),
|
||||||
|
m_featureInstanceRegistrations.at(i).m_gui->serialize()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,6 @@ void MainWindow::deleteChannel(int deviceSetIndex, int channelIndex)
|
|||||||
{
|
{
|
||||||
DeviceUISet *deviceSet = m_deviceUIs[deviceSetIndex];
|
DeviceUISet *deviceSet = m_deviceUIs[deviceSetIndex];
|
||||||
deviceSet->deleteChannel(channelIndex);
|
deviceSet->deleteChannel(channelIndex);
|
||||||
m_mainCore->removeLastFeatureSet();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2267,8 +2266,8 @@ void MainWindow::deleteFeature(int featureSetIndex, int featureIndex)
|
|||||||
{
|
{
|
||||||
if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_featureUIs.size()))
|
if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_featureUIs.size()))
|
||||||
{
|
{
|
||||||
FeatureUISet *featureSet = m_featureUIs[featureSetIndex];
|
FeatureUISet *featureUISet = m_featureUIs[featureSetIndex];
|
||||||
featureSet->deleteFeature(featureIndex);
|
featureUISet->deleteFeature(featureIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user