| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  | // Copyright (C) 2017 F4EXB                                                      //
 | 
					
						
							|  |  |  | // written by Edouard Griffiths                                                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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                  //
 | 
					
						
							|  |  |  | //                                                                               //
 | 
					
						
							|  |  |  | // 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 SDRBASE_GUI_GLSCOPENGGUI_H_
 | 
					
						
							|  |  |  | #define SDRBASE_GUI_GLSCOPENGGUI_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  | #include <QComboBox>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | #include "dsp/dsptypes.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | #include "util/message.h"
 | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  | #include "dsp/scopevisng.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-03 23:28:04 +02:00
										 |  |  | #include "settings/serializable.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Ui { | 
					
						
							|  |  |  |     class GLScopeNGGUI; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class MessageQueue; | 
					
						
							|  |  |  | class GLScopeNG; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-03 20:23:38 +01:00
										 |  |  | class SDRGUI_API GLScopeNGGUI : public QWidget, public Serializable { | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2017-03-21 11:24:03 +01:00
										 |  |  |     enum DisplayMode { | 
					
						
							|  |  |  |         DisplayXYH, | 
					
						
							|  |  |  |         DisplayXYV, | 
					
						
							|  |  |  |         DisplayX, | 
					
						
							|  |  |  |         DisplayY, | 
					
						
							|  |  |  |         DisplayPol | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  |     explicit GLScopeNGGUI(QWidget* parent = 0); | 
					
						
							|  |  |  |     ~GLScopeNGGUI(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setBuddies(MessageQueue* messageQueue, ScopeVisNG* scopeVis, GLScopeNG* glScope); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void setSampleRate(int sampleRate); | 
					
						
							|  |  |  |     void resetToDefaults(); | 
					
						
							| 
									
										
										
										
											2017-10-03 23:28:04 +02:00
										 |  |  |     virtual QByteArray serialize() const; | 
					
						
							|  |  |  |     virtual bool deserialize(const QByteArray& data); | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool handleMessage(Message* message); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-21 11:24:03 +01:00
										 |  |  |     // preconfiguration methods
 | 
					
						
							|  |  |  |     // global (first line):
 | 
					
						
							|  |  |  |     void setDisplayMode(DisplayMode displayMode); | 
					
						
							|  |  |  |     void setTraceIntensity(int value); | 
					
						
							|  |  |  |     void setGridIntensity(int value); | 
					
						
							|  |  |  |     void setTimeBase(int step); | 
					
						
							|  |  |  |     void setTimeOffset(int step); | 
					
						
							|  |  |  |     void setTraceLength(int step); | 
					
						
							|  |  |  |     void setPreTrigger(int step); | 
					
						
							|  |  |  |     // trace (second line):
 | 
					
						
							|  |  |  |     void changeTrace(int traceIndex, const ScopeVisNG::TraceData& traceData); | 
					
						
							|  |  |  |     void addTrace(const ScopeVisNG::TraceData& traceData); | 
					
						
							|  |  |  |     void focusOnTrace(int traceIndex); | 
					
						
							|  |  |  |     // trigger (third line):
 | 
					
						
							|  |  |  |     void changeTrigger(int triggerIndex, const ScopeVisNG::TriggerData& triggerData); | 
					
						
							|  |  |  |     void addTrigger(const ScopeVisNG::TriggerData& triggerData); | 
					
						
							|  |  |  |     void focusOnTrigger(int triggerIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2017-02-20 01:21:52 +01:00
										 |  |  |     class TrigUIBlocker | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         TrigUIBlocker(Ui::GLScopeNGGUI *ui); | 
					
						
							|  |  |  |         ~TrigUIBlocker(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         void unBlock(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         Ui::GLScopeNGGUI *m_ui; | 
					
						
							|  |  |  |         bool m_oldStateTrigMode; | 
					
						
							|  |  |  |         bool m_oldStateTrigCount; | 
					
						
							|  |  |  |         bool m_oldStateTrigPos; | 
					
						
							|  |  |  |         bool m_oldStateTrigNeg; | 
					
						
							|  |  |  |         bool m_oldStateTrigBoth; | 
					
						
							|  |  |  |         bool m_oldStateTrigLevelCoarse; | 
					
						
							|  |  |  |         bool m_oldStateTrigLevelFine; | 
					
						
							|  |  |  |         bool m_oldStateTrigDelayCoarse; | 
					
						
							|  |  |  |         bool m_oldStateTrigDelayFine; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class TraceUIBlocker | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         TraceUIBlocker(Ui::GLScopeNGGUI *ui); | 
					
						
							|  |  |  |         ~TraceUIBlocker(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         void unBlock(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         Ui::GLScopeNGGUI *m_ui; | 
					
						
							| 
									
										
										
										
											2017-02-20 22:19:50 +01:00
										 |  |  |         bool m_oldStateTrace; | 
					
						
							|  |  |  |         bool m_oldStateTraceAdd; | 
					
						
							|  |  |  |         bool m_oldStateTraceDel; | 
					
						
							| 
									
										
										
										
											2017-02-20 01:21:52 +01:00
										 |  |  |         bool m_oldStateTraceMode; | 
					
						
							|  |  |  |         bool m_oldStateAmp; | 
					
						
							|  |  |  |         bool m_oldStateOfsCoarse; | 
					
						
							|  |  |  |         bool m_oldStateOfsFine; | 
					
						
							|  |  |  |         bool m_oldStateTraceDelayCoarse; | 
					
						
							|  |  |  |         bool m_oldStateTraceDelayFine; | 
					
						
							|  |  |  |         bool m_oldStateTraceColor; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class MainUIBlocker | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |     public: | 
					
						
							|  |  |  |         MainUIBlocker(Ui::GLScopeNGGUI *ui); | 
					
						
							|  |  |  |         ~MainUIBlocker(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         void unBlock(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private: | 
					
						
							|  |  |  |         Ui::GLScopeNGGUI *m_ui; | 
					
						
							|  |  |  |         bool m_oldStateOnlyX; | 
					
						
							|  |  |  |         bool m_oldStateOnlyY; | 
					
						
							|  |  |  |         bool m_oldStateHorizontalXY; | 
					
						
							|  |  |  |         bool m_oldStateVerticalXY; | 
					
						
							|  |  |  |         bool m_oldStatePolar; | 
					
						
							|  |  |  | //        bool m_oldStateTime;
 | 
					
						
							|  |  |  | //        bool m_oldStateTimeOfs;
 | 
					
						
							|  |  |  | //        bool m_oldStateTraceLen;
 | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  |     Ui::GLScopeNGGUI* ui; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     MessageQueue* m_messageQueue; | 
					
						
							|  |  |  |     ScopeVisNG* m_scopeVis; | 
					
						
							|  |  |  |     GLScopeNG* m_glScope; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int m_sampleRate; | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  |     int m_timeBase; | 
					
						
							|  |  |  |     int m_timeOffset; | 
					
						
							|  |  |  |     int m_traceLenMult; | 
					
						
							| 
									
										
										
										
											2017-02-11 20:44:00 +01:00
										 |  |  |     QColor m_focusedTraceColor; | 
					
						
							| 
									
										
										
										
											2017-02-12 02:12:06 +01:00
										 |  |  |     QColor m_focusedTriggerColor; | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     static const double amps[11]; | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void applySettings(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     // First row
 | 
					
						
							| 
									
										
										
										
											2017-02-09 18:44:20 +01:00
										 |  |  |     void setTraceIndexDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  |     void setTimeScaleDisplay(); | 
					
						
							|  |  |  |     void setTraceLenDisplay(); | 
					
						
							|  |  |  |     void setTimeOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     // Second row
 | 
					
						
							| 
									
										
										
										
											2017-02-05 13:26:07 +01:00
										 |  |  |     void setAmpScaleDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void setAmpOfsDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-17 01:54:55 +01:00
										 |  |  |     void setTraceDelayDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     // Third row
 | 
					
						
							| 
									
										
										
										
											2017-02-09 18:44:20 +01:00
										 |  |  |     void setTrigIndexDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-10 04:35:08 +01:00
										 |  |  |     void setTrigCountDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  | 	void setTrigLevelDisplay(); | 
					
						
							|  |  |  | 	void setTrigDelayDisplay(); | 
					
						
							|  |  |  | 	void setTrigPreDisplay(); | 
					
						
							| 
									
										
										
										
											2017-02-05 13:26:07 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void changeCurrentTrace(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void changeCurrentTrigger(); | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void fillTraceData(ScopeVisNG::TraceData& traceData); | 
					
						
							|  |  |  |     void fillTriggerData(ScopeVisNG::TriggerData& triggerData); | 
					
						
							| 
									
										
										
										
											2017-03-21 11:24:03 +01:00
										 |  |  |     void setTriggerUI(const ScopeVisNG::TriggerData& triggerData); | 
					
						
							|  |  |  |     void setTraceUI(const ScopeVisNG::TraceData& traceData); | 
					
						
							| 
									
										
										
										
											2017-02-05 04:41:32 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     void fillProjectionCombo(QComboBox* comboBox); | 
					
						
							| 
									
										
										
										
											2017-02-23 08:18:03 +01:00
										 |  |  |     void disableLiveMode(bool disable); | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 22:52:38 +01:00
										 |  |  | private slots: | 
					
						
							|  |  |  |     void on_scope_sampleRateChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-06 02:40:31 +01:00
										 |  |  |     // First row
 | 
					
						
							| 
									
										
										
										
											2017-02-03 08:27:03 +01:00
										 |  |  |     void on_onlyX_toggled(bool checked); | 
					
						
							|  |  |  |     void on_onlyY_toggled(bool checked); | 
					
						
							|  |  |  |     void on_horizontalXY_toggled(bool checked); | 
					
						
							|  |  |  |     void on_verticalXY_toggled(bool checked); | 
					
						
							|  |  |  |     void on_polar_toggled(bool checked); | 
					
						
							|  |  |  |     void on_traceIntensity_valueChanged(int value); | 
					
						
							|  |  |  |     void on_gridIntensity_valueChanged(int value); | 
					
						
							|  |  |  |     void on_time_valueChanged(int value); | 
					
						
							|  |  |  |     void on_timeOfs_valueChanged(int value); | 
					
						
							|  |  |  |     void on_traceLen_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-06 02:40:31 +01:00
										 |  |  |     // Second row
 | 
					
						
							| 
									
										
										
										
											2017-02-13 01:32:02 +01:00
										 |  |  |     void on_trace_valueChanged(int value); | 
					
						
							|  |  |  |     void on_traceAdd_clicked(bool checked); | 
					
						
							|  |  |  |     void on_traceDel_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-26 11:26:23 +01:00
										 |  |  |     void on_traceUp_clicked(bool checked); | 
					
						
							|  |  |  |     void on_traceDown_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-05 13:26:07 +01:00
										 |  |  |     void on_traceMode_currentIndexChanged(int index); | 
					
						
							|  |  |  |     void on_amp_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void on_ofsCoarse_valueChanged(int value); | 
					
						
							|  |  |  |     void on_ofsFine_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-17 01:54:55 +01:00
										 |  |  |     void on_traceDelayCoarse_valueChanged(int value); | 
					
						
							|  |  |  |     void on_traceDelayFine_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-26 22:27:03 +01:00
										 |  |  |     void on_traceView_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-11 20:44:00 +01:00
										 |  |  |     void on_traceColor_clicked(); | 
					
						
							| 
									
										
										
										
											2017-02-23 08:18:03 +01:00
										 |  |  |     void on_mem_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-06 02:40:31 +01:00
										 |  |  |     // Third row
 | 
					
						
							| 
									
										
										
										
											2017-02-10 02:45:49 +01:00
										 |  |  |     void on_trig_valueChanged(int value); | 
					
						
							|  |  |  |     void on_trigAdd_clicked(bool checked); | 
					
						
							|  |  |  |     void on_trigDel_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-26 19:14:27 +01:00
										 |  |  |     void on_trigUp_clicked(bool checked); | 
					
						
							|  |  |  |     void on_trigDown_clicked(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void on_trigMode_currentIndexChanged(int index); | 
					
						
							|  |  |  |     void on_trigCount_valueChanged(int value); | 
					
						
							|  |  |  |     void on_trigPos_toggled(bool checked); | 
					
						
							|  |  |  |     void on_trigNeg_toggled(bool checked); | 
					
						
							|  |  |  |     void on_trigBoth_toggled(bool checked); | 
					
						
							|  |  |  |     void on_trigLevelCoarse_valueChanged(int value); | 
					
						
							|  |  |  |     void on_trigLevelFine_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-09 22:22:56 +01:00
										 |  |  |     void on_trigDelayCoarse_valueChanged(int value); | 
					
						
							|  |  |  |     void on_trigDelayFine_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void on_trigPre_valueChanged(int value); | 
					
						
							| 
									
										
										
										
											2017-02-12 02:12:06 +01:00
										 |  |  |     void on_trigColor_clicked(); | 
					
						
							| 
									
										
										
										
											2017-02-06 18:40:15 +01:00
										 |  |  |     void on_trigOneShot_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2017-02-06 02:40:31 +01:00
										 |  |  |     void on_freerun_toggled(bool checked); | 
					
						
							| 
									
										
										
										
											2017-01-29 19:51:45 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SDRBASE_GUI_GLSCOPENGGUI_H_ */
 |