mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-04-01 12:45:36 -04:00
Added optional scrollbar to be able to scroll back through waterfall.
When scrolling is enabled:
Can adjust power scale for complete waterfall, not just future spectra.
Waterfall time axis can use local time or UTC.
Waterfall not lost when resizing window.
Can now zoom when device is stopped.
Added Min averaging type.
Added button to load spectrum from .csv file.
Add button to save spectrum/waterfall to .png or jpg.
Changed show all controls button to a combobox with choices of Min/Std/All (Minimum/Standard/All).
Changed some buttons in spectrum GUI from QPushButton to QToolButton so their size matches the others.
Fix spectrum from displaying a mixture of old and new spectrums (m_currentSpectrum was a pointer to SpectrumVis buffer).
Added M1 and M2 memories to allow display of reference spectra.
Added math operations to allow spectrum to be difference of current spectrum and either memory or a moving average.
Fixed measurement counts, so they are performed once per spectrum, not on displayed spectra.
Added spectrum mask measurement, to check when a spectrum exceeds mask held in M1 or M2.
Optionally display power/frequency under cursor in status line.
Optionally display peak power/frequency in status line.
Fix incorrect nyquist sample replication, when zoom used.
Fix cursor not changing from resize to pointer when moving over spectrum measurements window.
Add spectrum colour setting.
174 lines
6.7 KiB
C++
174 lines
6.7 KiB
C++
///////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
|
// written by Christian Daniel //
|
|
// Copyright (C) 2015-2018, 2020-2022 Edouard Griffiths, F4EXB <f4exb06@gmail.com> //
|
|
// Copyright (C) 2018 beta-tester <alpha-beta-release@gmx.net> //
|
|
// Copyright (C) 2022-2023 Jon Beniston, M7RCE <jon@beniston.com> //
|
|
// //
|
|
// 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/>. //
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef INCLUDE_GLSPECTRUMGUI_H
|
|
#define INCLUDE_GLSPECTRUMGUI_H
|
|
|
|
#include <QWidget>
|
|
#include <QComboBox>
|
|
#include <QMenu>
|
|
|
|
#include "dsp/dsptypes.h"
|
|
#include "dsp/spectrumsettings.h"
|
|
#include "export.h"
|
|
#include "settings/serializable.h"
|
|
#include "util/messagequeue.h"
|
|
|
|
namespace Ui {
|
|
class GLSpectrumGUI;
|
|
}
|
|
|
|
class SpectrumVis;
|
|
class GLSpectrum;
|
|
class SpectrumMarkersDialog;
|
|
|
|
class SDRGUI_API GLSpectrumGUI : public QWidget, public Serializable {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit GLSpectrumGUI(QWidget* parent = NULL);
|
|
~GLSpectrumGUI();
|
|
|
|
void setBuddies(SpectrumVis* spectrumVis, GLSpectrum* glSpectrum);
|
|
void setFFTSize(int log2FFTSize);
|
|
|
|
void resetToDefaults();
|
|
virtual QByteArray serialize() const;
|
|
virtual bool deserialize(const QByteArray& data);
|
|
virtual void formatTo(SWGSDRangel::SWGObject *swgObject) const;
|
|
virtual void updateFrom(const QStringList& keys, const SWGSDRangel::SWGObject *swgObject);
|
|
void updateSettings();
|
|
|
|
private:
|
|
Ui::GLSpectrumGUI* ui;
|
|
|
|
SpectrumVis* m_spectrumVis;
|
|
GLSpectrum* m_glSpectrum;
|
|
MessageQueue m_messageQueue;
|
|
SpectrumSettings m_settings;
|
|
bool m_doApplySettings;
|
|
Real m_calibrationShiftdB;
|
|
static const int m_fpsMs[];
|
|
SpectrumMarkersDialog *m_markersDialog;
|
|
QMenu *m_contextMenu;
|
|
|
|
void blockApplySettings(bool block);
|
|
void applySettings();
|
|
void applySpectrumSettings();
|
|
void setPowerAndRefRange();
|
|
void displaySettings();
|
|
void displayControls();
|
|
void setAveragingCombo();
|
|
void setNumberStr(int n, QString& s);
|
|
void setNumberStr(float v, int decimalPlaces, QString& s);
|
|
void setAveragingToolitp();
|
|
void setFFTSizeToolitp();
|
|
void setMaximumOverlap();
|
|
bool handleMessage(const Message& message);
|
|
void displayGotoMarkers();
|
|
QString displayScaled(int64_t value, char type, int precision, bool showMult);
|
|
void setMathMemory();
|
|
void convertSpectrum(QList<Real> &spectrum, bool fromDB, bool toDB) const;
|
|
void memContextMenu(int memoryIdx, const QPoint &p);
|
|
void loadMem(int memoryIdx);
|
|
void saveMem(int memoryIdx);
|
|
void updateMem(int memoryIdx);
|
|
void applyOffsetToMem(int memoryIdx);
|
|
void smoothMem(int memoryIdx);
|
|
void addMem(int memoryIdx);
|
|
void diffMem(int memoryIdx);
|
|
int findEquivalentText(QComboBox *combo, int value);
|
|
|
|
private slots:
|
|
void on_fftWindow_currentIndexChanged(int index);
|
|
void on_fftSize_currentIndexChanged(int index);
|
|
void on_fftOverlap_valueChanged(int value);
|
|
void on_autoscale_clicked(bool checked);
|
|
void on_refLevel_valueChanged(int value);
|
|
void on_levelRange_valueChanged(int value);
|
|
void on_fps_currentIndexChanged(int index);
|
|
void on_decay_valueChanged(int index);
|
|
void on_decayDivisor_valueChanged(int index);
|
|
void on_stroke_valueChanged(int index);
|
|
void on_spectrogramStyle_currentIndexChanged(int index);
|
|
void on_colorMap_currentIndexChanged(int index);
|
|
void on_gridIntensity_valueChanged(int index);
|
|
void on_truncateScale_toggled(bool checked);
|
|
void on_traceIntensity_valueChanged(int index);
|
|
void on_averagingMode_currentIndexChanged(int index);
|
|
void on_averaging_currentIndexChanged(int index);
|
|
void on_mathMode_currentIndexChanged(int index);
|
|
void on_mathAvgCount_currentIndexChanged(int index);
|
|
void on_mathAvgCount_editingFinished();
|
|
void on_linscale_toggled(bool checked);
|
|
void on_wsSpectrum_toggled(bool checked);
|
|
void on_markers_clicked(bool checked);
|
|
void on_load_clicked(bool checked);
|
|
void on_save_clicked(bool checked);
|
|
void on_saveImage_clicked(bool checked);
|
|
|
|
void on_waterfall_toggled(bool checked);
|
|
void on_spectrogram_toggled(bool checked);
|
|
void on_histogram_toggled(bool checked);
|
|
void on_maxHold_toggled(bool checked);
|
|
void on_currentLine_toggled(bool checked);
|
|
void on_currentFill_toggled(bool checked);
|
|
void on_currentGradient_toggled(bool checked);
|
|
void on_invertWaterfall_toggled(bool checked);
|
|
void on_grid_toggled(bool checked);
|
|
void on_clearSpectrum_clicked(bool checked);
|
|
void on_freeze_toggled(bool checked);
|
|
void on_calibration_toggled(bool checked);
|
|
void on_gotoMarker_currentIndexChanged(int index);
|
|
void on_showControls_currentIndexChanged(int index);
|
|
|
|
void on_measure_clicked(bool checked);
|
|
void on_resetMeasurements_clicked(bool checked);
|
|
|
|
void handleInputMessages();
|
|
void openWebsocketSpectrumSettingsDialog(const QPoint& p);
|
|
void openCalibrationPointsDialog(const QPoint& p);
|
|
|
|
void updateHistogramMarkers();
|
|
void updateWaterfallMarkers();
|
|
void updateAnnotationMarkers();
|
|
void updateMarkersDisplay();
|
|
void updateCalibrationPoints();
|
|
void updateMeasurements();
|
|
void closeMarkersDialog();
|
|
|
|
void on_showSettingsDialog_clicked(bool checked=false);
|
|
void on_mem1_clicked(bool checked=false);
|
|
void on_mem2_clicked(bool checked=false);
|
|
void mem1ContextMenu(const QPoint &p);
|
|
void mem2ContextMenu(const QPoint &p);
|
|
|
|
signals:
|
|
// Emitted when user selects an annotation marker
|
|
void requestCenterFrequency(qint64 frequency);
|
|
};
|
|
|
|
#endif // INCLUDE_GLSPECTRUMGUI_H
|