RISC-V/V203/usb/scope/software/displaywidget.h
2024-11-17 17:12:36 +01:00

80 lines
2.1 KiB
C++

#ifndef DISPLAYWIDGET_H
#define DISPLAYWIDGET_H
#include <QWidget>
#include <QVector>
#include <QPoint>
#include <QImage>
#include <QMatrix>
#include "structures.h"
/**
*/
struct PaintColors {
QColor colA;
QColor colB;
QColor colT;
explicit PaintColors () : colA(QColor(0,255,0,255)),colB(QColor(255,64,0,255)),colT(QColor(255,255,0,255)) {}
};
class QSettings;
class DisplayWidget : public QWidget {
Q_OBJECT
const PaintColors pcol;
QVector<int> ACopy;
QVector<int> BCopy;
QMatrix m_forward;
QMatrix m_inverse;
QImage background;
TrigerSettings * m_ts;
QPolygonF ChA, ChB;
MOVE_ITEMS m_items;
int m_timeBase;
int m_ChBase;
int m_TrgSource;
double x_lenght;
struct MarkSetting {
double a,b;
} m_time, m_volt;
struct ChScale {
double a,b;
} m_channels;
struct ChOfset {
double a,b;
} m_offset;
enum MARKER_ENUM {
MARKER_TIME = 0,
MARKER_VOLT_A,
MARKER_VOLT_B,
} marker_type;
unsigned m_timeCount;
bool m_continual;
int m_cont_limit;
int m_cont_pass;
public:
explicit DisplayWidget (QWidget * p);
virtual ~DisplayWidget ();
void setTrigger (TrigerSettings * ts);
void TriggerValues (int n);
void TimeBaseRange (int n);
void MarkerChanged (int n, bool b);
void SendVoltage (int ch, int n);
void reloadChRange (int a, int b);
void saveSettings (QSettings & setting);
void restSettings (QSettings & setting);
void SendTrigerChan(int n);
void resizeEvent (QResizeEvent * event) override;
void paintEvent (QPaintEvent * event) override;
void wheelEvent (QWheelEvent * event) override;
void mousePressEvent(QMouseEvent * event) override;
public slots:
void DispChannels (QVector<int>, QVector<int>);
signals:
void SettingsChanged (int n);
protected:
void drawCurrent (QPainter & p);
void drawBackground ();
bool reloadData ();
void reloadMatrix (const QSize & sz);
};
#endif // DISPLAYWIDGET_H