mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-20 07:11:46 -05:00
137 lines
4.4 KiB
C++
137 lines
4.4 KiB
C++
///////////////////////////////////////////////////////////////////////////////////
|
|
// 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_GLSCOPENG_H_
|
|
#define SDRBASE_GUI_GLSCOPENG_H_
|
|
|
|
#include <QGLWidget>
|
|
#include <QPen>
|
|
#include <QTimer>
|
|
#include <QMutex>
|
|
#include <QFont>
|
|
#include <QMatrix4x4>
|
|
#include "dsp/dsptypes.h"
|
|
#include "dsp/scopevisng.h"
|
|
#include "gui/scaleengine.h"
|
|
#include "gui/glshadersimple.h"
|
|
#include "gui/glshadertextured.h"
|
|
#include "util/export.h"
|
|
#include "util/bitfieldindex.h"
|
|
|
|
class QPainter;
|
|
|
|
class SDRANGEL_API GLScopeNG: public QGLWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum DisplayMode {
|
|
DisplayXYH,
|
|
DisplayXYV,
|
|
DisplayX,
|
|
DisplayY,
|
|
DisplayPol
|
|
};
|
|
|
|
GLScopeNG(QWidget* parent = 0);
|
|
virtual ~GLScopeNG();
|
|
|
|
void connectTimer(const QTimer& timer);
|
|
|
|
void setTraces(const ScopeVisNG::DisplayTraces *traces) { m_traces = traces; m_configChanged = true; }
|
|
void newTraces();
|
|
|
|
int getSampleRate() const { return m_sampleRate; }
|
|
|
|
void setTriggerPre(Real triggerPre);
|
|
void setTimeOfsProMill(int timeOfsProMill);
|
|
void setSampleRate(int sampleRate);
|
|
void setTimeBase(int timeBase);
|
|
void setHighlightedTraceIndex(uint32_t traceIndex);
|
|
void setDisplayMode(DisplayMode displayMode);
|
|
void setTraceSize(int trceSize);
|
|
|
|
signals:
|
|
void sampleRateChanged(int);
|
|
|
|
private:
|
|
DisplayMode m_displayMode;
|
|
QTimer m_timer;
|
|
QMutex m_mutex;
|
|
bool m_dataChanged;
|
|
bool m_configChanged;
|
|
const ScopeVisNG::DisplayTraces *m_traces;
|
|
int m_sampleRate;
|
|
int m_timeOfsProMill;
|
|
Real m_triggerPre;
|
|
int m_traceSize;
|
|
int m_timeBase;
|
|
uint32_t m_highlightedTraceIndex;
|
|
|
|
// graphics stuff
|
|
QRectF m_glScopeRect1;
|
|
QRectF m_glScopeRect2;
|
|
QMatrix4x4 m_glScopeMatrix1;
|
|
QMatrix4x4 m_glScopeMatrix2;
|
|
QMatrix4x4 m_glLeft1ScaleMatrix;
|
|
QMatrix4x4 m_glRight1ScaleMatrix;
|
|
QMatrix4x4 m_glLeft2ScaleMatrix;
|
|
QMatrix4x4 m_glBot1ScaleMatrix;
|
|
QMatrix4x4 m_glBot2ScaleMatrix;
|
|
|
|
QPixmap m_left1ScalePixmap;
|
|
QPixmap m_left2ScalePixmap;
|
|
QPixmap m_bot1ScalePixmap;
|
|
QPixmap m_bot2ScalePixmap;
|
|
QPixmap m_powerOverlayPixmap1;
|
|
|
|
int m_displayGridIntensity;
|
|
int m_displayTraceIntensity;
|
|
|
|
ScaleEngine m_x1Scale; //!< Display #1 X scale. Time scale
|
|
ScaleEngine m_x2Scale; //!< Display #2 X scale. Time scale
|
|
ScaleEngine m_y1Scale; //!< Display #1 Y scale. Always connected to trace #0 (X trace)
|
|
ScaleEngine m_y2Scale; //!< Display #2 Y scale. Connected to highlighted Y trace (#1..n)
|
|
|
|
QFont m_powerOverlayFont;
|
|
|
|
GLShaderSimple m_glShaderSimple;
|
|
GLShaderTextured m_glShaderLeft1Scale;
|
|
GLShaderTextured m_glShaderBottom1Scale;
|
|
GLShaderTextured m_glShaderLeft2Scale;
|
|
GLShaderTextured m_glShaderBottom2Scale;
|
|
GLShaderTextured m_glShaderPowerOverlay;
|
|
|
|
static const int m_topMargin = 5;
|
|
static const int m_botMargin = 20;
|
|
static const int m_leftMargin = 35;
|
|
static const int m_rightMargin = 5;
|
|
|
|
void initializeGL();
|
|
void resizeGL(int width, int height);
|
|
void paintGL();
|
|
|
|
void applyConfig();
|
|
void setYScale(ScaleEngine& scale, uint32_t highlightedTraceIndex);
|
|
|
|
protected slots:
|
|
void cleanup();
|
|
void tick();
|
|
|
|
};
|
|
|
|
#endif /* SDRBASE_GUI_GLSCOPENG_H_ */
|