2014-05-18 11:52:39 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
|
|
// written by Christian Daniel //
|
|
|
|
// //
|
|
|
|
// 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 INCLUDE_GLSCOPE_H
|
|
|
|
#define INCLUDE_GLSCOPE_H
|
|
|
|
|
|
|
|
#include <QGLWidget>
|
|
|
|
#include <QPen>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QMutex>
|
|
|
|
#include "dsp/dsptypes.h"
|
|
|
|
#include "dsp/scopevis.h"
|
2015-07-06 03:17:51 -04:00
|
|
|
#include "gui/scaleengine.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "util/export.h"
|
|
|
|
|
|
|
|
class DSPEngine;
|
|
|
|
class ScopeVis;
|
|
|
|
|
2015-08-29 19:26:51 -04:00
|
|
|
class SDRANGEL_API GLScope: public QGLWidget {
|
2014-05-18 11:52:39 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Mode {
|
|
|
|
ModeIQ,
|
|
|
|
ModeMagLinPha,
|
|
|
|
ModeMagdBPha,
|
|
|
|
ModeDerived12,
|
|
|
|
ModeCyclostationary
|
|
|
|
};
|
|
|
|
|
2015-07-12 16:22:04 -04:00
|
|
|
enum Displays {
|
|
|
|
DisplayBoth,
|
|
|
|
DisplayFirstOnly,
|
|
|
|
DisplaySecondOnly
|
|
|
|
};
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
GLScope(QWidget* parent = NULL);
|
|
|
|
~GLScope();
|
|
|
|
|
|
|
|
void setDSPEngine(DSPEngine* dspEngine);
|
|
|
|
void setAmp(Real amp);
|
2015-07-06 03:17:51 -04:00
|
|
|
void setAmpOfs(Real ampOfs);
|
2014-05-18 11:52:39 -04:00
|
|
|
void setTimeBase(int timeBase);
|
|
|
|
void setTimeOfsProMill(int timeOfsProMill);
|
|
|
|
void setMode(Mode mode);
|
2015-07-12 16:22:04 -04:00
|
|
|
void setDisplays(Displays displays);
|
2014-05-18 11:52:39 -04:00
|
|
|
void setOrientation(Qt::Orientation orientation);
|
2015-06-23 16:52:27 -04:00
|
|
|
void setDisplayGridIntensity(int intensity);
|
2015-07-18 05:27:09 -04:00
|
|
|
void setDisplayTraceIntensity(int intensity);
|
2015-07-13 19:45:16 -04:00
|
|
|
void setTriggerChannel(ScopeVis::TriggerChannel triggerChannel);
|
|
|
|
void setTriggerLevel(Real triggerLevel);
|
2015-07-26 20:12:37 -04:00
|
|
|
void setTriggerPre(Real triggerPre);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
void newTrace(const std::vector<Complex>& trace, int sampleRate);
|
|
|
|
int getTraceSize() const { return m_rawTrace.size(); }
|
|
|
|
|
2015-07-06 19:17:16 -04:00
|
|
|
void setSampleRate(int sampleRate);
|
|
|
|
int getSampleRate() const { return m_sampleRate; }
|
2015-07-12 05:25:55 -04:00
|
|
|
Mode getDataMode() const { return m_mode; }
|
2015-07-31 22:07:09 -04:00
|
|
|
void connectTimer(const QTimer& timer);
|
2015-07-06 03:17:51 -04:00
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
signals:
|
|
|
|
void traceSizeChanged(int);
|
2015-07-06 19:17:16 -04:00
|
|
|
void sampleRateChanged(int);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// state
|
|
|
|
QTimer m_timer;
|
|
|
|
QMutex m_mutex;
|
|
|
|
bool m_dataChanged;
|
|
|
|
bool m_configChanged;
|
|
|
|
Mode m_mode;
|
2015-07-12 16:22:04 -04:00
|
|
|
Displays m_displays;
|
2014-05-18 11:52:39 -04:00
|
|
|
Qt::Orientation m_orientation;
|
|
|
|
|
|
|
|
// traces
|
|
|
|
std::vector<Complex> m_rawTrace;
|
|
|
|
std::vector<Complex> m_mathTrace;
|
|
|
|
std::vector<Complex>* m_displayTrace;
|
|
|
|
int m_oldTraceSize;
|
|
|
|
int m_sampleRate;
|
|
|
|
Real m_amp1;
|
|
|
|
Real m_amp2;
|
|
|
|
Real m_ofs1;
|
|
|
|
Real m_ofs2;
|
|
|
|
|
|
|
|
// sample sink
|
|
|
|
DSPEngine* m_dspEngine;
|
|
|
|
ScopeVis* m_scopeVis;
|
|
|
|
|
|
|
|
// config
|
|
|
|
Real m_amp;
|
2015-07-06 03:17:51 -04:00
|
|
|
Real m_ofs;
|
2014-05-18 11:52:39 -04:00
|
|
|
int m_timeBase;
|
|
|
|
int m_timeOfsProMill;
|
|
|
|
ScopeVis::TriggerChannel m_triggerChannel;
|
2015-07-13 19:24:59 -04:00
|
|
|
Real m_triggerLevel;
|
2015-07-26 20:12:37 -04:00
|
|
|
Real m_triggerPre;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
// graphics stuff
|
|
|
|
QRectF m_glScopeRect1;
|
|
|
|
QRectF m_glScopeRect2;
|
2015-06-23 16:52:27 -04:00
|
|
|
int m_displayGridIntensity;
|
2015-07-18 05:27:09 -04:00
|
|
|
int m_displayTraceIntensity;
|
2015-07-06 03:17:51 -04:00
|
|
|
QRectF m_glLeft1ScaleRect;
|
|
|
|
QRectF m_glLeft2ScaleRect;
|
|
|
|
QRectF m_glBot1ScaleRect;
|
|
|
|
QRectF m_glBot2ScaleRect;
|
|
|
|
QPixmap m_left1ScalePixmap;
|
2015-07-07 20:05:32 -04:00
|
|
|
QPixmap m_left2ScalePixmap;
|
|
|
|
QPixmap m_bot1ScalePixmap;
|
|
|
|
QPixmap m_bot2ScalePixmap;
|
2015-07-06 03:17:51 -04:00
|
|
|
bool m_left1ScaleTextureAllocated;
|
2015-07-07 20:05:32 -04:00
|
|
|
bool m_left2ScaleTextureAllocated;
|
|
|
|
bool m_bot1ScaleTextureAllocated;
|
|
|
|
bool m_bot2ScaleTextureAllocated;
|
|
|
|
GLuint m_left1ScaleTexture;
|
|
|
|
GLuint m_left2ScaleTexture;
|
|
|
|
GLuint m_bot1ScaleTexture;
|
|
|
|
GLuint m_bot2ScaleTexture;
|
|
|
|
ScaleEngine m_x1Scale;
|
|
|
|
ScaleEngine m_x2Scale;
|
|
|
|
ScaleEngine m_y1Scale;
|
|
|
|
ScaleEngine m_y2Scale;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int width, int height);
|
|
|
|
void paintGL();
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent*);
|
|
|
|
|
|
|
|
void handleMode();
|
|
|
|
void applyConfig();
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void tick();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_GLSCOPE_H
|