1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

GLScopeGUI: fixed UI blocking and added missing trace offset serialization/deserialization. Fixes #969

This commit is contained in:
f4exb 2021-08-09 02:21:12 +02:00
parent a1120bca46
commit 963ce326f6
5 changed files with 28 additions and 16 deletions

View File

@ -93,6 +93,7 @@ QByteArray GLScopeSettings::serialize() const
s.writeS32(20 + 16*i, (int) traceDataIt->m_projectionType);
s.writeFloat(21 + 16*i, traceDataIt->m_amp);
s.writeFloat(22 + 16*i, traceDataIt->m_ofs);
s.writeS32(24 + 16*i, traceDataIt->m_traceDelayCoarse);
s.writeS32(25 + 16*i, traceDataIt->m_traceDelayFine);
s.writeFloat(26 + 16*i, traceDataIt->m_traceColorR);
@ -167,6 +168,7 @@ bool GLScopeSettings::deserialize(const QByteArray& data)
d.readS32(20 + 16*iTrace, &intValue, 0);
m_tracesData.back().m_projectionType = (Projector::ProjectionType) intValue;
d.readFloat(21 + 16*iTrace, &m_tracesData.back().m_amp, 1.0f);
d.readFloat(22 + 16*iTrace, &m_tracesData.back().m_ofs, 0.0f);
d.readS32(24 + 16*iTrace, &intValue, 0);
m_tracesData.back().m_traceDelayCoarse = intValue;
d.readS32(25 + 16*iTrace, &intValue, 0);

View File

