| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | // Copyright (C) 2018 F4HKW                                                      //
 | 
					
						
							|  |  |  |  | // for F4EXB / SDRAngel                                                          //
 | 
					
						
							|  |  |  |  | //                                                                               //
 | 
					
						
							|  |  |  |  | // 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                  //
 | 
					
						
							|  |  |  |  | //                                                                               //
 | 
					
						
							|  |  |  |  | // 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/>.          //
 | 
					
						
							|  |  |  |  | ///////////////////////////////////////////////////////////////////////////////////
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  | #ifndef INCLUDE_TVSCREEN_H
 | 
					
						
							|  |  |  |  | #define INCLUDE_TVSCREEN_H
 | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | #include <QGLWidget>
 | 
					
						
							|  |  |  |  | #include <QPen>
 | 
					
						
							|  |  |  |  | #include <QTimer>
 | 
					
						
							|  |  |  |  | #include <QMutex>
 | 
					
						
							|  |  |  |  | #include <QFont>
 | 
					
						
							|  |  |  |  | #include <QMatrix4x4>
 | 
					
						
							|  |  |  |  | #include "dsp/dsptypes.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  | #include "glshadertextured.h"
 | 
					
						
							|  |  |  |  | #include "glshadertvarray.h"
 | 
					
						
							| 
									
										
										
										
											2018-03-20 13:49:21 +01:00
										 |  |  |  | #include "export.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | #include "util/bitfieldindex.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | class QPainter; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-13 16:02:26 +01:00
										 |  |  |  | class SDRGUI_API TVScreen: public QGLWidget | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	Q_OBJECT | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  | 	TVScreen(bool blnColor, QWidget* parent = 0); | 
					
						
							| 
									
										
										
										
											2018-03-13 01:39:43 +01:00
										 |  |  |  |     virtual ~TVScreen(); | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 19:43:40 +01:00
										 |  |  |  |     void setColor(bool blnColor); | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  |     void resizeTVScreen(int intCols, int intRows); | 
					
						
							| 
									
										
										
										
											2018-03-12 05:07:51 +01:00
										 |  |  |  |     void getSize(int& intCols, int& intRows) const; | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  |     void renderImage(unsigned char * objData); | 
					
						
							|  |  |  |  |     QRgb* getRowBuffer(int intRow); | 
					
						
							|  |  |  |  |     void resetImage(); | 
					
						
							| 
									
										
										
										
											2018-03-13 01:39:43 +01:00
										 |  |  |  |     void resetImage(int alpha); | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     bool selectRow(int intLine); | 
					
						
							| 
									
										
										
										
											2018-03-12 20:39:16 +01:00
										 |  |  |  |     bool setDataColor(int intCol, int intRed, int intGreen, int intBlue); | 
					
						
							|  |  |  |  |     bool setDataColor(int intCol, int intRed, int intGreen, int intBlue, int intAlpha); | 
					
						
							| 
									
										
										
										
											2018-03-13 01:39:43 +01:00
										 |  |  |  |     void setAlphaBlend(bool blnAlphaBlend) { m_objGLShaderArray.setAlphaBlend(blnAlphaBlend); } | 
					
						
							|  |  |  |  |     void setAlphaReset() { m_objGLShaderArray.setAlphaReset(); } | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     void connectTimer(const QTimer& timer); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     //Valeurs par défaut
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  |     static const int TV_COLS=256; | 
					
						
							|  |  |  |  |     static const int TV_ROWS=256; | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | signals: | 
					
						
							|  |  |  |  | 	void traceSizeChanged(int); | 
					
						
							|  |  |  |  | 	void sampleRateChanged(int); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     bool m_blnGLContextInitialized; | 
					
						
							|  |  |  |  |     int m_intAskedCols; | 
					
						
							|  |  |  |  |     int m_intAskedRows; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// state
 | 
					
						
							|  |  |  |  |     QTimer m_objTimer; | 
					
						
							|  |  |  |  |     QMutex m_objMutex; | 
					
						
							|  |  |  |  |     bool m_blnDataChanged; | 
					
						
							|  |  |  |  |     bool m_blnConfigChanged; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 13:00:33 +01:00
										 |  |  |  |     GLShaderTVArray m_objGLShaderArray; | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-15 00:16:50 +01:00
										 |  |  |  |     int m_cols; | 
					
						
							|  |  |  |  |     int m_rows; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  |     void initializeGL(); | 
					
						
							|  |  |  |  | 	void resizeGL(int width, int height); | 
					
						
							|  |  |  |  | 	void paintGL(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	void mousePressEvent(QMouseEvent*); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  | 	unsigned char *m_chrLastData; | 
					
						
							| 
									
										
										
										
											2018-02-22 22:52:49 +01:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | protected slots: | 
					
						
							|  |  |  |  | 	void cleanup(); | 
					
						
							|  |  |  |  | 	void tick(); | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 16:39:02 +01:00
										 |  |  |  | #endif // INCLUDE_TVSCREEN_H
 |