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

GLScope redesign: using GLScopeSettings (2)

This commit is contained in:
f4exb 2021-06-09 22:32:45 +02:00
parent d08844a34c
commit e699099946
3 changed files with 170 additions and 169 deletions

View File

@ -27,16 +27,16 @@
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVis, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgConfigureScopeVisNG, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGAddTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGChangeTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGRemoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisAddTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisChangeTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisRemoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisMoveTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisFocusOnTrigger, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisAddTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisChangeTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisRemoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGFocusOnTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisMoveTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisFocusOnTrace, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGOneShot, Message)
MESSAGE_CLASS_DEFINITION(ScopeVis::MsgScopeVisNGMemoryTrace, Message)
@ -247,44 +247,91 @@ void ScopeVis::moveTrace(uint32_t traceIndex, bool upElseDown)
qDebug() << "ScopeVis::moveTrace:"
<< " trace: " << traceIndex
<< " up: " << upElseDown;
Message* cmd = MsgScopeVisNGMoveTrace::create(traceIndex, upElseDown);
getInputMessageQueue()->push(cmd);
m_traces.moveTrace(traceIndex, upElseDown);
computeDisplayTriggerLevels();
updateGLScopeDisplay();
}
void ScopeVis::focusOnTrace(uint32_t traceIndex)
{
Message* cmd = MsgScopeVisNGFocusOnTrace::create(traceIndex);
getInputMessageQueue()->push(cmd);
if (traceIndex < m_traces.m_tracesData.size())
{
m_focusedTraceIndex = traceIndex;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTraceIndex(m_focusedTraceIndex);
}
updateGLScopeDisplay();
}
}
void ScopeVis::addTrigger(const GLScopeSettings::TriggerData& triggerData)
{
Message* cmd = MsgScopeVisNGAddTrigger::create(triggerData);
getInputMessageQueue()->push(cmd);
m_triggerConditions.push_back(new TriggerCondition(triggerData));
m_triggerConditions.back()->initProjector();
}
void ScopeVis::changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
Message* cmd = MsgScopeVisNGChangeTrigger::create(triggerData, triggerIndex);
getInputMessageQueue()->push(cmd);
if (triggerIndex < m_triggerConditions.size())
{
m_triggerConditions[triggerIndex]->setData(triggerData);
if (triggerIndex == m_focusedTriggerIndex)
{
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
}
}
}
void ScopeVis::removeTrigger(uint32_t triggerIndex)
{
Message* cmd = MsgScopeVisNGRemoveTrigger::create(triggerIndex);
getInputMessageQueue()->push(cmd);
if (triggerIndex < m_triggerConditions.size())
{
TriggerCondition *triggerCondition = m_triggerConditions[triggerIndex];
m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
delete triggerCondition;
}
}
void ScopeVis::moveTrigger(uint32_t triggerIndex, bool upElseDown)
{
Message* cmd = MsgScopeVisNGMoveTrigger::create(triggerIndex, upElseDown);
getInputMessageQueue()->push(cmd);
int nextTriggerIndex = (triggerIndex + (upElseDown ? 1 : -1)) % m_triggerConditions.size();
TriggerCondition *nextTrigger = m_triggerConditions[nextTriggerIndex];
m_triggerConditions[nextTriggerIndex] = m_triggerConditions[triggerIndex];
m_triggerConditions[triggerIndex] = nextTrigger;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
}
void ScopeVis::focusOnTrigger(uint32_t triggerIndex)
{
Message* cmd = MsgScopeVisNGFocusOnTrigger::create(triggerIndex);
getInputMessageQueue()->push(cmd);
if (triggerIndex < m_triggerConditions.size())
{
m_focusedTriggerIndex = triggerIndex;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
}
}
void ScopeVis::setOneShot(bool oneShot)
@ -875,101 +922,52 @@ bool ScopeVis::handleMessage(const Message& message)
return true;
}
else if (MsgScopeVisNGAddTrigger::match(message))
else if (MsgScopeVisAddTrigger::match(message))
{
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGAddTrigger";
qDebug() << "ScopeVis::handleMessage: MsgScopeVisAddTrigger";
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGAddTrigger& conf = (MsgScopeVisNGAddTrigger&) message;
m_triggerConditions.push_back(new TriggerCondition(conf.getTriggerData()));
m_triggerConditions.back()->initProjector();
MsgScopeVisAddTrigger& conf = (MsgScopeVisAddTrigger&) message;
addTrigger(conf.getTriggerData());
return true;
}
else if (MsgScopeVisNGChangeTrigger::match(message))
else if (MsgScopeVisChangeTrigger::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGChangeTrigger& conf = (MsgScopeVisNGChangeTrigger&) message;
MsgScopeVisChangeTrigger& conf = (MsgScopeVisChangeTrigger&) message;
uint32_t triggerIndex = conf.getTriggerIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGChangeTrigger: " << triggerIndex;
if (triggerIndex < m_triggerConditions.size())
{
m_triggerConditions[triggerIndex]->setData(conf.getTriggerData());
if (triggerIndex == m_focusedTriggerIndex)
{
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
}
}
qDebug() << "ScopeVis::handleMessage: MsgScopeVisChangeTrigger: " << triggerIndex;
changeTrigger(conf.getTriggerData(), triggerIndex);
return true;
}
else if (MsgScopeVisNGRemoveTrigger::match(message))
else if (MsgScopeVisRemoveTrigger::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGRemoveTrigger& conf = (MsgScopeVisNGRemoveTrigger&) message;
MsgScopeVisRemoveTrigger& conf = (MsgScopeVisRemoveTrigger&) message;
uint32_t triggerIndex = conf.getTriggerIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGRemoveTrigger: " << triggerIndex;
if (triggerIndex < m_triggerConditions.size())
{
TriggerCondition *triggerCondition = m_triggerConditions[triggerIndex];
m_triggerConditions.erase(m_triggerConditions.begin() + triggerIndex);
delete triggerCondition;
}
qDebug() << "ScopeVis::handleMessage: MsgScopeVisRemoveTrigger: " << triggerIndex;
removeTrigger(triggerIndex);
return true;
}
else if (MsgScopeVisNGMoveTrigger::match(message))
else if (MsgScopeVisMoveTrigger::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGMoveTrigger& conf = (MsgScopeVisNGMoveTrigger&) message;
MsgScopeVisMoveTrigger& conf = (MsgScopeVisMoveTrigger&) message;
int triggerIndex = conf.getTriggerIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGMoveTrigger: " << triggerIndex;
qDebug() << "ScopeVis::handleMessage: MsgScopeVisMoveTrigger: " << triggerIndex;
if (!conf.getMoveUp() && (triggerIndex == 0)) {
return true;
}
int nextTriggerIndex = (triggerIndex + (conf.getMoveUp() ? 1 : -1)) % m_triggerConditions.size();
TriggerCondition *nextTrigger = m_triggerConditions[nextTriggerIndex];
m_triggerConditions[nextTriggerIndex] = m_triggerConditions[triggerIndex];
m_triggerConditions[triggerIndex] = nextTrigger;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
moveTrigger(triggerIndex, conf.getMoveUp());
return true;
}
else if (MsgScopeVisNGFocusOnTrigger::match(message))
else if (MsgScopeVisFocusOnTrigger::match(message))
{
MsgScopeVisNGFocusOnTrigger& conf = (MsgScopeVisNGFocusOnTrigger&) message;
MsgScopeVisFocusOnTrigger& conf = (MsgScopeVisFocusOnTrigger&) message;
uint32_t triggerIndex = conf.getTriggerIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGFocusOnTrigger: " << triggerIndex;
if (triggerIndex < m_triggerConditions.size())
{
m_focusedTriggerIndex = triggerIndex;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTriggerData(m_triggerConditions[m_focusedTriggerIndex]->m_triggerData);
}
updateGLScopeDisplay();
}
qDebug() << "ScopeVis::handleMessage: MsgScopeVisFocusOnTrigger: " << triggerIndex;
focusOnTrigger(triggerIndex);
return true;
}
else if (MsgScopeVisAddTrace::match(message))
@ -998,36 +996,21 @@ bool ScopeVis::handleMessage(const Message& message)
removeTrace(traceIndex);
return true;
}
else if (MsgScopeVisNGMoveTrace::match(message))
else if (MsgScopeVisMoveTrace::match(message))
{
QMutexLocker configLocker(&m_mutex);
MsgScopeVisNGMoveTrace& conf = (MsgScopeVisNGMoveTrace&) message;
MsgScopeVisMoveTrace& conf = (MsgScopeVisMoveTrace&) message;
uint32_t traceIndex = conf.getTraceIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGMoveTrace: " << traceIndex;
m_traces.moveTrace(traceIndex, conf.getMoveUp());
//updateMaxTraceDelay();
computeDisplayTriggerLevels();
updateGLScopeDisplay();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisMoveTrace: " << traceIndex;
moveTrace(traceIndex, conf.getMoveUp());
return true;
}
else if (MsgScopeVisNGFocusOnTrace::match(message))
else if (MsgScopeVisFocusOnTrace::match(message))
{
MsgScopeVisNGFocusOnTrace& conf = (MsgScopeVisNGFocusOnTrace&) message;
MsgScopeVisFocusOnTrace& conf = (MsgScopeVisFocusOnTrace&) message;
uint32_t traceIndex = conf.getTraceIndex();
qDebug() << "ScopeVis::handleMessage: MsgScopeVisNGFocusOnTrace: " << traceIndex;
if (traceIndex < m_traces.m_tracesData.size())
{
m_focusedTraceIndex = traceIndex;
computeDisplayTriggerLevels();
if (m_glScope) {
m_glScope->setFocusedTraceIndex(m_focusedTraceIndex);
}
updateGLScopeDisplay();
}
qDebug() << "ScopeVis::handleMessage: MsgScopeVisFocusOnTrace: " << traceIndex;
focusOnTrace(traceIndex);
return true;
}
else if (MsgScopeVisNGOneShot::match(message))

