Fixes the replotting update. It's now based on a QTimer so it's in the event buffer...
[debian/gnuradio] / gr-qtgui / src / lib / spectrumdisplayform.h
1 #ifndef SPECTRUM_DISPLAY_FORM_H
2 #define SPECTRUM_DISPLAY_FORM_H
3
4 #include "spectrumdisplayform_ui.h"
5
6 class SpectrumGUIClass;
7 #include <SpectrumGUIClass.h>
8
9 #include <SpectrumGUIClass.h>
10 #include <FrequencyDisplayPlot.h>
11 #include <WaterfallDisplayPlot.h>
12 #include <Waterfall3DDisplayPlot.h>
13 #include <TimeDomainDisplayPlot.h>
14 #include <ConstellationDisplayPlot.h>
15 #include <QValidator>
16 #include <QTimer>
17 #include <vector>
18
19 class SpectrumDisplayForm : public QWidget, public Ui::SpectrumDisplayForm
20 {
21   Q_OBJECT
22
23   public:
24   SpectrumDisplayForm(bool useOpenGL = true, QWidget* parent = 0);
25   ~SpectrumDisplayForm();
26   
27   void setSystem( SpectrumGUIClass * newSystem, const uint64_t numFFTDataPoints,
28                   const uint64_t numTimeDomainDataPoints );
29
30   int GetAverageCount();
31   void SetAverageCount( const int newCount );
32   void Reset();
33   void AverageDataReset();
34   void ResizeBuffers( const uint64_t numFFTDataPoints,
35                       const uint64_t numTimeDomainDataPoints );
36   
37 public slots:
38   void resizeEvent( QResizeEvent * e );
39   void customEvent( QEvent * e );
40   void AvgLineEdit_valueChanged( int valueString );
41   void MaxHoldCheckBox_toggled( bool newState );
42   void MinHoldCheckBox_toggled( bool newState );
43   void MinHoldResetBtn_clicked();
44   void MaxHoldResetBtn_clicked();
45   void TabChanged(int index);
46
47   void SetFrequencyRange( const double newCenterFrequency,
48                           const double newStartFrequency,
49                           const double newStopFrequency );
50   void closeEvent( QCloseEvent * e );
51   void WindowTypeChanged( int newItem );
52   void UseRFFrequenciesCB( bool useRFFlag );
53   void waterfallMaximumIntensityChangedCB(double);
54   void waterfallMinimumIntensityChangedCB(double);
55   void WaterfallIntensityColorTypeChanged(int);
56   void WaterfallAutoScaleBtnCB();
57   void waterfall3DMaximumIntensityChangedCB(double);
58   void waterfall3DMinimumIntensityChangedCB(double);
59   void Waterfall3DIntensityColorTypeChanged(int);
60   void Waterfall3DAutoScaleBtnCB();
61   void FFTComboBoxSelectedCB(const QString&);
62
63   void ToggleTabFrequency(const bool state);
64   void ToggleTabWaterfall(const bool state);
65   void ToggleTabWaterfall3D(const bool state);
66   void ToggleTabTime(const bool state);
67   void ToggleTabConstellation(const bool state);
68
69   void SetTimeDomainAxis(double min, double max);
70   void SetConstellationAxis(double xmin, double xmax,
71                             double ymin, double ymax);
72   void SetConstellationPenSize(int size);
73   void SetFrequencyAxis(double min, double max);
74   void SetUpdateTime(double t);
75
76 private slots:
77   void newFrequencyData( const SpectrumUpdateEvent* );
78   void UpdateGuiTimer();
79
80 protected:
81
82 private:
83   void _AverageHistory( const double * newBuffer );
84
85   bool _useOpenGL;
86   int _historyEntryCount;
87   int _historyEntry;
88   std::vector<double*>* _historyVector;
89   double* _averagedValues;
90   uint64_t _numRealDataPoints;
91   double* _realFFTDataPoints;
92   QIntValidator* _intValidator;
93   FrequencyDisplayPlot* _frequencyDisplayPlot;
94   WaterfallDisplayPlot* _waterfallDisplayPlot;
95   Waterfall3DDisplayPlot* _waterfall3DDisplayPlot;
96   TimeDomainDisplayPlot* _timeDomainDisplayPlot;
97   ConstellationDisplayPlot* _constellationDisplayPlot;
98   SpectrumGUIClass* _system;
99   bool _systemSpecifiedFlag;
100   double _centerFrequency;
101   double _startFrequency;
102   double _noiseFloorAmplitude;
103   double _peakFrequency;
104   double _peakAmplitude;
105   static int _openGLWaterfall3DFlag;
106   double _stopFrequency;
107   
108   //SpectrumUpdateEvent _lastSpectrumEvent;
109   
110   // whether or not to use a particular display
111   int d_plot_fft;
112   int d_plot_waterfall;
113   int d_plot_waterfall3d;
114   int d_plot_time;
115   int d_plot_constellation;
116
117   QTimer *displayTimer;
118   double d_update_time;
119 };
120
121 #endif /* SPECTRUM_DISPLAY_FORM_H */