mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-04 14:17:50 -04:00
New scope: implemented trace moves
This commit is contained in:
parent
14d5b5e913
commit
5bee287360
@ -26,10 +26,12 @@ MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgConfigureScopeVisNG, Message)
|
|||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGAddTrigger, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGAddTrigger, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrigger, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrigger, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrigger, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrigger, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGMoveTrigger, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrigger, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrigger, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGAddTrace, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGAddTrace, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrace, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGChangeTrace, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGRemoveTrace, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGMoveTrace, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrace, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGFocusOnTrace, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGOneShot, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGOneShot, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGMemoryTrace, Message)
|
MESSAGE_CLASS_DEFINITION(ScopeVisNG::MsgScopeVisNGMemoryTrace, Message)
|
||||||
@ -112,6 +114,15 @@ void ScopeVisNG::removeTrace(uint32_t traceIndex)
|
|||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScopeVisNG::moveTrace(uint32_t traceIndex, bool upElseDown)
|
||||||
|
{
|
||||||
|
qDebug() << "ScopeVisNG::moveTrace:"
|
||||||
|
<< " trace: " << traceIndex
|
||||||
|
<< " up: " << upElseDown;
|
||||||
|
Message* cmd = MsgScopeVisNGMoveTrace::create(traceIndex, upElseDown);
|
||||||
|
getInputMessageQueue()->push(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void ScopeVisNG::focusOnTrace(uint32_t traceIndex)
|
void ScopeVisNG::focusOnTrace(uint32_t traceIndex)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgScopeVisNGFocusOnTrace::create(traceIndex);
|
Message* cmd = MsgScopeVisNGFocusOnTrace::create(traceIndex);
|
||||||
@ -136,6 +147,12 @@ void ScopeVisNG::removeTrigger(uint32_t triggerIndex)
|
|||||||
getInputMessageQueue()->push(cmd);
|
getInputMessageQueue()->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScopeVisNG::moveTrigger(uint32_t triggerIndex, bool upElseDown)
|
||||||
|
{
|
||||||
|
Message* cmd = MsgScopeVisNGMoveTrigger::create(triggerIndex, upElseDown);
|
||||||
|
getInputMessageQueue()->push(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void ScopeVisNG::focusOnTrigger(uint32_t triggerIndex)
|
void ScopeVisNG::focusOnTrigger(uint32_t triggerIndex)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgScopeVisNGFocusOnTrigger::create(triggerIndex);
|
Message* cmd = MsgScopeVisNGFocusOnTrigger::create(triggerIndex);
|
||||||
@ -680,6 +697,16 @@ bool ScopeVisNG::handleMessage(const Message& message)
|
|||||||
updateGLScopeDisplay();
|
updateGLScopeDisplay();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgScopeVisNGMoveTrace::match(message))
|
||||||
|
{
|
||||||
|
QMutexLocker configLocker(&m_mutex);
|
||||||
|
MsgScopeVisNGMoveTrace& conf = (MsgScopeVisNGMoveTrace&) message;
|
||||||
|
m_traces.moveTrace(conf.getTraceIndex(), conf.getMoveUp());
|
||||||
|
//updateMaxTraceDelay();
|
||||||
|
computeDisplayTriggerLevels();
|
||||||
|
updateGLScopeDisplay();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (MsgScopeVisNGFocusOnTrace::match(message))
|
else if (MsgScopeVisNGFocusOnTrace::match(message))
|
||||||
{
|
{
|
||||||
MsgScopeVisNGFocusOnTrace& conf = (MsgScopeVisNGFocusOnTrace&) message;
|
MsgScopeVisNGFocusOnTrace& conf = (MsgScopeVisNGFocusOnTrace&) message;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -158,10 +159,12 @@ public:
|
|||||||
void addTrace(const TraceData& traceData);
|
void addTrace(const TraceData& traceData);
|
||||||
void changeTrace(const TraceData& traceData, uint32_t traceIndex);
|
void changeTrace(const TraceData& traceData, uint32_t traceIndex);
|
||||||
void removeTrace(uint32_t traceIndex);
|
void removeTrace(uint32_t traceIndex);
|
||||||
|
void moveTrace(uint32_t traceIndex, bool upElseDown);
|
||||||
void focusOnTrace(uint32_t traceIndex);
|
void focusOnTrace(uint32_t traceIndex);
|
||||||
void addTrigger(const TriggerData& triggerData);
|
void addTrigger(const TriggerData& triggerData);
|
||||||
void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex);
|
void changeTrigger(const TriggerData& triggerData, uint32_t triggerIndex);
|
||||||
void removeTrigger(uint32_t triggerIndex);
|
void removeTrigger(uint32_t triggerIndex);
|
||||||
|
void moveTrigger(uint32_t triggerIndex, bool upElseDown);
|
||||||
void focusOnTrigger(uint32_t triggerIndex);
|
void focusOnTrigger(uint32_t triggerIndex);
|
||||||
void setOneShot(bool oneShot);
|
void setOneShot(bool oneShot);
|
||||||
void setMemoryIndex(uint32_t memoryIndex);
|
void setMemoryIndex(uint32_t memoryIndex);
|
||||||
@ -301,6 +304,31 @@ private:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------
|
||||||
|
class MsgScopeVisNGMoveTrigger : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
static MsgScopeVisNGMoveTrigger* create(
|
||||||
|
uint32_t triggerIndex,
|
||||||
|
bool moveUpElseDown)
|
||||||
|
{
|
||||||
|
return new MsgScopeVisNGMoveTrigger(triggerIndex, moveUpElseDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getTriggerIndex() const { return m_triggerIndex; }
|
||||||
|
bool getMoveUp() const { return m_moveUpElseDown; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_triggerIndex;
|
||||||
|
bool m_moveUpElseDown;
|
||||||
|
|
||||||
|
MsgScopeVisNGMoveTrigger(uint32_t triggerIndex, bool moveUpElseDown) :
|
||||||
|
m_triggerIndex(triggerIndex),
|
||||||
|
m_moveUpElseDown(moveUpElseDown)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
class MsgScopeVisNGFocusOnTrigger : public Message {
|
class MsgScopeVisNGFocusOnTrigger : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
@ -388,6 +416,31 @@ private:
|
|||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------------------
|
||||||
|
class MsgScopeVisNGMoveTrace : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
static MsgScopeVisNGMoveTrace* create(
|
||||||
|
uint32_t traceIndex,
|
||||||
|
bool moveUpElseDown)
|
||||||
|
{
|
||||||
|
return new MsgScopeVisNGMoveTrace(traceIndex, moveUpElseDown);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getTraceIndex() const { return m_traceIndex; }
|
||||||
|
bool getMoveUp() const { return m_moveUpElseDown; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_traceIndex;
|
||||||
|
bool m_moveUpElseDown;
|
||||||
|
|
||||||
|
MsgScopeVisNGMoveTrace(uint32_t traceIndex, bool moveUpElseDown) :
|
||||||
|
m_traceIndex(traceIndex),
|
||||||
|
m_moveUpElseDown(moveUpElseDown)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
class MsgScopeVisNGFocusOnTrace : public Message {
|
class MsgScopeVisNGFocusOnTrace : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
@ -808,7 +861,30 @@ private:
|
|||||||
|
|
||||||
resize(m_traceSize); // reallocate pointers
|
resize(m_traceSize); // reallocate pointers
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveTrace(uint32_t traceIndex, bool upElseDown)
|
||||||
|
{
|
||||||
|
if ((!upElseDown) && (traceIndex == 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextControlIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesControl.size());
|
||||||
|
int nextDataIndex = (traceIndex + (upElseDown ? 1 : -1)) % (m_tracesData.size()); // should be the same
|
||||||
|
|
||||||
|
m_tracesControl[traceIndex].releaseProjector();
|
||||||
|
m_tracesControl[nextControlIndex].releaseProjector();
|
||||||
|
|
||||||
|
TraceControl nextControl = m_tracesControl[nextControlIndex];
|
||||||
|
m_tracesControl[nextControlIndex] = m_tracesControl[traceIndex];
|
||||||
|
m_tracesControl[traceIndex] = nextControl;
|
||||||
|
|
||||||
|
TraceData nextData = m_tracesData[nextDataIndex];
|
||||||
|
m_tracesData[nextDataIndex] = m_tracesData[traceIndex];
|
||||||
|
m_tracesData[traceIndex] = nextData;
|
||||||
|
|
||||||
|
m_tracesControl[traceIndex].initProjector(m_tracesData[traceIndex].m_projectionType);
|
||||||
|
m_tracesControl[nextControlIndex].initProjector(m_tracesData[nextDataIndex].m_projectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resize(int traceSize)
|
void resize(int traceSize)
|
||||||
|
@ -568,7 +568,7 @@ void GLScopeNGGUI::on_traceAdd_clicked(bool checked)
|
|||||||
|
|
||||||
void GLScopeNGGUI::on_traceDel_clicked(bool checked)
|
void GLScopeNGGUI::on_traceDel_clicked(bool checked)
|
||||||
{
|
{
|
||||||
if (ui->trace->value() > 0)
|
if (ui->trace->value() > 0) // not the X trace
|
||||||
{
|
{
|
||||||
ui->trace->setMaximum(ui->trace->maximum() - 1);
|
ui->trace->setMaximum(ui->trace->maximum() - 1);
|
||||||
|
|
||||||
@ -587,6 +587,33 @@ void GLScopeNGGUI::on_traceDel_clicked(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::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);
|
||||||
|
ui->trace->setValue(newTraceIndex); // follow trace
|
||||||
|
ScopeVisNG::TraceData traceData;
|
||||||
|
m_scopeVis->getTraceData(traceData, ui->trace->value());
|
||||||
|
setTraceUI(traceData);
|
||||||
|
m_scopeVis->focusOnTrace(ui->trace->value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLScopeNGGUI::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);
|
||||||
|
ui->trace->setValue(newTraceIndex); // follow trace
|
||||||
|
ScopeVisNG::TraceData traceData;
|
||||||
|
m_scopeVis->getTraceData(traceData, ui->trace->value());
|
||||||
|
setTraceUI(traceData);
|
||||||
|
m_scopeVis->focusOnTrace(ui->trace->value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLScopeNGGUI::on_trig_valueChanged(int value)
|
void GLScopeNGGUI::on_trig_valueChanged(int value)
|
||||||
{
|
{
|
||||||
|
@ -175,6 +175,8 @@ private slots:
|
|||||||
void on_trace_valueChanged(int value);
|
void on_trace_valueChanged(int value);
|
||||||
void on_traceAdd_clicked(bool checked);
|
void on_traceAdd_clicked(bool checked);
|
||||||
void on_traceDel_clicked(bool checked);
|
void on_traceDel_clicked(bool checked);
|
||||||
|
void on_traceUp_clicked(bool checked);
|
||||||
|
void on_traceDown_clicked(bool checked);
|
||||||
void on_traceMode_currentIndexChanged(int index);
|
void on_traceMode_currentIndexChanged(int index);
|
||||||
void on_amp_valueChanged(int value);
|
void on_amp_valueChanged(int value);
|
||||||
void on_ofsCoarse_valueChanged(int value);
|
void on_ofsCoarse_valueChanged(int value);
|
||||||
|
@ -641,6 +641,65 @@ kS/s</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="traceMoveLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="traceUp">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move trace up in trace list (wraps around)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="traceDown">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move trace down in trace list</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_4">
|
<widget class="Line" name="line_4">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -1225,6 +1284,65 @@ kS/s</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="trigMoveLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="trigUp">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move trigger up in trigger chain (wraps around)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/arrow_up.png</normaloff>:/arrow_up.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="trigDown">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>18</width>
|
||||||
|
<height>18</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Move trigger down in trigger chain</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/arrow_down.png</normaloff>:/arrow_down.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_10">
|
<widget class="Line" name="line_10">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -69,5 +69,7 @@
|
|||||||
<file>morsekey.png</file>
|
<file>morsekey.png</file>
|
||||||
<file>txoff.png</file>
|
<file>txoff.png</file>
|
||||||
<file>txon.png</file>
|
<file>txon.png</file>
|
||||||
|
<file>arrow_down.png</file>
|
||||||
|
<file>arrow_up.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user