1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
// -*- Mode: C++ -*-
///////////////////////////////////////////////////////////////////////////
// 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_
#include <QFrame>
#include <QSize>
#include <QImage>
#include <QVector>
#include <QColor>
#include <QToolTip>
#include "WaterfallScale.hpp"
#include "JttySpectrum.hpp"
#define VERT_DIVS 7 //specify grid screen divisions
extern bool g_single_decode;
class QAction;
class QPainter;
class CPlotter : public QFrame
{
Q_OBJECT
public:
explicit CPlotter(QWidget *parent = 0);
~CPlotter();
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize sizeHint() const Q_DECL_OVERRIDE;
void draw(float swide[], bool bScroll, bool bRed); //Update the waterfall
void drawTotalPower(float pdB);
void replot();
void SetRunningState(bool running);
void setPlotZero(int plotZero);
int plotZero();
void setPlotGain(int plotGain);
int plotGain();
int plot2dGain();
void setPlot2dGain(int n);
int plot2dZero();
void setPlot2dZero(int plot2dZero);
void setStartFreq(int f);
int startFreq();
int plotWidth();
void UpdateOverlay();
void setDataFromDisk(bool b);
void setBinsPerPixel(int n);
int binsPerPixel();
void setWaterfallAvg(int n);
void setRxFreq(int n);
void DrawOverlay();
int rxFreq();
void setFsample(int n);
void setNsps(double trperiod, int nsps);
void setTxFreq(int n);
void setMode(QString mode);
void setSubMode(int n);
void SetPercent2DScreen(int percent);
int Fmax();
void setDialFreq(double d);
void setCurrent(bool b) {m_bCurrent = b;}
bool current() const {return m_bCurrent;}
void setCumulative(bool b) {m_bCumulative = b;}
bool cumulative() const {return m_bCumulative;}
void setLinearAvg(bool b) {m_bLinearAvg = b;}
bool linearAvg() const {return m_bLinearAvg;}
void setBreadth(qint32 w) {m_scale.setWidth(w);}
qint32 breadth() const {return m_scale.width();}
float fSpan() const {return m_scale.spanHz();}
void setColours(QVector<QColor> const& cl);
void setTimestamp(int n);
void setBars(bool b);
void showFreq(bool b);
void setFlatten(bool b1, bool b2);
void setTol(int n);
void setSuperFox(bool b);
void setSuperHound(bool b);
void setRxBand(QString band);
void setReference(bool b) {m_bReference = b;}
bool Reference() const {return m_bReference;}
void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
bool Q65_Sync() const {return m_bQ65_Sync;}
void setTotalPower(bool b) {m_bTotalPower = b;}
bool TotalPower() const {return m_bTotalPower;}
void drawRed(int ia, int ib, float swide[]);
void setVHF(bool bVHF);
void setRedFile(QString fRed);
void setFST4_FreqRange(int fLow,int fHigh);
void setSingleDecode(bool b);
void setDiskUTC(int nutc);
void restartTotalPower();
bool scaleOK () const {return m_bScaleOK;}
void setDarkStyle(bool b);
void setJttyRow (JttyWaterfallRow const& row) { m_pendingJttyRow = row; }
void setJttySpectrum (std::array<float, JttySpectrumFrame::BinCount> const& cumulative,
std::array<float, JttySpectrumFrame::BinCount> const& linearAverage);
signals:
void freezeDecode1(int n);
void setFreq1(int rxFreq, int txFreq);
void jttyDecodeAgainAtSample (quint64 reception, qint64 endSample);
protected:
//re-implemented widget event handlers
void paintEvent(QPaintEvent *event) override;
void resizeEvent(QResizeEvent* event) override;
void mouseMoveEvent(QMouseEvent * event) override;
void mouseReleaseEvent (QMouseEvent * event) override;
void mouseDoubleClickEvent (QMouseEvent * event) override;
private:
int XfromFreq(float f);
float FreqfromX(int x);
void drawSavedWaterfall();
void drawJttyLabels (QPainter& painter, bool newestOnly);
QAction * m_set_freq_action;
bool m_bScaleOK;
bool m_bCurrent;
bool m_bCumulative;
bool m_bLinearAvg;
bool m_bReference;
bool m_bReference0;
bool m_bQ65_Sync;
bool m_bTotalPower=false;
bool m_bVHF;
bool m_bSingleDecode;
bool m_bFirst=true;
bool m_bResized;
bool m_bSuperFox=false;
bool m_bSuperHound=false;
bool m_bars;
bool m_freq=false;
float m_pdB=0.0;
float m_vpixperdiv;
bool m_useDarkStyle=false;
qint32 m_plotZero;
qint32 m_plotGain;
qint32 m_plot2dGain;
qint32 m_plot2dZero;
qint32 m_waterfallAvg;
qint32 m_Flatten;
qint32 m_nSubMode;
qint32 m_ia;
qint32 m_ib;
qint32 m_nfa;
qint32 m_nfb;
qint32 m_nUTC;
qint32 m_x=0;
qint32 m_timestamp;
QPixmap m_DialOverlayPixmap;
QPixmap m_HoverOverlayPixmap;
QPixmap m_WaterfallPixmap;
QPixmap m_2DPixmap;
QPixmap m_ScalePixmap;
QPixmap m_OverlayPixmap;
QPoint m_pos;
QSize m_Size;
QString m_Str;
QVector<float> m_swideDisplay;
QVector<float> m_savgDisplay;
QVector<float> m_replotRow;
struct JttyRowHistory {
JttyWaterfallRow audio;
bool timestamp = false;
};
QVector<JttyRowHistory> m_jttyRows;
JttyWaterfallRow m_pendingJttyRow;
std::array<float, JttySpectrumFrame::BinCount> m_jttyCumulative {};
std::array<float, JttySpectrumFrame::BinCount> m_jttyLinearAverage {};
int m_jttyRowsSinceTimestamp = 1000;
QString m_mode;
QString m_mode0;
QString m_rxBand;
QString m_redFile;
bool m_Running;
bool m_paintEventBusy;
bool m_dataFromDisk;
bool m_bReplot;
double m_dialFreq;
double m_TRperiod;
float m_sum[2048];
qint32 m_dBStepSize;
qint32 m_line;
qint32 m_fSample;
qint32 m_xClick;
qint32 m_nsps;
qint32 m_Percent2DScreen;
qint32 m_Percent2DScreen0;
qint32 m_h;
qint32 m_h1;
qint32 m_h2;
qint32 m_rxFreq;
qint32 m_rxFreq0=0;
qint32 m_txFreq;
qint32 m_tol;
qint32 m_lastMouseX;
qint32 m_lastPaintedX;
qint32 m_j;
char m_sutc[6];
WaterfallScale m_scale;
private slots:
void leaveEvent(QEvent *event) override;
};
extern QVector<QColor> g_ColorTbl;
#endif // PLOTTER_H
|