gui works, including clone plots

This commit is contained in:
2019-07-17 16:58:04 +02:00
parent d3879bb834
commit 8cdfe4194f
26 changed files with 1812 additions and 1555 deletions

View File

@ -1,63 +1,43 @@
#pragma once
#include "ui_form_cloneplot.h"
class SlsQtH1D;
class SlsQt1DPlot;
class SlsQt2DPlotLayout;
class SlsQt2DPlot;
#include <QString>
#include <QMainWindow>
class QwtSymbol;
class QGridLayout;
class QGroupBox;
class QLabel;
class QCloseEvent;
#include <QString>
#include <iostream>
#include <string>
class qCloneWidget : public QMainWindow {
class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
Q_OBJECT
public:
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
QString filePath, QString fileName, int imageIndex,
bool displayStats, QString min, QString max, QString sum);
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp,
QString title, QString filePath, QString fileName,
int64_t aIndex, bool displayStats, QString min, QString max,
QString sum);
~qCloneWidget();
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle, bool isZmax, bool isZmin, double zmin, double zmax);
SlsQt1DPlot *Get1dPlot();
public slots:
int SavePlotAutomatic();
private slots:
void SavePlot();
protected:
void closeEvent(QCloseEvent *event);
private:
void SetupWidgetWindow(QString title);
void DisplayStats(bool enable, QString min, QString max, QString sum);
signals:
void CloneClosedSignal(int);
private:
int id;
QString filePath;
QString fileName;
int imageIndex;
SlsQt1DPlot *cloneplot1D;
SlsQt2DPlotLayout *cloneplot2D;
QVector<SlsQtH1D *> cloneplot1D_hists;
SlsQt1DPlot *plot1d{nullptr};
SlsQt2DPlot *plot2d{nullptr};
SlsQt2DPlot *gainplot2d{nullptr};
QString filePath{"/"};
QString fileName{"run"};
int64_t acqIndex{0};
QwtSymbol *marker;
QwtSymbol *nomarker;
QGridLayout *mainLayout;
QGroupBox *boxPlot;
QLabel *lblHistTitle;
static int NumClones;
};

View File

@ -0,0 +1,34 @@
#pragma once
#include "ui_form_dac.h"
class multiSlsDetector;
#include "sls_detector_defs.h"
#include <string>
class qDacWidget:public QWidget, private Ui::WidgetDacObject {
Q_OBJECT
public:
qDacWidget(QWidget *parent, multiSlsDetector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i, bool t);
~qDacWidget();
void SetDetectorIndex(int id);
private slots:
void SetDac();
private:
void SetupWidgetWindow(std::string name);
void Initialization();
void GetDac();
void GetAdc();
void Refresh();
multiSlsDetector *myDet;
bool isDac{true};
slsDetectorDefs::dacIndex index;
bool isMillideg{false};
int detectorIndex{-1};
};

View File

