2020-04-30 21:12:01 -04: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 11:52:39 -04:00
# ifndef INCLUDE_GLSPECTRUMGUI_H
# define INCLUDE_GLSPECTRUMGUI_H
# include <QWidget>
2020-04-30 21:12:01 -04:00
2014-05-18 11:52:39 -04:00
# include "dsp/dsptypes.h"
2020-04-30 21:12:01 -04:00
# include "dsp/glspectrumsettings.h"
2018-03-20 08:49:21 -04:00
# include "export.h"
2017-10-01 11:54:48 -04:00
# include "settings/serializable.h"
2018-07-01 14:48:30 -04:00
# include "util/messagequeue.h"
2014-05-18 11:52:39 -04:00
namespace Ui {
class GLSpectrumGUI ;
}
class SpectrumVis ;
class GLSpectrum ;
2018-03-03 14:23:38 -05:00
class SDRGUI_API GLSpectrumGUI : public QWidget , public Serializable {
2014-05-18 11:52:39 -04:00
Q_OBJECT
public :
2018-06-30 16:30:42 -04:00
enum AveragingMode
{
2018-07-01 16:36:36 -04:00
AvgModeNone ,
2018-06-30 16:30:42 -04:00
AvgModeMoving ,
2018-10-12 02:47:14 -04:00
AvgModeFixed ,
AvgModeMax
2018-06-30 16:30:42 -04:00
} ;
2014-05-18 11:52:39 -04:00
explicit GLSpectrumGUI ( QWidget * parent = NULL ) ;
~ GLSpectrumGUI ( ) ;
2020-04-30 20:33:50 -04:00
void setBuddies ( SpectrumVis * spectrumVis , GLSpectrum * glSpectrum ) ;
void setFFTSize ( int log2FFTSize ) ;
2014-05-18 11:52:39 -04:00
void resetToDefaults ( ) ;
2017-10-01 11:54:48 -04:00
virtual QByteArray serialize ( ) const ;
virtual bool deserialize ( const QByteArray & data ) ;
2014-05-18 11:52:39 -04:00
private :
Ui : : GLSpectrumGUI * ui ;
SpectrumVis * m_spectrumVis ;
GLSpectrum * m_glSpectrum ;
2018-07-01 14:48:30 -04:00
MessageQueue m_messageQueue ;
2020-04-30 21:12:01 -04:00
GLSpectrumSettings m_settings ;
bool m_doApplySettings ;
2014-05-18 11:52:39 -04:00
2020-04-30 21:12:01 -04:00
void blockApplySettings ( bool block ) ;
2014-05-18 11:52:39 -04:00
void applySettings ( ) ;
2020-05-05 19:38:23 -04:00
void applyGLSpectrumSettings ( ) ;
2020-04-30 21:12:01 -04:00
void displaySettings ( ) ;
2020-04-30 23:33:44 -04:00
static int getAveragingMaxScale ( GLSpectrumSettings : : AveragingMode averagingMode ) ; //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
static int getAveragingIndex ( int averaging , GLSpectrumSettings : : AveragingMode averagingMode ) ;
static int getAveragingValue ( int averagingIndex , GLSpectrumSettings : : AveragingMode averagingMode ) ;
2018-06-30 18:55:30 -04:00
void setAveragingCombo ( ) ;
void setNumberStr ( int n , QString & s ) ;
2018-07-01 14:48:30 -04:00
void setNumberStr ( float v , int decimalPlaces , QString & s ) ;
void setAveragingToolitp ( ) ;
bool handleMessage ( const Message & message ) ;
2014-05-18 11:52:39 -04:00
private slots :
void on_fftWindow_currentIndexChanged ( int index ) ;
void on_fftSize_currentIndexChanged ( int index ) ;
2020-06-18 18:54:19 -04:00
void on_refLevel_valueChanged ( int value ) ;
void on_levelRange_valueChanged ( int value ) ;
2015-07-15 02:48:02 -04:00
void on_decay_valueChanged ( int index ) ;
2018-10-18 18:40:14 -04:00
void on_decayDivisor_valueChanged ( int index ) ;
2015-07-15 02:48:02 -04:00
void on_stroke_valueChanged ( int index ) ;
2015-05-12 09:49:03 -04:00
void on_gridIntensity_valueChanged ( int index ) ;
2015-07-18 11:53:57 -04:00
void on_traceIntensity_valueChanged ( int index ) ;
2018-06-30 16:30:42 -04:00
void on_averagingMode_currentIndexChanged ( int index ) ;
void on_averaging_currentIndexChanged ( int index ) ;
2018-07-04 17:11:28 -04:00
void on_linscale_toggled ( bool checked ) ;
2020-05-01 18:35:47 -04:00
void on_wsSpectrum_toggled ( bool checked ) ;
2014-05-18 11:52:39 -04:00
void on_waterfall_toggled ( bool checked ) ;
void on_histogram_toggled ( bool checked ) ;
void on_maxHold_toggled ( bool checked ) ;
2015-07-15 22:55:14 -04:00
void on_current_toggled ( bool checked ) ;
2020-11-10 10:38:12 -05:00
void on_invertWaterfall_toggled ( bool checked ) ;
2014-05-18 11:52:39 -04:00
void on_grid_toggled ( bool checked ) ;
2015-07-23 19:09:03 -04:00
void on_clearSpectrum_clicked ( bool checked ) ;
2020-07-05 04:03:41 -04:00
void on_freeze_toggled ( bool checked ) ;
2018-07-01 14:48:30 -04:00
void handleInputMessages ( ) ;
2020-05-01 05:06:56 -04:00
void openWebsocketSpectrumSettingsDialog ( const QPoint & p ) ;
2014-05-18 11:52:39 -04:00
} ;
# endif // INCLUDE_GLSPECTRUMGUI_H