mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 05:41:56 -05:00
New scope: added change trace color feature
This commit is contained in:
parent
804497c282
commit
2820efe26b
@ -139,6 +139,7 @@ set(sdrbase_SOURCES
|
||||
sdrbase/gui/basicchannelsettingswidget.cpp
|
||||
sdrbase/gui/buttonswitch.cpp
|
||||
sdrbase/gui/channelwindow.cpp
|
||||
sdrbase/gui/clickablelabel.cpp
|
||||
sdrbase/gui/colormapper.cpp
|
||||
sdrbase/gui/cwkeyergui.cpp
|
||||
sdrbase/gui/glscope.cpp
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define SDRBASE_DSP_SCOPEVISNG_H_
|
||||
|
||||
#include <QDebug>
|
||||
#include <QColor>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
@ -52,6 +53,10 @@ public:
|
||||
float m_ofs; //!< Offset factor
|
||||
int m_traceDelay; //!< Trace delay in number of samples
|
||||
float m_triggerDisplayLevel; //!< Displayable trigger display level in -1:+1 scale. Off scale if not displayable.
|
||||
QColor m_traceColor; //!< Trace display color
|
||||
float m_traceColorR; //!< Trace display color - red shortcut
|
||||
float m_traceColorG; //!< Trace display color - green shortcut
|
||||
float m_traceColorB; //!< Trace display color - blue shortcut
|
||||
|
||||
TraceData() :
|
||||
m_projectionType(ProjectionReal),
|
||||
@ -59,10 +64,23 @@ public:
|
||||
m_amp(1.0f),
|
||||
m_ofs(0.0f),
|
||||
m_traceDelay(0),
|
||||
m_triggerDisplayLevel(2.0) // OVer scale by default (2.0)
|
||||
{}
|
||||
m_triggerDisplayLevel(2.0), // OVer scale by default (2.0)
|
||||
m_traceColor(255,255,64)
|
||||
{
|
||||
setColor(m_traceColor);
|
||||
}
|
||||
|
||||
void setColor(QColor color) {
|
||||
m_traceColor = color;
|
||||
qreal r,g,b,a;
|
||||
m_traceColor.getRgbF(&r, &g, &b, &a);
|
||||
m_traceColorR = r;
|
||||
m_traceColorG = g;
|
||||
m_traceColorB = b;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct TriggerData
|
||||
{
|
||||
ProjectionType m_projectionType; //!< Complex to real projection type
|
||||
@ -114,13 +132,18 @@ public:
|
||||
{
|
||||
if (triggerIndex < m_triggerConditions.size())
|
||||
{
|
||||
qDebug() << "copeVisNG::getTriggerData:"
|
||||
<< " index: " << triggerIndex
|
||||
<< " projection: " << (int) m_triggerConditions[triggerIndex].m_triggerData.m_projectionType;
|
||||
triggerData = m_triggerConditions[triggerIndex].m_triggerData;
|
||||
}
|
||||
}
|
||||
|
||||
void getTraceData(TraceData& traceData, uint32_t traceIndex)
|
||||
{
|
||||
if (traceIndex < m_traces.m_tracesData.size())
|
||||
{
|
||||
traceData = m_traces.m_tracesData[traceIndex];
|
||||
}
|
||||
}
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
39
sdrbase/gui/clickablelabel.cpp
Normal file
39
sdrbase/gui/clickablelabel.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "gui/clickablelabel.h"
|
||||
|
||||
ClickableLabel::ClickableLabel(QWidget* parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ClickableLabel::ClickableLabel(const QString& text, QWidget* parent)
|
||||
: QLabel(parent)
|
||||
{
|
||||
setText(text);
|
||||
}
|
||||
|
||||
ClickableLabel::~ClickableLabel()
|
||||
{
|
||||
}
|
||||
|
||||
void ClickableLabel::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
emit clicked();
|
||||
}
|
||||
|
38
sdrbase/gui/clickablelabel.h
Normal file
38
sdrbase/gui/clickablelabel.h
Normal file
@ -0,0 +1,38 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017 F4EXB //
|
||||
// written by Edouard Griffiths //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SDRBASE_GUI_CLICKABLELABEL_H_
|
||||
#define SDRBASE_GUI_CLICKABLELABEL_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QLabel>
|
||||
|
||||
class ClickableLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ClickableLabel( QWidget* parent=0 );
|
||||
explicit ClickableLabel( const QString& text="", QWidget* parent=0 );
|
||||
~ClickableLabel();
|
||||
signals:
|
||||
void clicked();
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
};
|
||||
|
||||
|
||||
#endif /* SDRBASE_GUI_CLICKABLELABEL_H_ */
|
@ -308,7 +308,8 @@ void GLScopeNG::paintGL()
|
||||
//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(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);
|
||||
|
@ -15,6 +15,8 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QColorDialog>
|
||||
|
||||
#include "glscopenggui.h"
|
||||
#include "glscopeng.h"
|
||||
#include "ui_glscopenggui.h"
|
||||
@ -37,6 +39,8 @@ GLScopeNGGUI::GLScopeNGGUI(QWidget* parent) :
|
||||
setEnabled(false);
|
||||
ui->setupUi(this);
|
||||
ui->trigDelayFine->setMaximum(ScopeVisNG::m_traceChunkSize / 10.0);
|
||||
ui->traceColor->setStyleSheet("QLabel { background-color : rgb(255,255,64); }");
|
||||
m_focusedTraceColor.setRgb(255,255,64);
|
||||
}
|
||||
|
||||
GLScopeNGGUI::~GLScopeNGGUI()
|
||||
@ -329,6 +333,17 @@ void GLScopeNGGUI::on_traceDelay_valueChanged(int value)
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_traceColor_clicked()
|
||||
{
|
||||
qDebug("GLScopeNGGUI::on_traceColor_clicked");
|
||||
QColor newColor = QColorDialog::getColor();
|
||||
m_focusedTraceColor = newColor;
|
||||
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));
|
||||
changeCurrentTrace();
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::on_trigMode_currentIndexChanged(int index)
|
||||
{
|
||||
setTrigLevelDisplay();
|
||||
@ -689,6 +704,8 @@ void GLScopeNGGUI::fillTraceData(ScopeVisNG::TraceData& traceData)
|
||||
} else {
|
||||
traceData.m_ofs = ((10.0 * ui->ofsCoarse->value()) + (ui->ofsFine->value() / 20.0)) / 1000.0f;
|
||||
}
|
||||
|
||||
traceData.setColor(m_focusedTraceColor);
|
||||
}
|
||||
|
||||
void GLScopeNGGUI::fillTriggerData(ScopeVisNG::TriggerData& triggerData)
|
||||
|
@ -60,6 +60,7 @@ private:
|
||||
int m_timeBase;
|
||||
int m_timeOffset;
|
||||
int m_traceLenMult;
|
||||
QColor m_focusedTraceColor;
|
||||
|
||||
static const double amps[11];
|
||||
|
||||
@ -107,6 +108,7 @@ private slots:
|
||||
void on_ofsCoarse_valueChanged(int value);
|
||||
void on_ofsFine_valueChanged(int value);
|
||||
void on_traceDelay_valueChanged(int value);
|
||||
void on_traceColor_clicked();
|
||||
// Third row
|
||||
void on_trig_valueChanged(int value);
|
||||
void on_trigAdd_clicked(bool checked);
|
||||
|
@ -903,6 +903,25 @@ kS/s</string>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ClickableLabel" name="traceColor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_15">
|
||||
<property name="orientation">
|
||||
@ -1612,6 +1631,11 @@ kS/s</string>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ClickableLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/clickablelabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../resources/res.qrc"/>
|
||||
|
@ -82,6 +82,7 @@ SOURCES += mainwindow.cpp\
|
||||
gui/basicchannelsettingswidget.cpp\
|
||||
gui/buttonswitch.cpp\
|
||||
gui/channelwindow.cpp\
|
||||
gui/clickablelabel.cpp\
|
||||
gui/colormapper.cpp\
|
||||
gui/cwkeyergui.cpp\
|
||||
gui/glscope.cpp\
|
||||
@ -188,6 +189,7 @@ HEADERS += mainwindow.h\
|
||||
gui/basicchannelsettingswidget.h\
|
||||
gui/buttonswitch.h\
|
||||
gui/channelwindow.h\
|
||||
gui/clickablelabel.h\
|
||||
gui/colormapper.h\
|
||||
gui/cwkeyergui.h\
|
||||
gui/glscope.h\
|
||||
|
Loading…
Reference in New Issue
Block a user