1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Channel Analyzer: added button to control grid itensity and serialize/deserialize scope settings

This commit is contained in:
f4exb 2015-06-23 22:52:27 +02:00
parent a463b1fbc6
commit b7ed6bd0ce
6 changed files with 66 additions and 10 deletions

View File

@ -50,6 +50,7 @@ public:
void setTimeOfsProMill(int timeOfsProMill);
void setMode(Mode mode);
void setOrientation(Qt::Orientation orientation);
void setDisplayGridIntensity(int intensity);
void newTrace(const std::vector<Complex>& trace, int sampleRate);
@ -93,6 +94,7 @@ private:
// graphics stuff
QRectF m_glScopeRect1;
QRectF m_glScopeRect2;
int m_displayGridIntensity;
void initializeGL();
void resizeGL(int width, int height);

View File

@ -43,6 +43,7 @@ private:
qint32 m_timeBase;
qint32 m_timeOffset;
qint32 m_amplification;
int m_displayGridIntensity;
void applySettings();
@ -52,6 +53,7 @@ private slots:
void on_time_valueChanged(int value);
void on_timeOfs_valueChanged(int value);
void on_dataMode_currentIndexChanged(int index);
void on_gridIntensity_valueChanged(int index);
void on_horizView_clicked();
void on_vertView_clicked();

View File

@ -55,6 +55,7 @@ QByteArray ChannelAnalyzerGUI::serialize() const
s.writeS32(5, ui->lowCut->value());
s.writeS32(6, ui->spanLog2->value());
s.writeBool(7, ui->ssb->isChecked());
s.writeBlob(8, ui->scopeGUI->serialize());
return s.final();
}
@ -87,6 +88,8 @@ bool ChannelAnalyzerGUI::deserialize(const QByteArray& data)
setNewRate(tmp);
d.readBool(7, &tmpBool, false);
ui->ssb->setChecked(tmpBool);
d.readBlob(8, &bytetmp);
ui->scopeGUI->deserialize(bytetmp);
applySettings();
return true;
} else {

View File

@ -24,7 +24,8 @@ GLScope::GLScope(QWidget* parent) :
m_amp(1.0),
m_timeBase(1),
m_timeOfsProMill(0),
m_triggerChannel(ScopeVis::TriggerFreeRun)
m_triggerChannel(ScopeVis::TriggerFreeRun),
m_displayGridIntensity(5)
{
setAttribute(Qt::WA_OpaquePaintEvent);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
@ -80,6 +81,15 @@ void GLScope::setOrientation(Qt::Orientation orientation)
update();
}
void GLScope::setDisplayGridIntensity(int intensity)
{
m_displayGridIntensity = intensity;
if (m_displayGridIntensity > 100) {
m_displayGridIntensity = 100;
}
update();
}
void GLScope::newTrace(const std::vector<Complex>& trace, int sampleRate)
{
if(!m_mutex.tryLock(2))
@ -151,7 +161,7 @@ void GLScope::paintGL()
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1.0f);
glColor4f(1, 1, 1, 0.05f);
glColor4f(1, 1, 1, m_displayGridIntensity / 100.0);
for(int i = 1; i < 10; i++) {
glBegin(GL_LINE_LOOP);
glVertex2f(0, i * 0.1);
@ -238,7 +248,7 @@ void GLScope::paintGL()
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glLineWidth(1.0f);
glColor4f(1, 1, 1, 0.05f);
glColor4f(1, 1, 1, m_displayGridIntensity / 100.0);
for(int i = 1; i < 10; i++) {
glBegin(GL_LINE_LOOP);
glVertex2f(0, i * 0.1);

View File

@ -5,6 +5,7 @@
#include "util/simpleserializer.h"
#include "ui_glscopegui.h"
#include <iostream>
GLScopeGUI::GLScopeGUI(QWidget* parent) :
QWidget(parent),
@ -17,7 +18,8 @@ GLScopeGUI::GLScopeGUI(QWidget* parent) :
m_displayOrientation(Qt::Horizontal),
m_timeBase(1),
m_timeOffset(0),
m_amplification(0)
m_amplification(0),
m_displayGridIntensity(1)
{
ui->setupUi(this);
}
@ -42,6 +44,7 @@ void GLScopeGUI::resetToDefaults()
m_timeBase = 1;
m_timeOffset = 0;
m_amplification = 0;
m_displayGridIntensity = 5;
applySettings();
}
@ -54,6 +57,7 @@ QByteArray GLScopeGUI::serialize() const
s.writeS32(3, m_timeBase);
s.writeS32(4, m_timeOffset);
s.writeS32(5, m_amplification);
s.writeS32(6, m_displayGridIntensity);
return s.final();
}
@ -73,6 +77,7 @@ bool GLScopeGUI::deserialize(const QByteArray& data)
d.readS32(3, &m_timeBase, 1);
d.readS32(4, &m_timeOffset, 0);
d.readS32(5, &m_amplification, 0);
d.readS32(6, &m_displayGridIntensity, 5);
if(m_timeBase < 0)
m_timeBase = 1;
applySettings();
@ -98,6 +103,7 @@ void GLScopeGUI::applySettings()
ui->time->setValue(m_timeBase);
ui->timeOfs->setValue(m_timeOffset);
ui->amp->setValue(m_amplification);
ui->gridIntensity->setSliderPosition(m_displayGridIntensity);
}
void GLScopeGUI::on_amp_valueChanged(int value)
@ -181,6 +187,13 @@ void GLScopeGUI::on_vertView_clicked()
}
}
void GLScopeGUI::on_gridIntensity_valueChanged(int index)
{
m_displayGridIntensity = index;
if(m_glScope != NULL)
m_glScope->setDisplayGridIntensity(m_displayGridIntensity);
}
bool GLScopeGUI::handleMessage(Message* cmd)
{
if(DSPSignalNotification::match(cmd))

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>798</width>
<height>40</height>
<width>807</width>
<height>34</height>
</rect>
</property>
<property name="windowTitle">
@ -61,27 +61,30 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Grid intensity</string>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<item>
<property name="text">
<string>I+Q Level (linear)</string>
<string>I+Q (linear)</string>
</property>
</item>
<item>
<property name="text">
<string>Magnitude (linear) + Phase</string>
<string>Mag (linear) + Phi</string>
</property>
</item>
<item>
<property name="text">
<string>Magnitude (dB) + Phase</string>
<string>Mag (dB) + Phi</string>
</property>
</item>
<item>
<property name="text">
<string>Derived 1st + 2nd order</string>
<string>Derived 1+2nd </string>
</property>
</item>
<item>
@ -310,6 +313,29 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="ampLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="gridIntensity">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>