View File

@ -70,14 +70,14 @@ public:
};
// ---------------------------------------------
class MsgScopeVisNGAddTrigger : public Message {
class MsgScopeVisAddTrigger : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGAddTrigger* create(
static MsgScopeVisAddTrigger* create(
const GLScopeSettings::TriggerData& triggerData)
{
return new MsgScopeVisNGAddTrigger(triggerData);
return new MsgScopeVisAddTrigger(triggerData);
}
const GLScopeSettings::TriggerData& getTriggerData() const { return m_triggerData; }
@ -85,20 +85,20 @@ public:
private:
GLScopeSettings::TriggerData m_triggerData;
MsgScopeVisNGAddTrigger(const GLScopeSettings::TriggerData& triggerData) :
MsgScopeVisAddTrigger(const GLScopeSettings::TriggerData& triggerData) :
m_triggerData(triggerData)
{}
};
// ---------------------------------------------
class MsgScopeVisNGChangeTrigger : public Message {
class MsgScopeVisChangeTrigger : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGChangeTrigger* create(
static MsgScopeVisChangeTrigger* create(
const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex)
{
return new MsgScopeVisNGChangeTrigger(triggerData, triggerIndex);
return new MsgScopeVisChangeTrigger(triggerData, triggerIndex);
}
const GLScopeSettings::TriggerData& getTriggerData() const { return m_triggerData; }
@ -108,21 +108,21 @@ public:
GLScopeSettings::TriggerData m_triggerData;
uint32_t m_triggerIndex;
MsgScopeVisNGChangeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex) :
MsgScopeVisChangeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex) :
m_triggerData(triggerData),
m_triggerIndex(triggerIndex)
{}
};
// ---------------------------------------------
class MsgScopeVisNGRemoveTrigger : public Message {
class MsgScopeVisRemoveTrigger : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGRemoveTrigger* create(
static MsgScopeVisRemoveTrigger* create(
uint32_t triggerIndex)
{
return new MsgScopeVisNGRemoveTrigger(triggerIndex);
return new MsgScopeVisRemoveTrigger(triggerIndex);
}
uint32_t getTriggerIndex() const { return m_triggerIndex; }
@ -130,21 +130,21 @@ public:
private:
uint32_t m_triggerIndex;
MsgScopeVisNGRemoveTrigger(uint32_t triggerIndex) :
MsgScopeVisRemoveTrigger(uint32_t triggerIndex) :
m_triggerIndex(triggerIndex)
{}
};
// ---------------------------------------------
class MsgScopeVisNGMoveTrigger : public Message {
class MsgScopeVisMoveTrigger : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGMoveTrigger* create(
static MsgScopeVisMoveTrigger* create(
uint32_t triggerIndex,
bool moveUpElseDown)
{
return new MsgScopeVisNGMoveTrigger(triggerIndex, moveUpElseDown);
return new MsgScopeVisMoveTrigger(triggerIndex, moveUpElseDown);
}
uint32_t getTriggerIndex() const { return m_triggerIndex; }
@ -154,21 +154,21 @@ public:
uint32_t m_triggerIndex;
bool m_moveUpElseDown;
MsgScopeVisNGMoveTrigger(uint32_t triggerIndex, bool moveUpElseDown) :
MsgScopeVisMoveTrigger(uint32_t triggerIndex, bool moveUpElseDown) :
m_triggerIndex(triggerIndex),
m_moveUpElseDown(moveUpElseDown)
{}
};
// ---------------------------------------------
class MsgScopeVisNGFocusOnTrigger : public Message {
class MsgScopeVisFocusOnTrigger : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGFocusOnTrigger* create(
static MsgScopeVisFocusOnTrigger* create(
uint32_t triggerIndex)
{
return new MsgScopeVisNGFocusOnTrigger(triggerIndex);
return new MsgScopeVisFocusOnTrigger(triggerIndex);
}
uint32_t getTriggerIndex() const { return m_triggerIndex; }
@ -176,7 +176,7 @@ public:
private:
uint32_t m_triggerIndex;
MsgScopeVisNGFocusOnTrigger(uint32_t triggerIndex) :
MsgScopeVisFocusOnTrigger(uint32_t triggerIndex) :
m_triggerIndex(triggerIndex)
{}
};
@ -248,15 +248,15 @@ public:
};
// ---------------------------------------------
class MsgScopeVisNGMoveTrace : public Message {
class MsgScopeVisMoveTrace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGMoveTrace* create(
static MsgScopeVisMoveTrace* create(
uint32_t traceIndex,
bool moveUpElseDown)
{
return new MsgScopeVisNGMoveTrace(traceIndex, moveUpElseDown);
return new MsgScopeVisMoveTrace(traceIndex, moveUpElseDown);
}
uint32_t getTraceIndex() const { return m_traceIndex; }
@ -266,21 +266,21 @@ public:
uint32_t m_traceIndex;
bool m_moveUpElseDown;
MsgScopeVisNGMoveTrace(uint32_t traceIndex, bool moveUpElseDown) :
MsgScopeVisMoveTrace(uint32_t traceIndex, bool moveUpElseDown) :
m_traceIndex(traceIndex),
m_moveUpElseDown(moveUpElseDown)
{}
};
// ---------------------------------------------
class MsgScopeVisNGFocusOnTrace : public Message {
class MsgScopeVisFocusOnTrace : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgScopeVisNGFocusOnTrace* create(
static MsgScopeVisFocusOnTrace* create(
uint32_t traceIndex)
{
return new MsgScopeVisNGFocusOnTrace(traceIndex);
return new MsgScopeVisFocusOnTrace(traceIndex);
}
uint32_t getTraceIndex() const { return m_traceIndex; }
@ -288,7 +288,7 @@ public:
private:
uint32_t m_traceIndex;
MsgScopeVisNGFocusOnTrace(uint32_t traceIndex) :
MsgScopeVisFocusOnTrace(uint32_t traceIndex) :
m_traceIndex(traceIndex)
{}
};
@ -345,13 +345,6 @@ public:
void setLiveRate(int sampleRate);
void configure(uint32_t nbStreams, uint32_t traceSize, uint32_t timeBase, uint32_t timeOfsProMill, uint32_t triggerPre, bool freeRun);
void moveTrace(uint32_t traceIndex, bool upElseDown);
void focusOnTrace(uint32_t traceIndex);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex);
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
void focusOnTrigger(uint32_t triggerIndex);
void setOneShot(bool oneShot);
void setMemoryIndex(uint32_t memoryIndex);
void setTraceChunkSize(uint32_t chunkSize) { m_traceChunkSize = chunkSize; }
@ -1240,6 +1233,13 @@ private:
void addTrace(const GLScopeSettings::TraceData& traceData);
void changeTrace(const GLScopeSettings::TraceData& traceData, uint32_t traceIndex);
void removeTrace(uint32_t traceIndex);
void moveTrace(uint32_t traceIndex, bool upElseDown);
void focusOnTrace(uint32_t traceIndex);
void addTrigger(const GLScopeSettings::TriggerData& triggerData);
void changeTrigger(const GLScopeSettings::TriggerData& triggerData, uint32_t triggerIndex);
void removeTrigger(uint32_t triggerIndex);
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
void focusOnTrigger(uint32_t triggerIndex);
/**
* Moves on to the next trigger if any or increments trigger count if in repeat mode

View File

@ -93,13 +93,14 @@ void GLScopeGUI::setBuddies(MessageQueue* messageQueue, ScopeVis* scopeVis, GLSc
// Add a trigger
GLScopeSettings::TriggerData triggerData;
fillTriggerData(triggerData);
m_scopeVis->addTrigger(triggerData);
ScopeVis::MsgScopeVisAddTrigger *msgAddTrigger = ScopeVis::MsgScopeVisAddTrigger::create(triggerData);
m_scopeVis->getInputMessageQueue()->push(msgAddTrigger);
// Add a trace
GLScopeSettings::TraceData traceData;
fillTraceData(traceData);
ScopeVis::MsgScopeVisAddTrace *msg = ScopeVis::MsgScopeVisAddTrace::create(traceData);
m_scopeVis->getInputMessageQueue()->push(msg);
ScopeVis::MsgScopeVisAddTrace *msgAddTrace = ScopeVis::MsgScopeVisAddTrace::create(traceData);
m_scopeVis->getInputMessageQueue()->push(msgAddTrace);
setEnabled(true);
connect(m_glScope, SIGNAL(sampleRateChanged(int)), this, SLOT(on_scope_sampleRateChanged(int)));
@ -346,7 +347,8 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
while (iTrigger > nbTriggersSaved) // remove possible triggers in excess
{
m_scopeVis->removeTrigger(iTrigger - 1);
ScopeVis::MsgScopeVisRemoveTrigger *msg = ScopeVis::MsgScopeVisRemoveTrigger::create(iTrigger - 1);
m_scopeVis->getInputMessageQueue()->push(msg);
iTrigger--;
}
@ -385,11 +387,13 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
if (iTrigger < nbTriggers) // change existing triggers
{
m_scopeVis->changeTrigger(triggerData, iTrigger);
ScopeVis::MsgScopeVisChangeTrigger *msg = ScopeVis::MsgScopeVisChangeTrigger::create(triggerData, iTrigger);
m_scopeVis->getInputMessageQueue()->push(msg);
}
else // add new trigers
{
m_scopeVis->addTrigger(triggerData);
ScopeVis::MsgScopeVisAddTrigger *msg = ScopeVis::MsgScopeVisAddTrigger::create(triggerData);
m_scopeVis->getInputMessageQueue()->push(msg);
}
if (iTrigger == nbTriggersSaved-1)
@ -603,7 +607,8 @@ void GLScopeGUI::on_trace_valueChanged(int value)
setTraceUI(traceData);
m_scopeVis->focusOnTrace(value);
ScopeVis::MsgScopeVisFocusOnTrace *msg = ScopeVis::MsgScopeVisFocusOnTrace::create(value);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::on_traceAdd_clicked(bool checked)
@ -643,12 +648,15 @@ void GLScopeGUI::on_traceUp_clicked(bool checked)
if (ui->trace->maximum() > 0) // more than one trace
{
int newTraceIndex = (ui->trace->value() + 1) % (ui->trace->maximum()+1);
m_scopeVis->moveTrace(ui->trace->value(), true);
ScopeVis::MsgScopeVisMoveTrace *msgMoveTrace = ScopeVis::MsgScopeVisMoveTrace::create(ui->trace->value(), true);
m_scopeVis->getInputMessageQueue()->push(msgMoveTrace);
ui->trace->setValue(newTraceIndex); // follow trace
GLScopeSettings::TraceData traceData;
m_scopeVis->getTraceData(traceData, ui->trace->value());
setTraceUI(traceData);
m_scopeVis->focusOnTrace(ui->trace->value());
ScopeVis::MsgScopeVisFocusOnTrace *msgFocusOnTrace = ScopeVis::MsgScopeVisFocusOnTrace::create(ui->trace->value());
m_scopeVis->getInputMessageQueue()->push(msgFocusOnTrace);
}
}
@ -658,12 +666,14 @@ void GLScopeGUI::on_traceDown_clicked(bool checked)
if (ui->trace->value() > 0) // not the X (lowest) trace
{
int newTraceIndex = (ui->trace->value() - 1) % (ui->trace->maximum()+1);
m_scopeVis->moveTrace(ui->trace->value(), false);
ScopeVis::MsgScopeVisMoveTrace *msgMoveTrace = ScopeVis::MsgScopeVisMoveTrace::create(ui->trace->value(), false);
m_scopeVis->getInputMessageQueue()->push(msgMoveTrace);
ui->trace->setValue(newTraceIndex); // follow trace
GLScopeSettings::TraceData traceData;
m_scopeVis->getTraceData(traceData, ui->trace->value());
setTraceUI(traceData);
m_scopeVis->focusOnTrace(ui->trace->value());
ScopeVis::MsgScopeVisFocusOnTrace *msgFocusOnTrace = ScopeVis::MsgScopeVisFocusOnTrace::create(ui->trace->value());
m_scopeVis->getInputMessageQueue()->push(msgFocusOnTrace);
}
}
@ -683,8 +693,8 @@ void GLScopeGUI::on_trig_valueChanged(int value)
<< " m_triggerLevel" << triggerData.m_triggerLevel;
setTriggerUI(triggerData);
m_scopeVis->focusOnTrigger(value);
ScopeVis::MsgScopeVisFocusOnTrigger *msg = ScopeVis::MsgScopeVisFocusOnTrigger::create(value);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::on_trigAdd_clicked(bool checked)
@ -700,7 +710,8 @@ void GLScopeGUI::on_trigDel_clicked(bool checked)
(void) checked;
if (ui->trig->value() > 0)
{
m_scopeVis->removeTrigger(ui->trig->value());
ScopeVis::MsgScopeVisRemoveTrigger *msg = ScopeVis::MsgScopeVisRemoveTrigger::create(ui->trig->value());
m_scopeVis->getInputMessageQueue()->push(msg);
ui->trig->setMaximum(ui->trig->maximum() - 1);
}
}
@ -711,12 +722,14 @@ void GLScopeGUI::on_trigUp_clicked(bool checked)
if (ui->trig->maximum() > 0) // more than one trigger
{
int newTriggerIndex = (ui->trig->value() + 1) % (ui->trig->maximum()+1);
m_scopeVis->moveTrigger(ui->trace->value(), true);
ScopeVis::MsgScopeVisMoveTrigger *msgMoveTrigger = ScopeVis::MsgScopeVisMoveTrigger::create(ui->trace->value(), true);
m_scopeVis->getInputMessageQueue()->push(msgMoveTrigger);
ui->trig->setValue(newTriggerIndex); // follow trigger
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, ui->trig->value());
setTriggerUI(triggerData);
m_scopeVis->focusOnTrigger(ui->trig->value());
ScopeVis::MsgScopeVisFocusOnTrigger *msgFocusOnTrigger = ScopeVis::MsgScopeVisFocusOnTrigger::create(ui->trig->value());
m_scopeVis->getInputMessageQueue()->push(msgFocusOnTrigger);
}
}
@ -726,12 +739,14 @@ void GLScopeGUI::on_trigDown_clicked(bool checked)
if (ui->trig->value() > 0) // not the 0 (lowest) trigger
{
int newTriggerIndex = (ui->trig->value() - 1) % (ui->trig->maximum()+1);
m_scopeVis->moveTrigger(ui->trace->value(), false);
ScopeVis::MsgScopeVisMoveTrigger *msgMoveTrigger = ScopeVis::MsgScopeVisMoveTrigger::create(ui->trace->value(), false);
m_scopeVis->getInputMessageQueue()->push(msgMoveTrigger);
ui->trig->setValue(newTriggerIndex); // follow trigger
GLScopeSettings::TriggerData triggerData;
m_scopeVis->getTriggerData(triggerData, ui->trig->value());
setTriggerUI(triggerData);
m_scopeVis->focusOnTrigger(ui->trig->value());
ScopeVis::MsgScopeVisFocusOnTrigger *msgFocusOnTrigger = ScopeVis::MsgScopeVisFocusOnTrigger::create(ui->trig->value());
m_scopeVis->getInputMessageQueue()->push(msgFocusOnTrigger);
}
}
@ -1295,7 +1310,8 @@ void GLScopeGUI::changeCurrentTrigger()
GLScopeSettings::TriggerData triggerData;
fillTriggerData(triggerData);
uint32_t currentTriggerIndex = ui->trig->value();
m_scopeVis->changeTrigger(triggerData, currentTriggerIndex);
ScopeVis::MsgScopeVisChangeTrigger *msg = ScopeVis::MsgScopeVisChangeTrigger::create(triggerData, currentTriggerIndex);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::fillProjectionCombo(QComboBox* comboBox)
@ -1732,14 +1748,16 @@ void GLScopeGUI::focusOnTrace(int traceIndex)
void GLScopeGUI::changeTrigger(int triggerIndex, const GLScopeSettings::TriggerData& triggerData)
{
m_scopeVis->changeTrigger(triggerData, triggerIndex);
ScopeVis::MsgScopeVisChangeTrigger *msg = ScopeVis::MsgScopeVisChangeTrigger::create(triggerData, triggerIndex);
m_scopeVis->getInputMessageQueue()->push(msg);
}
void GLScopeGUI::addTrigger(const GLScopeSettings::TriggerData& triggerData)
{
if (ui->trig->maximum() < 9)
{
m_scopeVis->addTrigger(triggerData);
ScopeVis::MsgScopeVisAddTrigger *msg = ScopeVis::MsgScopeVisAddTrigger::create(triggerData);
m_scopeVis->getInputMessageQueue()->push(msg);
ui->trig->setMaximum(ui->trig->maximum() + 1);
}
}