2014-05-18 11:52:39 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2016-03-04 12:51:03 -05:00
|
|
|
// Copyright (C) 2016 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
|
|
|
// //
|
|
|
|
// OpenGL interface modernization. //
|
|
|
|
// See: http://doc.qt.io/qt-5/qopenglshaderprogram.html //
|
2014-05-18 11:52:39 -04:00
|
|
|
// //
|
|
|
|
// 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 //
|
2019-04-11 08:43:33 -04:00
|
|
|
// (at your option) any later version. //
|
2014-05-18 11:52:39 -04:00
|
|
|
// //
|
|
|
|
// 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_GLSPECTRUM_H
|
|
|
|
#define INCLUDE_GLSPECTRUM_H
|
|
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QMutex>
|
2016-03-01 21:09:50 -05:00
|
|
|
#include <QOpenGLBuffer>
|
|
|
|
#include <QOpenGLVertexArrayObject>
|
2016-03-02 16:50:05 -05:00
|
|
|
#include <QMatrix4x4>
|
2016-03-05 15:54:24 -05:00
|
|
|
#include <QGLWidget>
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "gui/scaleengine.h"
|
2016-03-02 19:09:55 -05:00
|
|
|
#include "gui/glshadersimple.h"
|
2016-03-05 00:45:05 -05:00
|
|
|
#include "gui/glshadertextured.h"
|
2021-08-07 13:45:48 -04:00
|
|
|
#include "dsp/glspectruminterface.h"
|
|
|
|
#include "dsp/spectrummarkers.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
#include "dsp/channelmarker.h"
|
2021-08-04 13:28:52 -04:00
|
|
|
#include "dsp/spectrumsettings.h"
|
2018-03-20 08:49:21 -04:00
|
|
|
#include "export.h"
|
2018-02-28 20:19:52 -05:00
|
|
|
#include "util/incrementalarray.h"
|
2018-07-01 14:48:30 -04:00
|
|
|
#include "util/message.h"
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2016-03-01 21:09:50 -05:00
|
|
|
class QOpenGLShaderProgram;
|
2018-07-01 14:48:30 -04:00
|
|
|
class MessageQueue;
|
2021-02-15 07:49:51 -05:00
|
|
|
class SpectrumVis;
|
2016-03-01 21:09:50 -05:00
|
|
|
|
2020-04-28 12:44:03 -04:00
|
|
|
class SDRGUI_API GLSpectrum : public QGLWidget, public GLSpectrumInterface {
|
2022-01-20 18:18:41 -05:00
|
|
|
Q_OBJECT
|
2014-05-18 11:52:39 -04:00
|
|
|
|
|
|
|
public:
|
2018-07-01 14:48:30 -04:00
|
|
|
class MsgReportSampleRate : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
MsgReportSampleRate(quint32 sampleRate) :
|
|
|
|
Message(),
|
|
|
|
m_sampleRate(sampleRate)
|
2020-08-29 05:10:11 -04:00
|
|
|
{}
|
2018-07-01 14:48:30 -04:00
|
|
|
|
|
|
|
quint32 getSampleRate() const { return m_sampleRate; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
quint32 m_sampleRate;
|
|
|
|
};
|
|
|
|
|
2020-08-29 05:10:11 -04:00
|
|
|
class MsgReportWaterfallShare : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
MsgReportWaterfallShare(Real waterfallShare) :
|
|
|
|
Message(),
|
|
|
|
m_waterfallShare(waterfallShare)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Real getWaterfallShare() const { return m_waterfallShare; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Real m_waterfallShare;
|
|
|
|
};
|
|
|
|
|
2021-02-19 07:42:05 -05:00
|
|
|
class MsgReportFFTOverlap : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
MsgReportFFTOverlap(int overlap) :
|
|
|
|
Message(),
|
|
|
|
m_overlap(overlap)
|
|
|
|
{}
|
|
|
|
|
|
|
|
int getOverlap() const { return m_overlap; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_overlap;
|
|
|
|
};
|
|
|
|
|
|
|
|
class MsgReportPowerScale : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
MsgReportPowerScale(int refLevel, int range) :
|
|
|
|
Message(),
|
|
|
|
m_refLevel(refLevel),
|
|
|
|
m_range(range)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Real getRefLevel() const { return m_refLevel; }
|
|
|
|
Real getRange() const { return m_range; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Real m_refLevel;
|
|
|
|
Real m_range;
|
|
|
|
};
|
|
|
|
|
2022-02-04 02:38:04 -05:00
|
|
|
class MsgReportCalibrationShift : public Message {
|
|
|
|
MESSAGE_CLASS_DECLARATION
|
|
|
|
|
|
|
|
public:
|
|
|
|
MsgReportCalibrationShift(Real calibrationShiftdB) :
|
|
|
|
Message(),
|
|
|
|
m_calibrationShiftdB(calibrationShiftdB)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Real getCalibrationShiftdB() const { return m_calibrationShiftdB; }
|
|
|
|
private:
|
|
|
|
Real m_calibrationShiftdB;
|
|
|
|
};
|
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
GLSpectrum(QWidget* parent = nullptr);
|
|
|
|
virtual ~GLSpectrum();
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void setCenterFrequency(qint64 frequency);
|
2021-07-31 16:57:31 -04:00
|
|
|
qint64 getCenterFrequency() const { return m_centerFrequency; }
|
|
|
|
float getPowerMax() const;
|
2021-08-02 18:28:14 -04:00
|
|
|
float getTimeMax() const;
|
2022-01-20 18:18:41 -05:00
|
|
|
void setSampleRate(qint32 sampleRate);
|
|
|
|
void setTimingRate(qint32 timingRate);
|
2021-02-09 02:08:59 -05:00
|
|
|
void setFFTOverlap(int overlap);
|
2022-01-20 18:18:41 -05:00
|
|
|
void setReferenceLevel(Real referenceLevel);
|
|
|
|
void setPowerRange(Real powerRange);
|
|
|
|
void setDecay(int decay);
|
|
|
|
void setDecayDivisor(int decayDivisor);
|
|
|
|
void setHistoStroke(int stroke);
|
|
|
|
void setDisplayWaterfall(bool display);
|
|
|
|
void setSsbSpectrum(bool ssbSpectrum);
|
|
|
|
void setLsbDisplay(bool lsbDisplay);
|
|
|
|
void setInvertedWaterfall(bool inv);
|
|
|
|
void setDisplayMaxHold(bool display);
|
|
|
|
void setDisplayCurrent(bool display);
|
|
|
|
void setDisplayHistogram(bool display);
|
|
|
|
void setDisplayGrid(bool display);
|
|
|
|
void setDisplayGridIntensity(int intensity);
|
|
|
|
void setDisplayTraceIntensity(int intensity);
|
|
|
|
void setLinear(bool linear);
|
2022-02-04 02:38:04 -05:00
|
|
|
void setUseCalibration(bool useCalibration);
|
2022-01-20 18:18:41 -05:00
|
|
|
qint32 getSampleRate() const { return m_sampleRate; }
|
|
|
|
|
|
|
|
void addChannelMarker(ChannelMarker* channelMarker);
|
|
|
|
void removeChannelMarker(ChannelMarker* channelMarker);
|
|
|
|
void setMessageQueueToGUI(MessageQueue* messageQueue) { m_messageQueueToGUI = messageQueue; }
|
|
|
|
|
|
|
|
virtual void newSpectrum(const Real* spectrum, int nbBins, int fftSize);
|
|
|
|
void clearSpectrumHistogram();
|
|
|
|
|
|
|
|
Real getWaterfallShare() const { return m_waterfallShare; }
|
|
|
|
void setWaterfallShare(Real waterfallShare);
|
2021-02-11 18:53:18 -05:00
|
|
|
void setFPSPeriodMs(int fpsPeriodMs);
|
2015-07-23 19:30:00 -04:00
|
|
|
|
2019-05-30 12:38:10 -04:00
|
|
|
void setDisplayedStream(bool sourceOrSink, int streamIndex)
|
|
|
|
{
|
|
|
|
m_displaySourceOrSink = sourceOrSink;
|
|
|
|
m_displayStreamIndex = streamIndex;
|
|
|
|
}
|
2021-02-15 07:49:51 -05:00
|
|
|
void setSpectrumVis(SpectrumVis *spectrumVis) { m_spectrumVis = spectrumVis; }
|
2021-07-31 16:57:31 -04:00
|
|
|
const QList<SpectrumHistogramMarker>& getHistogramMarkers() const { return m_histogramMarkers; }
|
2021-08-01 04:03:58 -04:00
|
|
|
QList<SpectrumHistogramMarker>& getHistogramMarkers() { return m_histogramMarkers; }
|
2021-07-31 16:57:31 -04:00
|
|
|
void setHistogramMarkers(const QList<SpectrumHistogramMarker>& histogramMarkers);
|
|
|
|
const QList<SpectrumWaterfallMarker>& getWaterfallMarkers() const { return m_waterfallMarkers; }
|
2021-08-01 04:03:58 -04:00
|
|
|
QList<SpectrumWaterfallMarker>& getWaterfallMarkers() { return m_waterfallMarkers; }
|
2021-07-31 16:57:31 -04:00
|
|
|
void setWaterfallMarkers(const QList<SpectrumWaterfallMarker>& waterfallMarkers);
|
2022-01-20 18:18:41 -05:00
|
|
|
const QList<SpectrumAnnotationMarker>& getAnnotationMarkers() const { return m_annotationMarkers; }
|
|
|
|
QList<SpectrumAnnotationMarker>& getAnnotationMarkers() { return m_annotationMarkers; }
|
|
|
|
void setAnnotationMarkers(const QList<SpectrumAnnotationMarker>& annotationMarkers);
|
2021-08-01 04:03:58 -04:00
|
|
|
void updateHistogramMarkers();
|
|
|
|
void updateWaterfallMarkers();
|
2022-01-20 18:18:41 -05:00
|
|
|
void updateAnnotationMarkers();
|
|
|
|
void updateMarkersDisplay();
|
2022-01-30 01:43:50 -05:00
|
|
|
void updateCalibrationPoints();
|
2021-08-04 13:28:52 -04:00
|
|
|
SpectrumSettings::MarkersDisplay& getMarkersDisplay() { return m_markersDisplay; }
|
2022-01-22 00:57:46 -05:00
|
|
|
void setMarkersDisplay(SpectrumSettings::MarkersDisplay markersDisplay);
|
2022-02-04 02:38:04 -05:00
|
|
|
QList<SpectrumCalibrationPoint>& getCalibrationPoints() { return m_calibrationPoints; }
|
|
|
|
void setCalibrationPoints(const QList<SpectrumCalibrationPoint>& calibrationPoints);
|
|
|
|
SpectrumSettings::CalibrationInterpolationMode& getCalibrationInterpMode() { return m_calibrationInterpMode; }
|
|
|
|
void setCalibrationInterpMode(SpectrumSettings::CalibrationInterpolationMode mode);
|
2019-05-30 12:38:10 -04:00
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
private:
|
2022-01-20 18:18:41 -05:00
|
|
|
struct ChannelMarkerState {
|
|
|
|
ChannelMarker* m_channelMarker;
|
|
|
|
QMatrix4x4 m_glMatrixWaterfall;
|
|
|
|
QMatrix4x4 m_glMatrixDsbWaterfall;
|
|
|
|
QMatrix4x4 m_glMatrixFreqScale;
|
|
|
|
QMatrix4x4 m_glMatrixDsbFreqScale;
|
|
|
|
QMatrix4x4 m_glMatrixHistogram;
|
|
|
|
QMatrix4x4 m_glMatrixDsbHistogram;
|
|
|
|
QRect m_rect;
|
|
|
|
|
|
|
|
ChannelMarkerState(ChannelMarker* channelMarker) :
|
|
|
|
m_channelMarker(channelMarker)
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
QList<ChannelMarkerState*> m_channelMarkerStates;
|
|
|
|
|
|
|
|
enum CursorState {
|
|
|
|
CSNormal,
|
|
|
|
CSSplitter,
|
|
|
|
CSSplitterMoving,
|
|
|
|
CSChannel,
|
|
|
|
CSChannelMoving
|
|
|
|
};
|
2021-07-22 02:48:26 -04:00
|
|
|
|
2021-07-25 05:21:03 -04:00
|
|
|
QList<SpectrumHistogramMarker> m_histogramMarkers;
|
|
|
|
QList<SpectrumWaterfallMarker> m_waterfallMarkers;
|
2022-01-20 18:18:41 -05:00
|
|
|
QList<SpectrumAnnotationMarker> m_annotationMarkers;
|
|
|
|
QList<SpectrumAnnotationMarker*> m_sortedAnnotationMarkers;
|
|
|
|
QList<SpectrumAnnotationMarker*> m_visibleAnnotationMarkers;
|
2021-08-04 13:28:52 -04:00
|
|
|
SpectrumSettings::MarkersDisplay m_markersDisplay;
|
2022-02-04 02:38:04 -05:00
|
|
|
QList<SpectrumCalibrationPoint> m_calibrationPoints;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
CursorState m_cursorState;
|
|
|
|
int m_cursorChannel;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2021-02-15 07:49:51 -05:00
|
|
|
SpectrumVis* m_spectrumVis;
|
2022-01-20 18:18:41 -05:00
|
|
|
QTimer m_timer;
|
2021-02-11 18:53:18 -05:00
|
|
|
int m_fpsPeriodMs;
|
2022-01-20 18:18:41 -05:00
|
|
|
QMutex m_mutex;
|
|
|
|
bool m_mouseInside;
|
|
|
|
bool m_changesPending;
|
|
|
|
|
|
|
|
qint64 m_centerFrequency;
|
|
|
|
Real m_referenceLevel;
|
|
|
|
Real m_powerRange;
|
|
|
|
bool m_linear;
|
|
|
|
int m_decay;
|
|
|
|
quint32 m_sampleRate;
|
|
|
|
quint32 m_timingRate;
|
2021-02-09 02:08:59 -05:00
|
|
|
int m_fftOverlap;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
int m_fftSize; //!< FFT size in number of bins
|
2021-02-15 15:29:27 -05:00
|
|
|
int m_nbBins; //!< Number of visible FFT bins (zoom support)
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
bool m_displayGrid;
|
|
|
|
int m_displayGridIntensity;
|
|
|
|
int m_displayTraceIntensity;
|
|
|
|
bool m_invertedWaterfall;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
std::vector<Real> m_maxHold;
|
|
|
|
bool m_displayMaxHold;
|
|
|
|
const Real *m_currentSpectrum;
|
|
|
|
bool m_displayCurrent;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
Real m_waterfallShare;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2019-05-11 18:46:31 -04:00
|
|
|
int m_leftMargin;
|
2020-07-04 21:25:44 -04:00
|
|
|
int m_rightMargin;
|
|
|
|
int m_topMargin;
|
|
|
|
int m_frequencyScaleHeight;
|
2021-02-16 01:25:22 -05:00
|
|
|
int m_infoHeight;
|
2020-07-04 21:25:44 -04:00
|
|
|
int m_histogramHeight;
|
|
|
|
int m_waterfallHeight;
|
|
|
|
int m_bottomMargin;
|
|
|
|
QFont m_textOverlayFont;
|
2022-01-20 18:18:41 -05:00
|
|
|
QPixmap m_leftMarginPixmap;
|
|
|
|
QPixmap m_frequencyPixmap;
|
2021-02-16 01:25:22 -05:00
|
|
|
QPixmap m_infoPixmap;
|
2022-01-20 18:18:41 -05:00
|
|
|
ScaleEngine m_timeScale;
|
|
|
|
ScaleEngine m_powerScale;
|
|
|
|
ScaleEngine m_frequencyScale;
|
2020-07-04 21:25:44 -04:00
|
|
|
QRectF m_histogramRect;
|
2022-01-20 18:18:41 -05:00
|
|
|
QRect m_frequencyScaleRect;
|
2020-07-04 21:25:44 -04:00
|
|
|
QRectF m_waterfallRect;
|
2021-02-16 01:25:22 -05:00
|
|
|
QRect m_infoRect;
|
2022-01-20 18:18:41 -05:00
|
|
|
QMatrix4x4 m_glFrequencyScaleBoxMatrix;
|
|
|
|
QMatrix4x4 m_glLeftScaleBoxMatrix;
|
2021-02-16 01:25:22 -05:00
|
|
|
QMatrix4x4 m_glInfoBoxMatrix;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
QRgb m_waterfallPalette[240];
|
|
|
|
QImage* m_waterfallBuffer;
|
|
|
|
int m_waterfallBufferPos;
|
|
|
|
int m_waterfallTextureHeight;
|
|
|
|
int m_waterfallTexturePos;
|
|
|
|
QMatrix4x4 m_glWaterfallBoxMatrix;
|
|
|
|
bool m_displayWaterfall;
|
|
|
|
bool m_ssbSpectrum;
|
|
|
|
bool m_lsbDisplay;
|
|
|
|
|
|
|
|
QRgb m_histogramPalette[240];
|
|
|
|
QImage* m_histogramBuffer;
|
|
|
|
quint8* m_histogram; //!< Spectrum phosphor matrix of FFT width and PSD height scaled to 100. values [0..239]
|
|
|
|
int m_decayDivisor;
|
|
|
|
int m_decayDivisorCount;
|
|
|
|
int m_histogramStroke;
|
|
|
|
QMatrix4x4 m_glHistogramSpectrumMatrix;
|
|
|
|
QMatrix4x4 m_glHistogramBoxMatrix;
|
|
|
|
bool m_displayHistogram;
|
|
|
|
bool m_displayChanged;
|
2019-05-30 12:38:10 -04:00
|
|
|
bool m_displaySourceOrSink;
|
|
|
|
int m_displayStreamIndex;
|
2021-02-15 07:49:51 -05:00
|
|
|
float m_frequencyZoomFactor;
|
|
|
|
float m_frequencyZoomPos;
|
|
|
|
static const float m_maxFrequencyZoom;
|
2022-01-20 18:18:41 -05:00
|
|
|
static const float m_annotationMarkerHeight;
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
GLShaderSimple m_glShaderSimple;
|
|
|
|
GLShaderTextured m_glShaderLeftScale;
|
|
|
|
GLShaderTextured m_glShaderFrequencyScale;
|
|
|
|
GLShaderTextured m_glShaderWaterfall;
|
|
|
|
GLShaderTextured m_glShaderHistogram;
|
2020-07-04 21:25:44 -04:00
|
|
|
GLShaderTextured m_glShaderTextOverlay;
|
2021-02-16 01:25:22 -05:00
|
|
|
GLShaderTextured m_glShaderInfo;
|
2022-01-20 18:18:41 -05:00
|
|
|
int m_matrixLoc;
|
|
|
|
int m_colorLoc;
|
2022-02-04 02:38:04 -05:00
|
|
|
bool m_useCalibration;
|
|
|
|
Real m_calibrationGain;
|
|
|
|
Real m_calibrationShiftdB;
|
|
|
|
SpectrumSettings::CalibrationInterpolationMode m_calibrationInterpMode;
|
2022-01-20 18:18:41 -05:00
|
|
|
IncrementalArray<GLfloat> m_q3TickTime;
|
|
|
|
IncrementalArray<GLfloat> m_q3TickFrequency;
|
|
|
|
IncrementalArray<GLfloat> m_q3TickPower;
|
|
|
|
IncrementalArray<GLfloat> m_q3FFT;
|
2016-03-01 21:09:50 -05:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
MessageQueue *m_messageQueueToGUI;
|
2018-07-01 14:48:30 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void updateWaterfall(const Real *spectrum);
|
|
|
|
void updateHistogram(const Real *spectrum);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int width, int height);
|
|
|
|
void paintGL();
|
2021-08-04 13:28:52 -04:00
|
|
|
void drawSpectrumMarkers();
|
2022-01-20 18:18:41 -05:00
|
|
|
void drawAnnotationMarkers();
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void stopDrag();
|
|
|
|
void applyChanges();
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void mouseMoveEvent(QMouseEvent* event);
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent* event);
|
2019-05-11 18:46:31 -04:00
|
|
|
void wheelEvent(QWheelEvent*);
|
2021-02-15 07:49:51 -05:00
|
|
|
void channelMarkerMove(QWheelEvent*, int mul);
|
2021-02-19 07:42:05 -05:00
|
|
|
void zoom(QWheelEvent*);
|
|
|
|
void frequencyZoom(float pw);
|
2021-02-17 01:27:10 -05:00
|
|
|
void frequencyPan(QMouseEvent*);
|
2021-02-19 07:42:05 -05:00
|
|
|
void timeZoom(bool zoomInElseOut);
|
|
|
|
void powerZoom(float pw, bool zoomInElseOut);
|
2021-02-15 07:49:51 -05:00
|
|
|
void resetFrequencyZoom();
|
|
|
|
void updateFFTLimits();
|
2021-02-15 23:51:23 -05:00
|
|
|
void setFrequencyScale();
|
|
|
|
void getFrequencyZoom(int64_t& centerFrequency, int& frequencySpan);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-01-20 18:18:41 -05:00
|
|
|
void enterEvent(QEvent* event);
|
|
|
|
void leaveEvent(QEvent* event);
|
2014-05-18 11:52:39 -04:00
|
|
|
|
2022-02-04 02:38:04 -05:00
|
|
|
static QString displayScaled(int64_t value, char type, int precision, bool showMult);
|
|
|
|
static QString displayScaledF(float value, char type, int precision, bool showMult);
|
|
|
|
static QString displayPower(float value, char type, int precision);
|
2020-07-04 21:25:44 -04:00
|
|
|
int getPrecision(int value);
|
|
|
|
void drawTextOverlay( //!< Draws a text overlay
|
|
|
|
const QString& text,
|
|
|
|
const QColor& color,
|
|
|
|
const QFont& font,
|
|
|
|
float shiftX,
|
|
|
|
float shiftY,
|
|
|
|
bool leftHalf,
|
|
|
|
bool topHalf,
|
|
|
|
const QRectF& glRect);
|
2021-02-16 01:25:22 -05:00
|
|
|
void formatTextInfo(QString& info);
|
2022-01-20 18:18:41 -05:00
|
|
|
void updateSortedAnnotationMarkers();
|
|
|
|
|
|
|
|
static bool annotationDisplayLessThan(const SpectrumAnnotationMarker *m1, const SpectrumAnnotationMarker *m2)
|
|
|
|
{
|
|
|
|
if (m1->m_bandwidth == m2->m_bandwidth) {
|
|
|
|
return m1->m_startFrequency < m2->m_startFrequency;
|
|
|
|
} else {
|
|
|
|
return m1->m_bandwidth > m2->m_bandwidth; // larger bandwidths should come first for display (lower layer)
|
|
|
|
}
|
|
|
|
}
|
2020-07-04 21:25:44 -04:00
|
|
|
|
2022-02-04 02:38:04 -05:00
|
|
|
static bool calibrationPointsLessThan(const SpectrumCalibrationPoint& m1, const SpectrumCalibrationPoint& m2)
|
|
|
|
{
|
|
|
|
return m1.m_frequency < m2.m_frequency;
|
|
|
|
}
|
|
|
|
|
2014-05-18 11:52:39 -04:00
|
|
|
private slots:
|
2022-01-20 18:18:41 -05:00
|
|
|
void cleanup();
|
|
|
|
void tick();
|
|
|
|
void channelMarkerChanged();
|
|
|
|
void channelMarkerDestroyed(QObject* object);
|
2014-05-18 11:52:39 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INCLUDE_GLSPECTRUM_H
|