1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

Multiple sources for the same preset. Working more or less

This commit is contained in:
f4exb
2015-10-02 04:04:38 +02:00
parent 51914b4767
commit 83d6d9d190
8 changed files with 200 additions and 46 deletions
+22 -21
View File
@@ -83,7 +83,7 @@ void PluginManager::registerSampleSource(const QString& sourceName, PluginInterf
m_sampleSourceRegistrations.append(SampleSourceRegistration(sourceName, plugin));
}
void PluginManager::loadSettings(Preset* preset)
void PluginManager::loadSettings(const Preset* preset)
{
fprintf(stderr, "PluginManager::loadSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
@@ -142,6 +142,13 @@ void PluginManager::loadSettings(Preset* preset)
renameChannelInstances();
loadSourceSettings(preset);
}
void PluginManager::loadSourceSettings(const Preset* preset)
{
fprintf(stderr, "PluginManager::loadSourceSettings: Loading preset [%s | %s]\n", qPrintable(preset->getGroup()), qPrintable(preset->getDescription()));
if(m_sampleSourcePluginGUI != 0)
{
const QByteArray* sourceConfig = preset->findBestSourceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence);
@@ -151,15 +158,6 @@ void PluginManager::loadSettings(Preset* preset)
qDebug() << "PluginManager::loadSettings: deserializing source " << qPrintable(m_sampleSourceId);
m_sampleSourcePluginGUI->deserialize(*sourceConfig);
}
/*
qDebug("PluginManager::loadSettings: source compare [%s] vs [%s]", qPrintable(m_sampleSourceId), qPrintable(preset->getSourceId()));
// TODO: have one set of source presets per identified source (preset -> find source with name)
if(m_sampleSourceId == preset->getSourceId())
{
qDebug() << "PluginManager::loadSettings: deserializing source " << qPrintable(m_sampleSourceId);
m_sampleSourcePluginGUI->deserialize(preset->getSourceConfig());
}*/
qint64 centerFrequency = preset->getCenterFrequency();
m_sampleSourcePluginGUI->setCenterFrequency(centerFrequency);
@@ -181,17 +179,8 @@ bool PluginManager::ChannelInstanceRegistration::operator<(const ChannelInstance
void PluginManager::saveSettings(Preset* preset)
{
if(m_sampleSourcePluginGUI != NULL)
{
preset->addOrUpdateSourceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_sampleSourcePluginGUI->serialize());
//preset->setSourceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_sampleSourcePluginGUI->serialize());
preset->setCenterFrequency(m_sampleSourcePluginGUI->getCenterFrequency());
}
/*
else
{
preset->setSourceConfig(QString::null, QString::null, 0, QByteArray());
}*/
qDebug("PluginManager::saveSettings");
saveSourceSettings(preset);
qSort(m_channelInstanceRegistrations.begin(), m_channelInstanceRegistrations.end()); // sort by increasing delta frequency and type
@@ -201,6 +190,18 @@ void PluginManager::saveSettings(Preset* preset)
}
}
void PluginManager::saveSourceSettings(Preset* preset)
{
qDebug("PluginManager::saveSourceSettings");
if(m_sampleSourcePluginGUI != NULL)
{
preset->addOrUpdateSourceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_sampleSourcePluginGUI->serialize());
//preset->setSourceConfig(m_sampleSourceId, m_sampleSourceSerial, m_sampleSourceSequence, m_sampleSourcePluginGUI->serialize());
preset->setCenterFrequency(m_sampleSourcePluginGUI->getCenterFrequency());
}
}
void PluginManager::freeAll()
{
m_dspEngine->stopAcquistion();