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

pull/6/head
f4exb 2015-07-19 02:07:40 +02:00
rodzic ad8be9875e
commit 6d27dc5e0b
25 zmienionych plików z 70 dodań i 12 usunięć

Wyświetl plik

@ -114,13 +114,15 @@ Done since the fork
- Enhanced scope display and controls: scale display, better X (time) and Y scales control, grid fit to scale, effectively implementing triggers, trigger on magnitude and phase, properly handling time shift, ...
- Enhanced spectrum display: Histogram: define NO_AVX, wider decay range, make stroke and late holdoff adjustable. Added option to show live spectrum (had only max hold before).
- Enhanced channel analyzer: enhanced scope and spectrum displays as mentioned above, make the spectrum display synchronous to scope (hence triggerable a la E4406A).
- Sort channel plugins by delta frequency and type before saving to preset
=====
To Do
=====
- Enhance presets management (Edit, Move, Import/Export from/to human readable format like JSON)
- Implement trigger delay on scope
- Variable scope memory depth
- Enhance presets management (Edit, Move, Import/Export from/to human readable format like JSON)
- Level calibration
- Enhance WFM (stereo, RDS?)
- Even more demods ...

Wyświetl plik

@ -45,7 +45,7 @@ public:
void registerSampleSource(const QString& sourceName, PluginInterface* plugin);
void loadSettings(const Preset* preset);
void saveSettings(Preset* preset) const;
void saveSettings(Preset* preset);
void freeAll();
@ -78,6 +78,7 @@ private:
m_channelName(channelName),
m_gui(pluginGUI)
{ }
bool operator<(const ChannelInstanceRegistration& other) const;
};
typedef QList<ChannelInstanceRegistration> ChannelInstanceRegistrations;

Wyświetl plik

@ -18,7 +18,7 @@ public:
virtual QByteArray serializeGeneral() const;
virtual bool deserializeGeneral(const QByteArray& data);
virtual quint64 getCenterFrequency() const;
virtual qint64 getCenterFrequency() const;
virtual QByteArray serialize() const = 0;
virtual bool deserialize(const QByteArray& data) = 0;

Wyświetl plik

@ -39,6 +39,10 @@ QString AMDemodGUI::getName() const
return objectName();
}
qint64 AMDemodGUI::getCenterFrequency() const {
return m_channelMarker->getCenterFrequency();
}
void AMDemodGUI::resetToDefaults()
{
ui->rfBW->setValue(4);

Wyświetl plik

@ -26,6 +26,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -37,6 +37,11 @@ QString ChannelAnalyzerGUI::getName() const
return objectName();
}
qint64 ChannelAnalyzerGUI::getCenterFrequency() const
{
return m_channelMarker->getCenterFrequency();
}
void ChannelAnalyzerGUI::resetToDefaults()
{
ui->BW->setValue(30);

Wyświetl plik

@ -28,6 +28,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -34,6 +34,10 @@ QString LoRaDemodGUI::getName() const
return objectName();
}
qint64 LoRaDemodGUI::getCenterFrequency() const {
return m_channelMarker->getCenterFrequency();
}
void LoRaDemodGUI::resetToDefaults()
{
ui->BW->setValue(0);

Wyświetl plik

@ -26,6 +26,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -38,6 +38,11 @@ QString NFMDemodGUI::getName() const
return objectName();
}
qint64 NFMDemodGUI::getCenterFrequency() const
{
return m_channelMarker->getCenterFrequency();
}
void NFMDemodGUI::resetToDefaults()
{
ui->rfBW->setValue(4);

Wyświetl plik

@ -27,6 +27,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -36,6 +36,11 @@ QString SSBDemodGUI::getName() const
return objectName();
}
qint64 SSBDemodGUI::getCenterFrequency() const
{
return m_channelMarker->getCenterFrequency();
}
void SSBDemodGUI::resetToDefaults()
{
ui->BW->setValue(30);

Wyświetl plik

@ -26,6 +26,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -24,6 +24,11 @@ void TCPSrcGUI::setName(const QString& name)
setObjectName(name);
}
qint64 TCPSrcGUI::getCenterFrequency() const
{
return m_channelMarker->getCenterFrequency();
}
QString TCPSrcGUI::getName() const
{
return objectName();

Wyświetl plik

@ -26,6 +26,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -48,6 +48,11 @@ QString WFMDemodGUI::getName() const
return objectName();
}
qint64 WFMDemodGUI::getCenterFrequency() const
{
return m_channelMarker->getCenterFrequency();
}
void WFMDemodGUI::resetToDefaults()
{
ui->rfBW->setValue(4);

Wyświetl plik

@ -26,6 +26,7 @@ public:
void setName(const QString& name);
QString getName() const;
qint64 getCenterFrequency() const;
void resetToDefaults();
QByteArray serialize() const;

Wyświetl plik

@ -82,7 +82,7 @@ bool BladerfGui::deserializeGeneral(const QByteArray&data)
}
}
quint64 BladerfGui::getCenterFrequency() const
qint64 BladerfGui::getCenterFrequency() const
{
return m_generalSettings.m_centerFrequency;
}

Wyświetl plik

@ -43,7 +43,7 @@ public:
void resetToDefaults();
QByteArray serializeGeneral() const;
bool deserializeGeneral(const QByteArray&data);
quint64 getCenterFrequency() const;
qint64 getCenterFrequency() const;
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
bool handleMessage(Message* message);

Wyświetl plik

@ -63,7 +63,7 @@ bool FCDGui::deserializeGeneral(const QByteArray&data)
}
}
quint64 FCDGui::getCenterFrequency() const
qint64 FCDGui::getCenterFrequency() const
{
return m_generalSettings.m_centerFrequency;
}

Wyświetl plik

@ -25,7 +25,7 @@ public:
void resetToDefaults();
QByteArray serializeGeneral() const;
bool deserializeGeneral(const QByteArray&data);
quint64 getCenterFrequency() const;
qint64 getCenterFrequency() const;
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
bool handleMessage(Message* message);

Wyświetl plik

@ -64,7 +64,7 @@ bool RTLSDRGui::deserializeGeneral(const QByteArray&data)
}
}
quint64 RTLSDRGui::getCenterFrequency() const
qint64 RTLSDRGui::getCenterFrequency() const
{
return m_generalSettings.m_centerFrequency;
}

Wyświetl plik

@ -26,7 +26,7 @@ public:
void resetToDefaults();
QByteArray serializeGeneral() const;
bool deserializeGeneral(const QByteArray&data);
quint64 getCenterFrequency() const;
qint64 getCenterFrequency() const;
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
bool handleMessage(Message* message);

Wyświetl plik

@ -10,7 +10,7 @@ bool PluginGUI::deserializeGeneral(const QByteArray& data)
return false;
}
quint64 PluginGUI::getCenterFrequency() const
qint64 PluginGUI::getCenterFrequency() const
{
return 0;
}

Wyświetl plik

@ -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()