mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-19 08:05:49 -05:00
New scope: implemented view trace toggle
This commit is contained in:
parent
3bf3e4e737
commit
68b28fc648
@ -67,6 +67,7 @@ public:
|
||||
float m_traceColorB; //!< Trace display color - blue shortcut
|
||||
bool m_hasTextOverlay; //!< True if a text overlay has to be displayed
|
||||
QString m_textOverlay; //!< Text overlay to display
|
||||
bool m_viewTrace; //!< Trace visibility
|
||||
|
||||
TraceData() :
|
||||
m_projectionType(ProjectionReal),
|
||||
@ -81,7 +82,8 @@ public:
|
||||
m_traceDelayFine(0),
|
||||
m_triggerDisplayLevel(2.0), // OVer scale by default (2.0)
|
||||
m_traceColor(255,255,64),
|
||||
m_hasTextOverlay(false)
|
||||
m_hasTextOverlay(false),
|
||||
m_viewTrace(true)
|
||||
{
|
||||
setColor(m_traceColor);
|
||||
}
|
||||
|
@ -303,60 +303,63 @@ void GLScopeNG::paintGL()
|
||||
const float *trace = (*m_traces)[0];
|
||||
const ScopeVisNG::TraceData& traceData = (*m_tracesData)[0];
|
||||
|
||||
int start = (m_timeOfsProMill/1000.0) * m_traceSize;
|
||||
int end = std::min(start + m_traceSize/m_timeBase, m_traceSize);
|
||||
|
||||
if(end - start < 2)
|
||||
start--;
|
||||
|
||||
float rectX = m_glScopeRect1.x();
|
||||
float rectY = m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0f;
|
||||
float rectW = m_glScopeRect1.width() * (float)m_timeBase / (float)(m_traceSize - 1);
|
||||
//float rectH = -(m_glScopeRect1.height() / 2.0f) * traceData.m_amp;
|
||||
float rectH = -m_glScopeRect1.height() / 2.0f;
|
||||
|
||||
//QVector4D color(1.0f, 1.0f, 0.25f, m_displayTraceIntensity / 100.0f);
|
||||
QVector4D color(traceData.m_traceColorR, traceData.m_traceColorG, traceData.m_traceColorB, m_displayTraceIntensity / 100.0f);
|
||||
QMatrix4x4 mat;
|
||||
mat.setToIdentity();
|
||||
mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY);
|
||||
mat.scale(2.0f * rectW, -2.0f * rectH);
|
||||
m_glShaderSimple.drawPolyline(mat, color, (GLfloat *) &trace[2*start], end - start);
|
||||
|
||||
// Paint trigger level if any
|
||||
if ((traceData.m_triggerDisplayLevel > -1.0f) && (traceData.m_triggerDisplayLevel < 1.0f))
|
||||
if (traceData.m_viewTrace)
|
||||
{
|
||||
GLfloat q3[] {
|
||||
0, traceData.m_triggerDisplayLevel,
|
||||
1, traceData.m_triggerDisplayLevel
|
||||
};
|
||||
int start = (m_timeOfsProMill/1000.0) * m_traceSize;
|
||||
int end = std::min(start + m_traceSize/m_timeBase, m_traceSize);
|
||||
|
||||
float rectX = m_glScopeRect1.x();
|
||||
float rectY = m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0f;
|
||||
float rectW = m_glScopeRect1.width();
|
||||
float rectH = -m_glScopeRect1.height() / 2.0f;
|
||||
if(end - start < 2)
|
||||
start--;
|
||||
|
||||
QVector4D color(
|
||||
m_focusedTriggerData.m_triggerColorR,
|
||||
m_focusedTriggerData.m_triggerColorG,
|
||||
m_focusedTriggerData.m_triggerColorB,
|
||||
0.4f);
|
||||
QMatrix4x4 mat;
|
||||
mat.setToIdentity();
|
||||
mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY);
|
||||
mat.scale(2.0f * rectW, -2.0f * rectH);
|
||||
m_glShaderSimple.drawSegments(mat, color, q3, 2);
|
||||
} // display trigger
|
||||
float rectX = m_glScopeRect1.x();
|
||||
float rectY = m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0f;
|
||||
float rectW = m_glScopeRect1.width() * (float)m_timeBase / (float)(m_traceSize - 1);
|
||||
//float rectH = -(m_glScopeRect1.height() / 2.0f) * traceData.m_amp;
|
||||
float rectH = -m_glScopeRect1.height() / 2.0f;
|
||||
|
||||
// Paint overlay if any
|
||||
if ((m_focusedTraceIndex == 0) && (traceData.m_hasTextOverlay))
|
||||
{
|
||||
drawChannelOverlay(
|
||||
traceData.m_textOverlay,
|
||||
traceData.m_traceColor,
|
||||
m_channelOverlayPixmap1,
|
||||
m_glScopeRect1);
|
||||
}
|
||||
//QVector4D color(1.0f, 1.0f, 0.25f, m_displayTraceIntensity / 100.0f);
|
||||
QVector4D color(traceData.m_traceColorR, traceData.m_traceColorG, traceData.m_traceColorB, m_displayTraceIntensity / 100.0f);
|
||||
QMatrix4x4 mat;
|
||||
mat.setToIdentity();
|
||||
mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY);
|
||||
mat.scale(2.0f * rectW, -2.0f * rectH);
|
||||
m_glShaderSimple.drawPolyline(mat, color, (GLfloat *) &trace[2*start], end - start);
|
||||
|
||||
// Paint trigger level if any
|
||||
if ((traceData.m_triggerDisplayLevel > -1.0f) && (traceData.m_triggerDisplayLevel < 1.0f))
|
||||
{
|
||||
GLfloat q3[] {
|
||||
0, traceData.m_triggerDisplayLevel,
|
||||
1, traceData.m_triggerDisplayLevel
|
||||
};
|
||||
|
||||
float rectX = m_glScopeRect1.x();
|
||||
float rectY = m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0f;
|
||||
float rectW = m_glScopeRect1.width();
|
||||
float rectH = -m_glScopeRect1.height() / 2.0f;
|
||||
|
||||
QVector4D color(
|
||||
m_focusedTriggerData.m_triggerColorR,
|
||||
m_focusedTriggerData.m_triggerColorG,
|
||||
m_focusedTriggerData.m_triggerColorB,
|
||||
0.4f);
|
||||
QMatrix4x4 mat;
|
||||
mat.setToIdentity();
|
||||
mat.translate(-1.0f + 2.0f * rectX, 1.0f - 2.0f * rectY);
|
||||
mat.scale(2.0f * rectW, -2.0f * rectH);
|
||||
m_glShaderSimple.drawSegments(mat, color, q3, 2);
|
||||
} // display trigger
|
||||
|
||||
// Paint overlay if any
|
||||
if ((m_focusedTraceIndex == 0) && (traceData.m_hasTextOverlay))
|
||||
{
|
||||
drawChannelOverlay(
|
||||
traceData.m_textOverlay,
|
||||
traceData.m_traceColor,
|
||||
m_channelOverlayPixmap1,
|
||||
m_glScopeRect1);
|
||||
} // display overlay
|
||||
} // displayable trace
|
||||
} // trace length > 0
|
||||
} // Display X
|
||||
|
||||
@ -481,6 +484,10 @@ void GLScopeNG::paintGL()
|
||||
const float *trace = (*m_traces)[i];
|
||||
const ScopeVisNG::TraceData& traceData = (*m_tracesData)[i];
|
||||
|
||||
if (!traceData.m_viewTrace) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float rectX = m_glScopeRect2.x();
|
||||
float rectY = m_glScopeRect2.y() + m_glScopeRect2.height() / 2.0f;
|
||||
float rectW = m_glScopeRect2.width() * (float)m_timeBase / (float)(m_traceSize - 1);
|
||||
@ -700,6 +707,10 @@ void GLScopeNG::paintGL()
|
||||
const float *trace = (*m_traces)[i];
|
||||
const ScopeVisNG::TraceData& traceData = (*m_tracesData)[i];
|
||||
|
||||
if (!traceData.m_viewTrace) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float rectX = m_glScopeRect1.x();
|
||||
float rectY = m_glScopeRect1.y() + m_glScopeRect1.height() / 2.0f;
|
||||
float rectW = m_glScopeRect1.width() * (float)m_timeBase / (float)(m_traceSize - 1);
|
||||
@ -869,6 +880,10 @@ void GLScopeNG::paintGL()
|
||||
const float *trace = (*m_traces)[i];
|
||||
const ScopeVisNG::TraceData& traceData = (*m_tracesData)[i];
|
||||
|
||||
if (!traceData.m_viewTrace) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i = start; i < end; i++)
|
||||
{
|
||||
float y = trace[2*i+1];
|
||||
|
@ -719,6 +719,11 @@ void GLScopeNGGUI::on_traceDelayFine_valueChanged(int value)
|
||||
changeCurrentTrace();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_traceView_toggled(bool checked)
|
||||
{
|
||||
changeCurrentTrace();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_traceColor_clicked()
|
||||
{
|
||||
QColor newColor = QColorDialog::getColor(m_focusedTraceColor);
|
||||
@ -1196,8 +1201,8 @@ void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData)
|
||||
traceData.m_traceDelayCoarse = ui->traceDelayCoarse->value();
|
||||
traceData.m_traceDelayFine = ui->traceDelayFine->value();
|
||||
traceData.m_traceDelay = traceData.m_traceDelayCoarse * 100 + traceData.m_traceDelayFine;
|
||||
|
||||
traceData.setColor(m_focusedTraceColor);
|
||||
traceData.m_viewTrace = ui->traceView->isChecked();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::fillTriggerData(ScopeVisNG::TriggerData& triggerData)
|
||||
@ -1237,6 +1242,8 @@ void GLScopeNGGUI::setTraceUI(ScopeVisNG::TraceData& traceData)
|
||||
int r, g, b, a;
|
||||
m_focusedTraceColor.getRgb(&r, &g, &b, &a);
|
||||
ui->traceColor->setStyleSheet(tr("QLabel { background-color : rgb(%1,%2,%3); }").arg(r).arg(g).arg(b));
|
||||
|
||||
ui->traceView->setChecked(traceData.m_viewTrace);
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::setTriggerUI(ScopeVisNG::TriggerData& triggerData)
|
||||
|
@ -183,6 +183,7 @@ private slots:
|
||||
void on_ofsFine_valueChanged(int value);
|
||||
void on_traceDelayCoarse_valueChanged(int value);
|
||||
void on_traceDelayFine_valueChanged(int value);
|
||||
void on_traceView_toggled(bool checked);
|
||||
void on_traceColor_clicked();
|
||||
void on_mem_valueChanged(int value);
|
||||
// Third row
|
||||
|
@ -980,6 +980,19 @@ kS/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="traceView">
|
||||
<property name="toolTip">
|
||||
<string>View trace toggle</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="traceColor">
|
||||
<property name="minimumSize">
|
||||
|
Loading…
Reference in New Issue
Block a user