1 /* -*- c++ -*- */
2 /*
3  * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
4  *           https://gqrx.dk/
5  *
6  * Copyright 2011-2016 Alexandru Csete OZ9AEC.
7  *
8  * Gqrx is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3, or (at your option)
11  * any later version.
12  *
13  * Gqrx is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Gqrx; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street,
21  * Boston, MA 02110-1301, USA.
22  */
23 #ifndef DOCKFFT_H
24 #define DOCKFFT_H
25 
26 #include <QDockWidget>
27 #include <QSettings>
28 
29 namespace Ui {
30     class DockFft;
31 }
32 
33 /*! \brief Dock widget with FFT settings. */
34 class DockFft : public QDockWidget
35 {
36     Q_OBJECT
37 
38 public:
39     explicit DockFft(QWidget *parent = 0);
40     ~DockFft();
41 
42     int fftRate();
43     int setFftRate(int fft_rate);
44 
45     int fftSize();
46     int setFftSize(int fft_size);
47 
48     void setSampleRate(float sample_rate);
49 
50     void saveSettings(QSettings *settings);
51     void readSettings(QSettings *settings);
52 
53 signals:
54     void fftSizeChanged(int size);                 /*! FFT size changed. */
55     void fftRateChanged(int fps);                  /*! FFT rate changed. */
56     void fftWindowChanged(int window);             /*! FFT window type changed */
57     void wfSpanChanged(quint64 span_ms);           /*! Waterfall span changed. */
58     void fftSplitChanged(int pct);                 /*! Split between pandapter and waterfall changed. */
59     void fftZoomChanged(float level);              /*! Zoom level slider changed. */
60     void fftAvgChanged(float gain);                /*! FFT video filter gain has changed. */
61     void pandapterRangeChanged(float min, float max);
62     void waterfallRangeChanged(float min, float max);
63     void resetFftZoom(void);                       /*! FFT zoom reset. */
64     void gotoFftCenter(void);                      /*! Go to FFT center. */
65     void gotoDemodFreq(void);                      /*! Center FFT around demodulator frequency. */
66     void fftColorChanged(const QColor &);          /*! FFT color has changed. */
67     void fftFillToggled(bool fill);                /*! Toggle filling area under FFT plot. */
68     void fftPeakHoldToggled(bool enable);          /*! Toggle peak hold in FFT area. */
69     void peakDetectionToggled(bool enabled);       /*! Enable peak detection in FFT plot */
70     void bandPlanChanged(bool enabled);            /*! Toggle Band Plan at bottom of FFT area. */
71     void wfColormapChanged(const QString &cmap);
72 
73 public slots:
74     void setPandapterRange(float min, float max);
75     void setWaterfallRange(float min, float max);
76     void setWfResolution(quint64 msec_per_line);
77     void setZoomLevel(float level);
78 
79 private slots:
80     void on_fftSizeComboBox_currentIndexChanged(const QString & text);
81     void on_fftRateComboBox_currentIndexChanged(const QString & text);
82     void on_fftWinComboBox_currentIndexChanged(int index);
83     void on_wfSpanComboBox_currentIndexChanged(int index);
84     void on_fftSplitSlider_valueChanged(int value);
85     void on_fftAvgSlider_valueChanged(int value);
86     void on_fftZoomSlider_valueChanged(int level);
87     void on_pandRangeSlider_valuesChanged(int min, int max);
88     void on_wfRangeSlider_valuesChanged(int min, int max);
89     void on_resetButton_clicked(void);
90     void on_centerButton_clicked(void);
91     void on_demodButton_clicked(void);
92     void on_colorPicker_colorChanged(const QColor &);
93     void on_fillButton_toggled(bool checked);
94     void on_peakHoldButton_toggled(bool checked);
95     void on_peakDetectionButton_toggled(bool checked);
96     void on_lockButton_toggled(bool checked);
97     void on_bandPlanCheckbox_stateChanged(int state);
98     void on_cmapComboBox_currentIndexChanged(int index);
99 
100 private:
101     void updateInfoLabels(void);
102 
103 private:
104     Ui::DockFft   * ui;
105 //    float         m_maximumFftDb;
106 //    float         m_minimumFftDb;
107     float         m_sample_rate;
108     bool          m_pand_last_modified; /* Flag to indicate which slider was changed last */
109 };
110 
111 #endif // DOCKFFT_H
112