@ -21,7 +21,7 @@ class qDefs : public QWidget {
*/
qDefs(){};
#define GOODBYE -200
static const int Q_FONT_SIZE=9;
static void DisplayExceptions(std::string emsg, std::string src) {
try {

View File

@ -1,18 +1,17 @@
#pragma once
#include "ui_form_plot.h"
#include "qDefs.h"
class detectorData;
class SlsQt1DPlot;
class SlsQtH1D;
class SlsQt2DPlotLayout;
class SlsQt2DPlot;
class qCloneWidget;
class QGridLayout;
class QGroupBox;
#include <QFutureWatcher>
class qDrawPlot : public QWidget {
class qDrawPlot : public QWidget, private Ui::PlotObject {
Q_OBJECT
public:
@ -52,13 +51,10 @@ class qDrawPlot : public QWidget {
void DisplayStatistics(bool enable);
void EnableGainPlot(bool enable);
void ClonePlot();
void CloseClones();
void SaveClones();
void SavePlot();
private slots:
void SetSaveFileName(QString val);
void CloneCloseEvent(int id);
void AcquireFinished();
void UpdatePlot();
@ -71,10 +67,7 @@ class qDrawPlot : public QWidget {
private:
void SetupWidgetWindow();
void Initialization();
void SetupStatistics();
void SetupPlots();
int LockLastImageArray();
int UnlockLastImageArray();
void GetStatistics(double &min, double &max, double &sum);
void DetachHists();
static void GetProgressCallBack(double currentProgress, void *this_pointer);
@ -97,20 +90,15 @@ class qDrawPlot : public QWidget {
SlsQt1DPlot *plot1d{nullptr};
QVector<SlsQtH1D *> hists1d;
SlsQt2DPlotLayout *plot2d{nullptr};
SlsQt2DPlotLayout *gainplot2d{nullptr};
SlsQt2DPlot *plot2d{nullptr};
SlsQt2DPlot *gainplot2d{nullptr};
QFutureWatcher<std::string> *acqResultWatcher;
QGridLayout *layout{nullptr};
QGroupBox *boxPlot{nullptr};
QGridLayout *plotLayout{nullptr};
bool is1d{true};
bool isRunning{false};
// titles
QString plotTitlePrefix{""};
QLabel *lblFrameIndexTitle1d{nullptr};
QString xTitle1d{"Channel Number"};
QString yTitle1d{"Counts"};
QString xTitle2d{"Pixel"};
@ -125,7 +113,7 @@ class qDrawPlot : public QWidget {
bool isZRange[2]{false, false};
// data
unsigned int nHists{1};
int nHists{1};
double *datax1d{nullptr};
std::vector<double *> datay1d;
double *data2d{nullptr};
@ -147,12 +135,7 @@ class qDrawPlot : public QWidget {
bool resetPedestal{false};
bool isAccumulate{false};
bool resetAccumulate{false};
QWidget *widgetStatistics{nullptr};
QLabel *lblMinDisp{nullptr};
QLabel *lblMaxDisp{nullptr};
QLabel *lblSumDisp{nullptr};
bool displayStatistics{false};
std::vector<qCloneWidget *> cloneWidgets;
QString fileSavePath{"/tmp"};
QString fileSaveName{"Image"};
bool hasGainData{false};
@ -162,7 +145,7 @@ class qDrawPlot : public QWidget {
int progress{0};
int64_t currentFrame{0};
mutable std::mutex mPlots;
pthread_mutex_t lastImageCompleteMutex;
int64_t currentAcqIndex{0};
unsigned int nPixelsX{0};
unsigned int nPixelsY{0};

View File

@ -1,42 +1,15 @@
#pragma once
#include "ui_form_tab_developer.h"
class qDacWidget;
class multiSlsDetector;
#include "sls_detector_defs.h"
#include <QDoubleSpinBox>
class QGroupBox;
class QLabel;
class MyDoubleSpinBox;
class QLineEdit;
class QComboBox;
class QSpinBox;
class QGridLayout;
class QString;
class QPalette;
class QGridLayout;
#include <string>
#include <vector>
/**To override the spin box class to have an id and emit it*/
class MyDoubleSpinBox: public QDoubleSpinBox{
Q_OBJECT
private:
int myId;
private slots:
void valueChangedWithID() {emit editingFinished(myId);};
public:
/** Overridden constructor from QDoubleSpinBox */
MyDoubleSpinBox(int id,QWidget* parent = 0) :QDoubleSpinBox(parent), myId(id){
connect(this, SIGNAL(editingFinished()), this, SLOT(valueChangedWithID()));
}
signals:
void editingFinished(int myId);
};
class qTabDeveloper:public QWidget {
class qTabDeveloper:public QWidget, private Ui::TabDeveloperObject {
Q_OBJECT
public:
@ -47,29 +20,19 @@ public slots:
void Refresh();
private slots:
void GetAdcs();
void SetDac(int id);
void SetHighVoltage();
private:
void SetupWidgetWindow();
void Initialization();
void PopulateDetectors();
void CreateDACWidgets();
void CreateADCWidgets();
void CreateHVWidget();
void GetDac(int id);
void GetDacs();
void GetHighVoltage();
slsDetectorDefs::dacIndex getSLSIndex(int index);
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
multiSlsDetector *myDet;
slsDetectorDefs::detectorType detType;
int numDACWidgets;
int numADCWidgets;
std::vector<std::string>dacNames;
std::vector<std::string>adcNames;
std::vector<qDacWidget*> dacWidgets;
std::vector<qDacWidget*> adcWidgets;
enum hvVals {
HV_0,
HV_90,
@ -80,20 +43,6 @@ private:
HV_200
};
QGroupBox *boxDacs;
QGroupBox *boxAdcs;
std::vector<QLabel*>lblDacs;
std::vector<QLabel*>lblAdcs;
std::vector<MyDoubleSpinBox*>spinDacs;
std::vector<QLabel*>lblDacsmV;
std::vector<QLineEdit*>spinAdcs;
QLabel *lblHV;
QComboBox *comboHV;
QSpinBox *spinHV;
QGridLayout *dacLayout;
QComboBox *comboDetector;
QGridLayout *layout;
static const int HV_MIN = 60;
static const int HV_MAX = 200;
};