| 
									
										
										
										
											2020-05-01 03:12:01 +02:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2016-2020 F4EXB                                                 //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // OpenGL interface modernization.                                               //
 | 
					
						
							|  |  |  | // See: http://doc.qt.io/qt-5/qopenglshaderprogram.html                          //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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                  //
 | 
					
						
							|  |  |  | // (at your option) any later version.                                           //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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/>.          //
 | 
					
						
							|  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #ifndef INCLUDE_GLSPECTRUMGUI_H
 | 
					
						
							|  |  |  | #define INCLUDE_GLSPECTRUMGUI_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							| 
									
										
										
										
											2020-05-01 03:12:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | #include "dsp/dsptypes.h"
 | 
					
						
							| 
									
										
										
										
											2021-04-20 10:32:21 +02:00
										 |  |  | #include "dsp/spectrumsettings.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-01 17:54:48 +02:00
										 |  |  | #include "settings/serializable.h"
 | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | #include "util/messagequeue.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  | 	class GLSpectrumGUI; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SpectrumVis; | 
					
						
							|  |  |  | class GLSpectrum; | 
					
						
							| 
									
										
										
										
											2022-09-29 15:25:04 +02:00
										 |  |  | class SpectrumMarkersDialog; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | class SDRGUI_API GLSpectrumGUI : public QWidget, public Serializable { | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2018-06-30 22:30:42 +02:00
										 |  |  |     enum AveragingMode | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2018-07-01 22:36:36 +02:00
										 |  |  |         AvgModeNone, | 
					
						
							| 
									
										
										
										
											2018-06-30 22:30:42 +02:00
										 |  |  |         AvgModeMoving, | 
					
						
							| 
									
										
										
										
											2018-10-12 08:47:14 +02:00
										 |  |  |         AvgModeFixed, | 
					
						
							|  |  |  |         AvgModeMax | 
					
						
							| 
									
										
										
										
											2018-06-30 22:30:42 +02:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	explicit GLSpectrumGUI(QWidget* parent = NULL); | 
					
						
							|  |  |  | 	~GLSpectrumGUI(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-29 13:48:04 +01:00
										 |  |  | 	void setBuddies(SpectrumVis* spectrumVis, GLSpectrum* glSpectrum); | 
					
						
							| 
									
										
										
										
											2020-05-01 02:33:50 +02:00
										 |  |  |     void setFFTSize(int log2FFTSize); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2017-10-01 17:54:48 +02:00
										 |  |  | 	virtual QByteArray serialize() const; | 
					
						
							|  |  |  | 	virtual bool deserialize(const QByteArray& data); | 
					
						
							| 
									
										
										
										
											2021-12-01 00:20:14 +01:00
										 |  |  |     virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const; | 
					
						
							|  |  |  |     virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject); | 
					
						
							|  |  |  | 	void updateSettings(); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  | 	Ui::GLSpectrumGUI* ui; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	SpectrumVis* m_spectrumVis; | 
					
						
							|  |  |  | 	GLSpectrum* m_glSpectrum; | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | 	MessageQueue m_messageQueue; | 
					
						
							| 
									
										
										
										
											2021-04-20 10:32:21 +02:00
										 |  |  |     SpectrumSettings m_settings; | 
					
						
							| 
									
										
										
										
											2020-05-01 03:12:01 +02:00
										 |  |  |     bool m_doApplySettings; | 
					
						
							| 
									
										
										
										
											2022-02-04 08:38:04 +01:00
										 |  |  | 	Real m_calibrationShiftdB; | 
					
						
							| 
									
										
										
										
											2021-02-12 00:53:18 +01:00
										 |  |  |     static const int m_fpsMs[]; | 
					
						
							| 
									
										
										
										
											2022-09-29 15:25:04 +02:00
										 |  |  |     SpectrumMarkersDialog *m_markersDialog; | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-01 03:12:01 +02:00
										 |  |  |     void blockApplySettings(bool block); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void applySettings(); | 
					
						
							| 
									
										
										
										
											2021-04-20 10:32:21 +02:00
										 |  |  |     void applySpectrumSettings(); | 
					
						
							| 
									
										
										
										
											2020-05-01 03:12:01 +02:00
										 |  |  |     void displaySettings(); | 
					
						
							| 
									
										
										
										
											2022-12-20 14:39:39 +00:00
										 |  |  |     void displayControls(); | 
					
						
							| 
									
										
										
										
											2018-07-01 00:55:30 +02:00
										 |  |  | 	void setAveragingCombo(); | 
					
						
							|  |  |  | 	void setNumberStr(int n, QString& s); | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | 	void setNumberStr(float v, int decimalPlaces, QString& s); | 
					
						
							|  |  |  | 	void setAveragingToolitp(); | 
					
						
							| 
									
										
										
										
											2021-04-21 07:20:56 +02:00
										 |  |  | 	void setFFTSizeToolitp(); | 
					
						
							| 
									
										
										
										
											2021-02-09 07:12:32 +01:00
										 |  |  | 	void setMaximumOverlap(); | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | 	bool handleMessage(const Message& message); | 
					
						
							| 
									
										
										
										
											2022-06-24 23:37:22 +01:00
										 |  |  |     void displayGotoMarkers(); | 
					
						
							|  |  |  |     QString displayScaled(int64_t value, char type, int precision, bool showMult); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private slots: | 
					
						
							|  |  |  | 	void on_fftWindow_currentIndexChanged(int index); | 
					
						
							|  |  |  | 	void on_fftSize_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2021-02-09 07:12:32 +01:00
										 |  |  | 	void on_fftOverlap_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2021-02-10 08:34:42 +01:00
										 |  |  | 	void on_autoscale_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2020-06-19 00:54:19 +02:00
										 |  |  | 	void on_refLevel_valueChanged(int value); | 
					
						
							|  |  |  | 	void on_levelRange_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2021-02-12 00:53:18 +01:00
										 |  |  | 	void on_fps_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2015-07-15 08:48:02 +02:00
										 |  |  | 	void on_decay_valueChanged(int index); | 
					
						
							| 
									
										
										
										
											2018-10-19 00:40:14 +02:00
										 |  |  | 	void on_decayDivisor_valueChanged(int index); | 
					
						
							| 
									
										
										
										
											2015-07-15 08:48:02 +02:00
										 |  |  | 	void on_stroke_valueChanged(int index); | 
					
						
							| 
									
										
										
										
											2022-06-18 12:35:44 +01:00
										 |  |  |     void on_spectrogramStyle_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2022-06-22 08:52:48 +01:00
										 |  |  |     void on_colorMap_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2015-05-12 15:49:03 +02:00
										 |  |  | 	void on_gridIntensity_valueChanged(int index); | 
					
						
							| 
									
										
										
										
											2022-10-16 04:48:07 +02:00
										 |  |  |     void on_truncateScale_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2015-07-18 17:53:57 +02:00
										 |  |  | 	void on_traceIntensity_valueChanged(int index); | 
					
						
							| 
									
										
										
										
											2018-06-30 22:30:42 +02:00
										 |  |  | 	void on_averagingMode_currentIndexChanged(int index); | 
					
						
							|  |  |  |     void on_averaging_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2018-07-04 23:11:28 +02:00
										 |  |  |     void on_linscale_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2020-05-02 00:35:47 +02:00
										 |  |  |     void on_wsSpectrum_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2021-07-31 22:57:31 +02:00
										 |  |  | 	void on_markers_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2022-09-26 13:30:58 +01:00
										 |  |  |     void on_save_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void on_waterfall_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2022-06-18 12:35:44 +01:00
										 |  |  | 	void on_spectrogram_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void on_histogram_toggled(bool checked); | 
					
						
							|  |  |  | 	void on_maxHold_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2022-06-23 21:22:35 +02:00
										 |  |  |     void on_currentLine_toggled(bool checked); | 
					
						
							|  |  |  |     void on_currentFill_toggled(bool checked); | 
					
						
							|  |  |  |     void on_currentGradient_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2020-11-10 16:38:12 +01:00
										 |  |  | 	void on_invertWaterfall_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | 	void on_grid_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2015-07-24 01:09:03 +02:00
										 |  |  | 	void on_clearSpectrum_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2020-07-05 10:03:41 +02:00
										 |  |  |     void on_freeze_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2022-02-04 08:38:04 +01:00
										 |  |  | 	void on_calibration_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2022-06-24 23:37:22 +01:00
										 |  |  |     void on_gotoMarker_currentIndexChanged(int index); | 
					
						
							| 
									
										
										
										
											2022-12-20 14:39:39 +00:00
										 |  |  |     void on_showAllControls_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-28 16:59:35 +01:00
										 |  |  |     void on_measure_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2023-01-15 12:01:37 +00:00
										 |  |  |     void on_resetMeasurements_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2022-09-25 10:50:56 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-01 20:48:30 +02:00
										 |  |  | 	void handleInputMessages(); | 
					
						
							| 
									
										
										
										
											2020-05-01 11:06:56 +02:00
										 |  |  |     void openWebsocketSpectrumSettingsDialog(const QPoint& p); | 
					
						
							| 
									
										
										
										
											2022-01-30 07:43:50 +01:00
										 |  |  | 	void openCalibrationPointsDialog(const QPoint& p); | 
					
						
							| 
									
										
										
										
											2021-08-01 10:03:58 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void updateHistogramMarkers(); | 
					
						
							|  |  |  | 	void updateWaterfallMarkers(); | 
					
						
							| 
									
										
										
										
											2022-01-21 00:18:41 +01:00
										 |  |  | 	void updateAnnotationMarkers(); | 
					
						
							|  |  |  | 	void updateMarkersDisplay(); | 
					
						
							| 
									
										
										
										
											2022-01-30 07:43:50 +01:00
										 |  |  | 	void updateCalibrationPoints(); | 
					
						
							| 
									
										
										
										
											2022-09-29 11:59:58 +01:00
										 |  |  |     void updateMeasurements(); | 
					
						
							| 
									
										
										
										
											2022-09-29 15:25:04 +02:00
										 |  |  |     void closeMarkersDialog(); | 
					
						
							| 
									
										
										
										
											2022-06-24 23:37:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | signals: | 
					
						
							|  |  |  |     // Emitted when user selects an annotation marker
 | 
					
						
							|  |  |  |     void requestCenterFrequency(qint64 frequency); | 
					
						
							| 
									
										
										
										
											2014-05-18 16:52:39 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // INCLUDE_GLSPECTRUMGUI_H
 |