mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
WIP
This commit is contained in:
@ -23,8 +23,8 @@
|
||||
#include <QPainter>
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
|
||||
int numDim, QString fPath, QString fName, int fIndex, bool displayStats, QString min, QString max, QString sum) :
|
||||
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), fileIndex(fIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||
int numDim, QString fPath, QString fName, int iIndex, bool displayStats, QString min, QString max, QString sum) :
|
||||
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), imageIndex(iIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) {
|
||||
// Window title
|
||||
char winTitle[300], currTime[50];
|
||||
@ -142,29 +142,29 @@ void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *his
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QwtText frameIndexTitle) {
|
||||
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle) {
|
||||
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
|
||||
cloneplot2D->KeepZRangeIfSet();
|
||||
cloneplot2D->setTitle(frameIndexTitle);
|
||||
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
|
||||
}
|
||||
|
||||
void qCloneWidget::SetRange(bool IsXYRange[], double XYRange[]) {
|
||||
double XYRange[4] {0, 0, 0, 0};
|
||||
void* plot = cloneplot1D;
|
||||
if (cloneplot2D) {
|
||||
plot = cloneplot2D->GetPlot();
|
||||
if (cloneplot1D) {
|
||||
cloneplot1D->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
||||
cloneplot1D->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
||||
cloneplot1D->Update();
|
||||
} else {
|
||||
cloneplot2D->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
||||
cloneplot2D->GetPlot()->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
||||
cloneplot2D->GetPlot()->Update();
|
||||
}
|
||||
|
||||
plot->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
||||
plot->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
||||
plot->Update();
|
||||
}
|
||||
|
||||
void qCloneWidget::SavePlot() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
//title
|
||||
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||
//save
|
||||
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
||||
@ -187,7 +187,7 @@ int qCloneWidget::SavePlotAutomatic() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
//title
|
||||
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
|
||||
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||
//save
|
||||
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
||||
|
@ -283,7 +283,7 @@ void qDetectorMain::Initialization() {
|
||||
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tablPlot, SLOT(SetSaveFileName(QString)));
|
||||
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tabPlot, SLOT(SetSaveFileName(QString)));
|
||||
// Plot tab
|
||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QTimer>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -177,10 +178,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
break;
|
||||
}
|
||||
|
||||
// to let qdrawplot know that triggers or frames are used
|
||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
}
|
||||
|
||||
@ -226,24 +223,13 @@ void qTabMeasurement::SetTimingMode(int val) {
|
||||
void qTabMeasurement::GetNumMeasurements() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of measurements";
|
||||
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
|
||||
try {
|
||||
auto retval = myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
|
||||
}
|
||||
spinNumMeasurements->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of measurements.", "qTabMeasurement::GetNumMeasurements")
|
||||
|
||||
spinNumFrames->setValue(myPlot->GetNumMeasurements());
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumMeasurements(int val) {
|
||||
FILE_LOG(logINFO) << "Setting Number of Measurements to " << val;
|
||||
|
||||
try {
|
||||
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val);
|
||||
} CATCH_HANDLE("Could not set number of measurements.", "qTabMeasurement::SetNumMeasurements", this, &qTabMeasurement::GetNumMeasurements)
|
||||
myPlot->SetNumMeasurements(val);
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumFrames() {
|
||||
@ -588,6 +574,7 @@ void qTabMeasurement::StartAcquisition() {
|
||||
void qTabMeasurement::StopAcquisition() {
|
||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||
try{
|
||||
myPlot->SetStopSignal();
|
||||
myDet->stopAcquisition();
|
||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
@ -611,7 +598,7 @@ void qTabMeasurement::Enable(bool enable) {
|
||||
void qTabMeasurement::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
||||
|
||||
if (!myPlot->isRunning()) {
|
||||
if (!myPlot->GetIsRunning()) {
|
||||
GetTimingMode();
|
||||
GetNumMeasurements();
|
||||
GetNumFrames();
|
||||
|
@ -211,7 +211,7 @@ void qTabPlot::Select1DPlot(bool enable) {
|
||||
chkZMax->setEnabled(!enable);
|
||||
dispZMin->setEnabled(!enable);
|
||||
dispZMax->setEnabled(!enable);
|
||||
myplot->Select1dPlot(enable);
|
||||
myPlot->Select1dPlot(enable);
|
||||
SetTitles();
|
||||
SetXYRange();
|
||||
if (!is1d) {
|
||||
@ -485,7 +485,7 @@ void qTabPlot::SetXYRange() {
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
|
||||
// to update plot with range
|
||||
myplot->SetXYRangeChanged();
|
||||
myPlot->SetXYRangeChanged();
|
||||
myPlot->DisableZoom(disablezoom);
|
||||
emit DisableZoomSignal(disablezoom);
|
||||
}
|
||||
@ -589,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
myPlot->IsXYRangeValues(true, qDefs::YMAX);
|
||||
|
||||
// to update plot with range
|
||||
myplot->SetXYRangeChanged();
|
||||
myPlot->SetXYRangeChanged();
|
||||
myPlot->DisableZoom(true);
|
||||
emit DisableZoomSignal(true);
|
||||
}
|
||||
@ -671,7 +671,7 @@ void qTabPlot::SetStreamingFrequency() {
|
||||
void qTabPlot::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
||||
|
||||
if (!myPlot->isRunning()) {
|
||||
if (!myPlot->GetIsRunning()) {
|
||||
boxPlotType->setEnabled(true);
|
||||
|
||||
// streaming frequency
|
||||
|
Reference in New Issue
Block a user