mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
GLSpectrum: fixed settings and waterfall share serialization. Fixes #609
This commit is contained in:
parent
a88b2074c4
commit
97efda734f
@ -39,8 +39,10 @@ void GLSpectrumSettings::resetToDefaults()
|
||||
m_histogramStroke = 30;
|
||||
m_displayGridIntensity = 5;
|
||||
m_displayTraceIntensity = 50;
|
||||
m_displayCurrent = true;
|
||||
m_displayWaterfall = true;
|
||||
m_invertedWaterfall = false;
|
||||
m_invertedWaterfall = true;
|
||||
m_waterfallShare = 0.66;
|
||||
m_displayMaxHold = false;
|
||||
m_displayHistogram = false;
|
||||
m_displayGrid = false;
|
||||
@ -99,7 +101,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
|
||||
d.readReal(4, &m_refLevel, 0);
|
||||
d.readReal(5, &m_powerRange, 100);
|
||||
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(9, &m_displayHistogram, false);
|
||||
d.readS32(10, &m_decay, 1);
|
||||
@ -108,7 +110,7 @@ bool GLSpectrumSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(13, &m_displayGridIntensity, 5);
|
||||
d.readS32(14, &m_decayDivisor, 1);
|
||||
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.readReal(18, &m_waterfallShare, 0.66);
|
||||
d.readS32(19, &tmp, 0);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportSampleRate, Message)
|
||||
MESSAGE_CLASS_DEFINITION(GLSpectrum::MsgReportWaterfallShare, Message)
|
||||
|
||||
GLSpectrum::GLSpectrum(QWidget* parent) :
|
||||
QGLWidget(parent),
|
||||
@ -1909,6 +1910,10 @@ void GLSpectrum::mouseMoveEvent(QMouseEvent* event)
|
||||
m_waterfallShare = newShare;
|
||||
m_changesPending = true;
|
||||
|
||||
if (m_messageQueueToGUI) {
|
||||
m_messageQueueToGUI->push(new MsgReportWaterfallShare(m_waterfallShare));
|
||||
}
|
||||
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
@ -51,9 +51,7 @@ public:
|
||||
MsgReportSampleRate(quint32 sampleRate) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate)
|
||||
{
|
||||
m_sampleRate = sampleRate;
|
||||
}
|
||||
{}
|
||||
|
||||
quint32 getSampleRate() const { return m_sampleRate; }
|
||||
|
||||
@ -61,6 +59,21 @@ public:
|
||||
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);
|
||||
virtual ~GLSpectrum();
|
||||
|
||||
|
@ -87,7 +87,7 @@ bool GLSpectrumGUI::deserialize(const QByteArray& data)
|
||||
{
|
||||
if (m_settings.deserialize(data))
|
||||
{
|
||||
displaySettings();
|
||||
displaySettings(); // ends with blockApplySettings(false)
|
||||
applySettings();
|
||||
return true;
|
||||
}
|
||||
@ -173,6 +173,7 @@ void GLSpectrumGUI::applySettings()
|
||||
m_glSpectrum->setDisplayGrid(m_settings.m_displayGrid);
|
||||
m_glSpectrum->setDisplayGridIntensity(m_settings.m_displayGridIntensity);
|
||||
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)) {
|
||||
m_glSpectrum->setTimingRate(getAveragingValue(m_settings.m_averagingIndex, m_settings.m_averagingMode) == 0 ?
|
||||
@ -492,6 +493,11 @@ bool GLSpectrumGUI::handleMessage(const Message& message)
|
||||
setAveragingToolitp();
|
||||
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))
|
||||
{
|
||||
const SpectrumVis::MsgStartStop& msg = (SpectrumVis::MsgStartStop&) message;
|
||||
|
Loading…
Reference in New Issue
Block a user