2012-05-22 13:09:48 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// Some code in this file and accompanying files is based on work by
|
|
|
|
// Moe Wheatley, AE4Y, released under the "Simplified BSD License".
|
|
|
|
// For more details see the accompanying file LICENSE_WHEATLEY.TXT
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef PLOTTER_H
|
|
|
|
#define PLOTTER_H
|
|
|
|
|
2013-05-23 16:21:47 -04:00
|
|
|
#ifdef QT5
|
|
|
|
#include <QtWidgets>
|
|
|
|
#else
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <QtGui>
|
2013-05-23 16:21:47 -04:00
|
|
|
#endif
|
2012-05-22 13:09:48 -04:00
|
|
|
#include <QFrame>
|
|
|
|
#include <QImage>
|
|
|
|
#include <cstring>
|
|
|
|
#include "commons.h"
|
|
|
|
|
|
|
|
#define VERT_DIVS 7 //specify grid screen divisions
|
|
|
|
#define HORZ_DIVS 20
|
|
|
|
|
|
|
|
class CPlotter : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit CPlotter(QWidget *parent = 0);
|
|
|
|
~CPlotter();
|
|
|
|
|
|
|
|
QSize minimumSizeHint() const;
|
|
|
|
QSize sizeHint() const;
|
|
|
|
QColor m_ColorTbl[256];
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2012-10-10 20:51:16 -04:00
|
|
|
bool m_bCurrent;
|
2012-10-15 13:43:49 -04:00
|
|
|
bool m_bCumulative;
|
2013-07-08 09:17:22 -04:00
|
|
|
bool m_lockTxFreq;
|
|
|
|
|
2012-09-24 19:36:38 -04:00
|
|
|
float m_fSpan;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
|
|
|
qint32 m_plotZero;
|
|
|
|
qint32 m_plotGain;
|
2012-09-24 19:36:38 -04:00
|
|
|
qint32 m_nSpan;
|
|
|
|
qint32 m_binsPerPixel;
|
2012-10-29 13:58:33 -04:00
|
|
|
qint32 m_w;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
void draw(float sw[], int i0); //Update the waterfall
|
2012-05-22 13:09:48 -04:00
|
|
|
void SetRunningState(bool running);
|
|
|
|
void setPlotZero(int plotZero);
|
|
|
|
int getPlotZero();
|
|
|
|
void setPlotGain(int plotGain);
|
|
|
|
int getPlotGain();
|
2012-09-24 19:36:38 -04:00
|
|
|
void SetStartFreq(quint64 f);
|
|
|
|
qint64 startFreq();
|
2012-05-22 13:09:48 -04:00
|
|
|
int plotWidth();
|
2012-09-24 19:36:38 -04:00
|
|
|
void setNSpan(int n);
|
2012-05-22 13:09:48 -04:00
|
|
|
void UpdateOverlay();
|
|
|
|
void setDataFromDisk(bool b);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setRxRange(int fMin);
|
2012-09-24 19:36:38 -04:00
|
|
|
void setBinsPerPixel(int n);
|
|
|
|
int binsPerPixel();
|
2013-07-08 09:17:22 -04:00
|
|
|
void setRxFreq(int n, bool bf);
|
2012-05-22 13:09:48 -04:00
|
|
|
void DrawOverlay();
|
2013-07-08 09:17:22 -04:00
|
|
|
int rxFreq();
|
2012-05-22 13:09:48 -04:00
|
|
|
void setPalette(QString palette);
|
2012-09-24 19:36:38 -04:00
|
|
|
void setFsample(int n);
|
2012-11-14 10:30:21 -05:00
|
|
|
void setNsps(int ntrperiod, int nsps);
|
2012-11-23 11:05:50 -05:00
|
|
|
void setTxFreq(int n);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setMode(QString mode);
|
|
|
|
void setModeTx(QString modeTx);
|
2012-09-24 19:36:38 -04:00
|
|
|
double fGreen();
|
2012-09-29 21:03:18 -04:00
|
|
|
void SetPercent2DScreen(int percent){m_Percent2DScreen=percent;}
|
2013-07-08 09:17:22 -04:00
|
|
|
int getFmax();
|
2012-09-29 21:03:18 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
signals:
|
|
|
|
void freezeDecode1(int n);
|
2013-07-08 09:17:22 -04:00
|
|
|
void setFreq1(int rxFreq, int txFreq);
|
2012-05-22 13:09:48 -04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
//re-implemented widget event handlers
|
|
|
|
void paintEvent(QPaintEvent *event);
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-09-24 19:36:38 -04:00
|
|
|
void MakeFrequencyStrs();
|
|
|
|
void UTCstr();
|
|
|
|
int XfromFreq(float f);
|
|
|
|
float FreqfromX(int x);
|
2012-05-22 13:09:48 -04:00
|
|
|
qint64 RoundFreq(qint64 freq, int resolution);
|
|
|
|
|
|
|
|
QPixmap m_WaterfallPixmap;
|
|
|
|
QPixmap m_2DPixmap;
|
|
|
|
QPixmap m_ScalePixmap;
|
2012-09-29 21:03:18 -04:00
|
|
|
QPixmap m_OverlayPixmap;
|
|
|
|
// QPixmap m_LowerScalePixmap;
|
2012-05-22 13:09:48 -04:00
|
|
|
QSize m_Size;
|
|
|
|
QString m_Str;
|
|
|
|
QString m_HDivText[483];
|
2013-07-08 09:17:22 -04:00
|
|
|
QString m_mode;
|
|
|
|
QString m_modeTx;
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
bool m_Running;
|
|
|
|
bool m_paintEventBusy;
|
2013-07-08 09:17:22 -04:00
|
|
|
bool m_dataFromDisk;
|
|
|
|
|
2012-09-24 19:36:38 -04:00
|
|
|
double m_fGreen;
|
2012-09-29 13:52:35 -04:00
|
|
|
double m_fftBinWidth;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2012-09-24 19:36:38 -04:00
|
|
|
qint64 m_StartFreq;
|
2013-07-08 09:17:22 -04:00
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
qint32 m_dBStepSize;
|
|
|
|
qint32 m_FreqUnits;
|
|
|
|
qint32 m_hdivs;
|
|
|
|
qint32 m_line;
|
|
|
|
qint32 m_fSample;
|
|
|
|
qint32 m_i0;
|
|
|
|
qint32 m_xClick;
|
2012-09-29 13:09:05 -04:00
|
|
|
qint32 m_freqPerDiv;
|
|
|
|
qint32 m_nsps;
|
2012-09-29 21:03:18 -04:00
|
|
|
qint32 m_Percent2DScreen;
|
|
|
|
qint32 m_h;
|
|
|
|
qint32 m_h1;
|
|
|
|
qint32 m_h2;
|
2012-11-14 10:30:21 -05:00
|
|
|
qint32 m_TRperiod;
|
2013-07-08 09:17:22 -04:00
|
|
|
qint32 m_rxFreq;
|
2012-11-23 11:05:50 -05:00
|
|
|
qint32 m_txFreq;
|
2013-04-03 12:44:31 -04:00
|
|
|
qint32 m_fMin;
|
|
|
|
qint32 m_fMax;
|
2012-05-22 13:09:48 -04:00
|
|
|
|
2013-07-08 09:17:22 -04:00
|
|
|
char m_sutc[6];
|
|
|
|
|
2012-05-22 13:09:48 -04:00
|
|
|
private slots:
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLOTTER_H
|