@ -43,7 +43,6 @@ MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
ScopeVis::ScopeVis() :
m_glScope(nullptr),
m_spectrumVis(nullptr),
m_messageQueueToGUI(nullptr),
m_preTriggerDelay(0),
m_livePreTriggerDelay(0),
m_currentTriggerIndex(0),
@ -228,6 +227,7 @@ void ScopeVis::configure(
void ScopeVis::addTrace(const GLScopeSettings::TraceData& traceData)
{
qDebug() << "ScopeVis::addTrace:"
<< " trace: " << m_traces.size()
<< " m_streamIndex: " << traceData.m_streamIndex
<< " m_amp: " << traceData.m_amp
<< " m_ofs: " << traceData.m_ofs

View File

@ -341,7 +341,6 @@ public:
void setGLScope(GLScopeInterface* glScope);
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
void setLiveRate(int sampleRate);
@ -996,9 +995,9 @@ private:
{
if (m_traces[0].size() < GLScopeSettings::m_maxNbTraces)
{
qDebug("ScopeVis::addTrace");
m_traces[0].push_back(0);
m_traces[1].push_back(0);
qDebug("ScopeVis::Traces::addTrace");
m_traces[0].push_back(nullptr);
m_traces[1].push_back(nullptr);
m_tracesData.push_back(traceData);
m_projectionTypes.push_back(traceData.m_projectionType);
m_tracesControl.push_back(new TraceControl());
@ -1025,7 +1024,7 @@ private:
{
if (traceIndex < m_tracesControl.size())
{
qDebug("ScopeVis::removeTrace");
qDebug("ScopeVis::Traces::removeTrace");
m_traces[0].erase(m_traces[0].begin() + traceIndex);
m_traces[1].erase(m_traces[1].begin() + traceIndex);
m_projectionTypes.erase(m_projectionTypes.begin() + traceIndex);
@ -1219,7 +1218,6 @@ private:
SpectrumVis *m_spectrumVis;
GLScopeSettings m_settings;
MessageQueue m_inputMessageQueue;
MessageQueue *m_messageQueueToGUI;
uint32_t m_preTriggerDelay; //!< Pre-trigger delay in number of samples
uint32_t m_livePreTriggerDelay; //!< Pre-trigger delay in number of samples in live mode
std::vector<TriggerCondition*> m_triggerConditions; //!< Chain of triggers

View File

@ -204,10 +204,6 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
{
GLScopeSettings::TraceData& traceData = m_settings.m_tracesData[iTrace];
//setTraceUI(traceData);
qDebug("GLScopeGUI::deserialize: trace: %u ui streams: %d current stream: %u",
iTrace, ui->traceStream->count(), traceData.m_streamIndex);
if (iTrace < tracesData.size()) // change existing traces
{
ScopeVis::MsgScopeVisChangeTrace *msg = ScopeVis::MsgScopeVisChangeTrace::create(traceData, iTrace);
@ -1474,8 +1470,6 @@ void GLScopeGUI::applySettings(const GLScopeSettings& settings, bool force)
void GLScopeGUI::displaySettings()
{
TraceUIBlocker traceUIBlocker(ui);
TrigUIBlocker trigUIBlocker(ui);
MainUIBlocker mainUIBlocker(ui);
ui->traceText->setText(m_ctlTraceIndex == 0 ? "X" : QString("Y%1").arg(m_ctlTraceIndex));
@ -1517,6 +1511,7 @@ GLScopeGUI::TrigUIBlocker::TrigUIBlocker(Ui::GLScopeGUI *ui) :
m_oldStateTrigLevelFine = ui->trigLevelFine->blockSignals(true);
m_oldStateTrigDelayCoarse = ui->trigDelayCoarse->blockSignals(true);
m_oldStateTrigDelayFine = ui->trigDelayFine->blockSignals(true);
m_oldStateTrigColor = ui->trigColor->blockSignals(true);
}
GLScopeGUI::TrigUIBlocker::~TrigUIBlocker()
@ -1535,21 +1530,27 @@ void GLScopeGUI::TrigUIBlocker::unBlock()
m_ui->trigLevelFine->blockSignals(m_oldStateTrigLevelFine);
m_ui->trigDelayCoarse->blockSignals(m_oldStateTrigDelayCoarse);
m_ui->trigDelayFine->blockSignals(m_oldStateTrigDelayFine);
m_ui->trigColor->blockSignals(m_oldStateTrigColor);
}
GLScopeGUI::TraceUIBlocker::TraceUIBlocker(Ui::GLScopeGUI* ui) :
m_ui(ui)
{
m_oldStateTrace = m_ui->trace->blockSignals(true);
m_oldStateTraceAdd = m_ui->traceAdd->blockSignals(true);
m_oldStateTraceDel = m_ui->traceDel->blockSignals(true);
m_oldStateTraceStream = m_ui->traceStream->blockSignals(true);
m_oldStateTraceMode = m_ui->traceMode->blockSignals(true);
m_oldStateAmp = m_ui->amp->blockSignals(true);
m_oldStateAmpCoarse = m_ui->ampCoarse->blockSignals(true);
m_oldStateAmpExp = m_ui->ampExp->blockSignals(true);
m_oldStateOfsCoarse = m_ui->ofsCoarse->blockSignals(true);
m_oldStateOfsFine = m_ui->ofsFine->blockSignals(true);
m_oldStateOfsExp = m_ui->ofsExp->blockSignals(true);
m_oldStateTraceDelayCoarse = m_ui->traceDelayCoarse->blockSignals(true);
m_oldStateTraceDelayFine = m_ui->traceDelayFine->blockSignals(true);
m_oldStateTraceColor = m_ui->traceColor->blockSignals(true);
m_oldStateTraceView = m_ui->traceView->blockSignals(true);
m_oldStateTrace = m_ui->trace->blockSignals(true);
m_oldStateTraceAdd = m_ui->traceAdd->blockSignals(true);
m_oldStateTraceDel = m_ui->traceDel->blockSignals(true);
}
GLScopeGUI::TraceUIBlocker::~TraceUIBlocker()
@ -1559,16 +1560,21 @@ GLScopeGUI::TraceUIBlocker::~TraceUIBlocker()
void GLScopeGUI::TraceUIBlocker::unBlock()
{
m_ui->traceStream->blockSignals(m_oldStateTraceStream);
m_ui->trace->blockSignals(m_oldStateTrace);
m_ui->traceAdd->blockSignals(m_oldStateTraceAdd);
m_ui->traceDel->blockSignals(m_oldStateTraceDel);
m_ui->traceMode->blockSignals(m_oldStateTraceMode);
m_ui->amp->blockSignals(m_oldStateAmp);
m_ui->ampCoarse->blockSignals(m_oldStateAmpCoarse);
m_ui->ampExp->blockSignals(m_oldStateAmpExp);
m_ui->ofsCoarse->blockSignals(m_oldStateOfsCoarse);
m_ui->ofsFine->blockSignals(m_oldStateOfsFine);
m_ui->ofsExp->blockSignals(m_oldStateOfsExp);
m_ui->traceDelayCoarse->blockSignals(m_oldStateTraceDelayCoarse);
m_ui->traceDelayFine->blockSignals(m_oldStateTraceDelayFine);
m_ui->traceColor->blockSignals(m_oldStateTraceColor);
m_ui->traceView->blockSignals(m_oldStateTraceView);
}
GLScopeGUI::MainUIBlocker::MainUIBlocker(Ui::GLScopeGUI* ui) :

View File

@ -95,6 +95,7 @@ private:
bool m_oldStateTrigLevelFine;
bool m_oldStateTrigDelayCoarse;
bool m_oldStateTrigDelayFine;
bool m_oldStateTrigColor;
};
class TraceUIBlocker
@ -107,16 +108,21 @@ private:
private:
Ui::GLScopeGUI *m_ui;
bool m_oldStateTraceStream;
bool m_oldStateTrace;
bool m_oldStateTraceAdd;
bool m_oldStateTraceDel;
bool m_oldStateTraceMode;
bool m_oldStateAmp;
bool m_oldStateAmpCoarse;
bool m_oldStateAmpExp;
bool m_oldStateOfsCoarse;
bool m_oldStateOfsFine;
bool m_oldStateOfsExp;
bool m_oldStateTraceDelayCoarse;
bool m_oldStateTraceDelayFine;
bool m_oldStateTraceColor;
bool m_oldStateTraceView;
};
class MainUIBlocker