2018-02-22 16:52:49 -05: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 //
|
2019-04-11 08:43:33 -04:00
|
|
|
|
// (at your option) any later version. //
|
2018-02-22 16:52:49 -05:00
|
|
|
|
// //
|
|
|
|
|
// 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 11:39:02 -04:00
|
|
|
|
#ifndef INCLUDE_TVSCREEN_H
|
|
|
|
|
#define INCLUDE_TVSCREEN_H
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
2022-03-18 13:13:08 -04:00
|
|
|
|
#include <QOpenGLWidget>
|
2018-02-22 16:52:49 -05:00
|
|
|
|
#include <QPen>
|
|
|
|
|
#include <QTimer>
|
2022-09-15 15:59:42 -04:00
|
|
|
|
#include <QRecursiveMutex>
|
2018-02-22 16:52:49 -05:00
|
|
|
|
#include <QFont>
|
|
|
|
|
#include <QMatrix4x4>
|
|
|
|
|
#include "dsp/dsptypes.h"
|
2018-03-11 11:39:02 -04:00
|
|
|
|
#include "glshadertextured.h"
|
|
|
|
|
#include "glshadertvarray.h"
|
2018-03-20 08:49:21 -04:00
|
|
|
|
#include "export.h"
|
2018-02-22 16:52:49 -05:00
|
|
|
|
#include "util/bitfieldindex.h"
|
|
|
|
|
|
|
|
|
|
class QPainter;
|
|
|
|
|
|
2022-03-18 13:13:08 -04:00
|
|
|
|
class SDRGUI_API TVScreen: public QOpenGLWidget
|
2018-02-22 16:52:49 -05:00
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2021-04-06 22:32:31 -04:00
|
|
|
|
TVScreen(bool color, QWidget* parent = nullptr);
|
2018-03-12 20:39:43 -04:00
|
|
|
|
virtual ~TVScreen();
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
2021-04-06 22:32:31 -04:00
|
|
|
|
void setColor(bool color);
|
|
|
|
|
void resizeTVScreen(int cols, int rows);
|
|
|
|
|
void getSize(int& cols, int& rows) const;
|
|
|
|
|
void renderImage(unsigned char * data);
|
|
|
|
|
QRgb* getRowBuffer(int row);
|
2018-02-22 16:52:49 -05:00
|
|
|
|
void resetImage();
|
2018-03-12 20:39:43 -04:00
|
|
|
|
void resetImage(int alpha);
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
2021-04-06 22:32:31 -04:00
|
|
|
|
bool selectRow(int line);
|
|
|
|
|
bool setDataColor(int col, int red, int green, int blue);
|
|
|
|
|
bool setDataColor(int col, int red, int green, int blue, int alpha);
|
|
|
|
|
void setAlphaBlend(bool alphaBlend) { m_glShaderArray.setAlphaBlend(alphaBlend); }
|
|
|
|
|
void setAlphaReset() { m_glShaderArray.setAlphaReset(); }
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
|
|
void connectTimer(const QTimer& timer);
|
|
|
|
|
|
|
|
|
|
//Valeurs par défaut
|
2021-04-06 22:32:31 -04:00
|
|
|
|
static const int TV_COLS = 256;
|
|
|
|
|
static const int TV_ROWS = 256;
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void traceSizeChanged(int);
|
|
|
|
|
void sampleRateChanged(int);
|
|
|
|
|
|
|
|
|
|
private:
|
2021-04-06 22:32:31 -04:00
|
|
|
|
bool m_glContextInitialized;
|
|
|
|
|
int m_askedCols;
|
|
|
|
|
int m_askedRows;
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// state
|
2021-04-06 22:32:31 -04:00
|
|
|
|
QTimer m_timer;
|
2022-09-15 15:59:42 -04:00
|
|
|
|
QRecursiveMutex m_mutex;
|
2021-04-06 22:32:31 -04:00
|
|
|
|
bool m_dataChanged;
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
2021-04-06 22:32:31 -04:00
|
|
|
|
GLShaderTVArray m_glShaderArray;
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
2018-03-14 19:16:50 -04:00
|
|
|
|
int m_cols;
|
|
|
|
|
int m_rows;
|
|
|
|
|
|
2018-02-22 16:52:49 -05:00
|
|
|
|
void initializeGL();
|
|
|
|
|
void resizeGL(int width, int height);
|
|
|
|
|
void paintGL();
|
|
|
|
|
|
|
|
|
|
void mousePressEvent(QMouseEvent*);
|
|
|
|
|
|
2021-04-06 22:32:31 -04:00
|
|
|
|
unsigned char *m_lastData;
|
2018-02-22 16:52:49 -05:00
|
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
|
void cleanup();
|
|
|
|
|
void tick();
|
|
|
|
|
};
|
|
|
|
|
|
2018-03-11 11:39:02 -04:00
|
|
|
|
#endif // INCLUDE_TVSCREEN_H
|