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

Sort channel plugins by delta frequency and type before saving to preset

This commit is contained in:
f4exb
2015-07-19 02:07:40 +02:00
parent ad8be9875e
commit 6d27dc5e0b
25 changed files with 70 additions and 12 deletions
+17 -2
View File
@@ -133,7 +133,20 @@ void PluginManager::loadSettings(const Preset* preset)
}
}
void PluginManager::saveSettings(Preset* preset) const
// sort by increasing delta frequency and type (i.e. name)
bool PluginManager::ChannelInstanceRegistration::operator<(const ChannelInstanceRegistration& other) const {
if (m_gui && other.m_gui) {
if (m_gui->getCenterFrequency() == other.m_gui->getCenterFrequency()) {
return m_gui->getName() < other.m_gui->getName();
} else {
return m_gui->getCenterFrequency() < other.m_gui->getCenterFrequency();
}
} else {
return false;
}
}
void PluginManager::saveSettings(Preset* preset)
{
if(m_sampleSourceInstance != NULL) {
preset->setSourceConfig(m_sampleSource, m_sampleSourceInstance->serializeGeneral(), m_sampleSourceInstance->serialize());
@@ -141,8 +154,10 @@ void PluginManager::saveSettings(Preset* preset) const
} else {
preset->setSourceConfig(QString::null, QByteArray(), QByteArray());
}
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++)
qSort(m_channelInstanceRegistrations.begin(), m_channelInstanceRegistrations.end()); // sort by increasing delta frequency and type
for(int i = 0; i < m_channelInstanceRegistrations.count(); i++) {
preset->addChannel(m_channelInstanceRegistrations[i].m_channelName, m_channelInstanceRegistrations[i].m_gui->serialize());
}
}
void PluginManager::freeAll()