LibreVNA/Software/PC_Application/LibreVNA-GUI/Tools/eyediagramdialog.h

83 lines
1.6 KiB
C
Raw Normal View History

2022-10-19 23:31:14 +08:00
#ifndef EYEDIAGRAMDIALOG_H
#define EYEDIAGRAMDIALOG_H
#include "Traces/tracemodel.h"
2022-10-20 06:28:10 +08:00
#include "Traces/Math/tdr.h"
2022-10-19 23:31:14 +08:00
#include <vector>
#include <QDialog>
namespace Ui {
class EyeDiagramDialog;
}
class EyeDiagramDialog;
class EyeDiagramPlot : public QWidget
{
Q_OBJECT
public:
EyeDiagramPlot(QDialog *dialog);
void setDialog(EyeDiagramDialog *dialog);
2022-10-20 06:28:10 +08:00
unsigned int eyeWidth();
unsigned int eyeHeight();
2022-10-19 23:31:14 +08:00
private:
2022-10-20 06:28:10 +08:00
unsigned int leftSpace();
unsigned int rightSpace() {return 10;}
unsigned int topSpace() {return 10;}
unsigned int bottomSpace();
2022-10-19 23:31:14 +08:00
void paintEvent(QPaintEvent *event) override;
EyeDiagramDialog *dialog;
};
class EyeDiagramDialog : public QDialog
{
Q_OBJECT
public:
explicit EyeDiagramDialog(TraceModel &model);
~EyeDiagramDialog();
2022-10-20 06:28:10 +08:00
unsigned int getCalculatedPixelsX();
unsigned int getCalculatedPixelsY();
2022-10-19 23:31:14 +08:00
double getIntensity(unsigned int x, unsigned int y);
2022-10-20 06:28:10 +08:00
double displayedTime();
double minGraphVoltage();
double maxGraphVoltage();
2022-10-19 23:31:14 +08:00
public slots:
bool triggerUpdate();
bool update(unsigned int width, unsigned int height);
signals:
void updateDone();
private:
signals:
2022-10-20 06:28:10 +08:00
void calculationStatus(QString s);
2022-10-19 23:31:14 +08:00
private:
static constexpr double yOverrange = 0.2;
void updateThread(unsigned int width, unsigned int height);
Ui::EyeDiagramDialog *ui;
Trace *trace;
std::vector<std::vector<double>> eyeBuffer[2];
std::vector<std::vector<double>> *workingBuffer;
std::vector<std::vector<double>> *finishedBuffer;
2022-10-20 06:28:10 +08:00
Math::TDR *tdr;
2022-10-19 23:31:14 +08:00
bool updating;
2022-10-20 06:28:10 +08:00
bool firstUpdate;
2022-10-19 23:31:14 +08:00
};
#endif // EYEDIAGRAMDIALOG_H