1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-11-29 11:23:27 -05:00

GLSpectrum: fixed settings and waterfall share serialization. Fixes #609

This commit is contained in:
f4exb 2020-08-29 11:10:11 +02:00
parent 88ce1c934e
commit 1429e3ac4a
4 changed files with 30 additions and 6 deletions

View File

@ -109,7 +109,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
d.readReal(4, &m_refLevel, 0); d.readReal(4, &m_refLevel, 0);
d.readReal(5, &m_powerRange, 100); d.readReal(5, &m_powerRange, 100);
d.readBool(6, &m_displayWaterfall, true); d.readBool(6, &m_displayWaterfall, true);
d.readBool(7, &m_invertedWaterfall, false); d.readBool(7, &m_invertedWaterfall, true);
d.readBool(8, &m_displayMaxHold, false); d.readBool(8, &m_displayMaxHold, false);
d.readBool(9, &m_displayHistogram, false); d.readBool(9, &m_displayHistogram, false);
d.readS32(10, &m_decay, 1); d.readS32(10, &m_decay, 1);
@ -117,7 +117,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
d.readS32(13, &m_displayGridIntensity, 5); d.readS32(13, &m_displayGridIntensity, 5);
d.readS32(14, &m_decayDivisor, 1); d.readS32(14, &m_decayDivisor, 1);
d.readS32(15, &m_histogramStroke, 30); d.readS32(15, &m_histogramStroke, 30);
d.readBool(16, &m_displayCurrent, false); d.readBool(16, &m_displayCurrent, true);
d.readS32(17, &m_displayTraceIntensity, 50); d.readS32(17, &m_displayTraceIntensity, 50);
d.readReal(18, &m_waterfallShare, 0.66); d.readReal(18, &m_waterfallShare, 0.66);
d.readS32(19, &tmp, 0); d.readS32(19, &tmp, 0);

View File

@ -31,6 +31,7 @@
#include <QDebug> #include <QDebug>
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportSampleRate, Message) MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportSampleRate, Message)
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportWaterfallShare, Message)
GLSpectrum::GLSpectrum(QWidget* parent) : GLSpectrum::GLSpectrum(QWidget* parent) :
QGLWidget(parent), QGLWidget(parent),
@ -1909,6 +1910,10 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
m_waterfallShare = newShare; m_waterfallShare = newShare;
m_changesPending = true; m_changesPending = true;
if (m_messageQueueToGUI) {
m_messageQueueToGUI->push(new MsgReportWaterfallShare(m_waterfallShare));
}
update(); update();
return; return;
} }

View File

@ -51,9 +51,7 @@ public:
MsgReportSampleRate(quint32 sampleRate) : MsgReportSampleRate(quint32 sampleRate) :
Message(), Message(),
m_sampleRate(sampleRate) m_sampleRate(sampleRate)
{ {}
m_sampleRate = sampleRate;
}
quint32 getSampleRate() const { return m_sampleRate; } quint32 getSampleRate() const { return m_sampleRate; }
@ -61,6 +59,21 @@ public:
quint32 m_sampleRate; quint32 m_sampleRate;
}; };
class MsgReportWaterfallShare : public Message {
MESSAGE_CLASS_DECLARATION
public:
MsgReportWaterfallShare(Real waterfallShare) :
Message(),
m_waterfallShare(waterfallShare)
{}
Real getWaterfallShare() const { return m_waterfallShare; }
private:
Real m_waterfallShare;
};
GLSpectrum(QWidget* parent = nullptr); GLSpectrum(QWidget* parent = nullptr);
virtual ~GLSpectrum(); virtual ~GLSpectrum();

View File

@ -93,7 +93,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data)
{ {
if (m_settings.deserialize(data)) if (m_settings.deserialize(data))
{ {
displaySettings(); displaySettings(); // ends with blockApplySettings(false)
applySettings(); applySettings();
return true; return true;
} }
@ -189,6 +189,7 @@ void GLSpectrumGUI::applyGLSpectrumSettings()
m_glSpectrum->setDisplayGrid(m_settings.m_displayGrid); m_glSpectrum->setDisplayGrid(m_settings.m_displayGrid);
m_glSpectrum->setDisplayGridIntensity(m_settings.m_displayGridIntensity); m_glSpectrum->setDisplayGridIntensity(m_settings.m_displayGridIntensity);
m_glSpectrum->setDisplayTraceIntensity(m_settings.m_displayTraceIntensity); m_glSpectrum->setDisplayTraceIntensity(m_settings.m_displayTraceIntensity);
m_glSpectrum->setWaterfallShare(m_settings.m_waterfallShare);
if ((m_settings.m_averagingMode == GLSpectrumSettings::AvgModeFixed) || (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMax)) { if ((m_settings.m_averagingMode == GLSpectrumSettings::AvgModeFixed) || (m_settings.m_averagingMode == GLSpectrumSettings::AvgModeMax)) {
m_glSpectrum->setTimingRate(getAveragingValue(m_settings.m_averagingIndex, m_settings.m_averagingMode) == 0 ? m_glSpectrum->setTimingRate(getAveragingValue(m_settings.m_averagingIndex, m_settings.m_averagingMode) == 0 ?
@ -527,6 +528,11 @@ bool GLSpectrumGUI::handleMessage(const Message& message)
ui->wsSpectrum->blockSignals(false); ui->wsSpectrum->blockSignals(false);
return true; return true;
} }
else if (GLSpectrum::MsgReportWaterfallShare::match(message))
{
const GLSpectrum::MsgReportWaterfallShare& report = (const GLSpectrum::MsgReportWaterfallShare&) message;
m_settings.m_waterfallShare = report.getWaterfallShare();
}
else if (SpectrumVis::MsgStartStop::match(message)) else if (SpectrumVis::MsgStartStop::match(message))
{ {
const SpectrumVis::MsgStartStop& msg = (SpectrumVis::MsgStartStop&) message; const SpectrumVis::MsgStartStop& msg = (SpectrumVis::MsgStartStop&) message;