This commit is contained in:
2019-06-27 11:54:17 +02:00
parent 61b937e2e0
commit 06834617de
13 changed files with 428 additions and 409 deletions

View File

@ -23,8 +23,8 @@
#include <QPainter>
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
int numDim, std::string FilePath, bool displayStats, QString min, QString max, QString sum) :
QMainWindow(parent), id(id), filePath(FilePath), cloneplot1D(nullptr), cloneplot2D(nullptr),
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),
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), cloneBox(nullptr), lblHistTitle(nullptr) {
// Window title
char winTitle[300], currTime[50];
@ -123,9 +123,9 @@ void qCloneWidget::SetupWidgetWindow(QString title, QString xTitle, QString yTit
resize(500, 350);
}
void qCloneWidget::SetCloneHists(int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, std::vector<std::string> histTitle, bool lines, bool markers) {
//for each plot, create hists
for (int hist_num = 0; hist_num < nHists; ++hist_num) {
for (unsigned int hist_num = 0; hist_num < nHists; ++hist_num) {
SlsQtH1D *k;
if (hist_num + 1 > cloneplot1D_hists.size()) {
cloneplot1D_hists.append(k = new SlsQtH1D("1d plot", histNBins, histXAxis, histYAxis[hist_num]));
@ -213,13 +213,8 @@ void qCloneWidget::SavePlot() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = QString(filePath.c_str());
if (cloneBox->title().contains('.')) {
fName.append(QString('/') + cloneBox->title());
fName.replace(".dat", ".png");
fName.replace(".raw", ".png");
} else
fName.append(QString("/Snapshot_unknown_title.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(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);
QPainter painter(&img);
@ -243,13 +238,7 @@ int qCloneWidget::SavePlotAutomatic() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = QString(filePath.c_str());
if (cloneBox->title().contains('.')) {
fName.append(QString('/') + cloneBox->title());
fName.replace(".dat", ".png");
fName.replace(".raw", ".png");
} else
fName.append(QString("/Snapshot_unknown_title.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(cloneBox->size().width(), cloneBox->size().height(), QImage::Format_RGB32);

View File

@ -286,37 +286,31 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
void qDetectorMain::Initialization() {
// Dockable Plot
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,SLOT(ResizeMainWindow(bool)));
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
// tabs
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
// Measurement tab
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tablPlot, SLOT(SetSaveFileName(QString)));
// Plot tab
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
// Plotting
// When the acquisition is finished, must update the meas tab
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement,
SLOT(UpdateFinished()));
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement,
SLOT(SetCurrentMeasurement(int)));
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tabMeasurement, SLOT(UpdateFinished()));
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tabMeasurement, SLOT(SetCurrentMeasurement(int)));
// menubar
// Modes Menu
connect(menuModes, SIGNAL(triggered(QAction *)), this,
SLOT(EnableModes(QAction *)));
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
// Utilities Menu
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
SLOT(ExecuteUtilities(QAction *)));
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
// Help Menu
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
SLOT(ExecuteHelp(QAction *)));
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
// server
connect(myServer, SIGNAL(ServerStoppedSignal()), this,
SLOT(UncheckServer()));
connect(myServer, SIGNAL(ServerStoppedSignal()), this, SLOT(UncheckServer()));
}
void qDetectorMain::LoadConfigFile(const std::string fName) {
@ -756,8 +750,6 @@ int qDetectorMain::StartStopAcquisitionFromClient(bool start) {
if (start) {
if (tabMeasurement->GetStartStatus() != start) {
tabMeasurement->ClentStartAcquisition();
while (myPlot->GetClientInitiated())
usleep(500);
}
} else {
tabMeasurement->StopAcquisition();

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,8 @@ bool qTabMeasurement::GetStartStatus(){
void qTabMeasurement::ClentStartAcquisition(){
StartAcquisition();
myPlot->SetClientInitiated();
while (myPlot->GetClientInitiated())
usleep(500);
}
int qTabMeasurement::GetProgress(){
@ -502,11 +504,13 @@ void qTabMeasurement::GetFileName() {
}
void qTabMeasurement::SetFileName() {
auto val = dispFileName->text().toAscii().constData();
std::string val = std::string(dispFileName->text().toAscii().constData());
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
try {
myDet->setFileName(val);
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
emit FileNameChangedSignal(dispFileName->text());
}
void qTabMeasurement::GetRunIndex() {

View File

@ -20,7 +20,7 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false),
QWidget(parent), myDet(detector), myPlot(plot), is1d(false),
btnGroupPlotType(0), stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr) {
setupUi(this);
SetupWidgetWindow();
@ -92,10 +92,10 @@ void qTabPlot::SetupWidgetWindow() {
dispZAxis->setText(defaultImageZAxisTitle);
// enabling according to det type
isOneD = false;
is1d = false;
switch(myDet->getDetectorTypeAsEnum()) {
case slsDetectorDefs::GOTTHARD:
isOneD = true;
is1d = true;
break;
case slsDetectorDefs::EIGER:
chkGapPixels->setEnabled(true);
@ -108,7 +108,7 @@ void qTabPlot::SetupWidgetWindow() {
break;
}
Select1DPlot(isOneD);
Select1DPlot(is1d);
Initialization();
Refresh();
}
@ -134,13 +134,13 @@ void qTabPlot::Initialization() {
connect(spinPersistency, SIGNAL(valueChanged(int)), myPlot, SLOT(SetPersistency(int)));
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogySignal(bool)));
connect(chk1DLog, SIGNAL(toggled(bool)), myPlot, SLOT(Set1dLogY(bool)));
connect(chkStatistics, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
// 2D Plot box
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SIGNAL(InterpolateSignal(bool)));
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SIGNAL(ContourSignal(bool)));
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SIGNAL(LogzSignal(bool)));
connect(chkInterpolate, SIGNAL(toggled(bool)), myPlot, SLOT(SetInterpolate(bool)));
connect(chkContour, SIGNAL(toggled(bool)), myPlot, SLOT(SetContour(bool)));
connect(chkLogz, SIGNAL(toggled(bool)), myPlot, SLOT(SetLogz(bool)));
connect(chkStatistics_2, SIGNAL(toggled(bool)), myPlot, SLOT(DisplayStatistics(bool)));
//pedstal
connect(chkPedestal, SIGNAL(toggled(bool)), myPlot, SLOT(SetPedestal(bool)));
@ -161,7 +161,7 @@ void qTabPlot::Initialization() {
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
//gainplot
if (chkGainPlot->isEnabled())
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SIGNAL(GainPlotSignal(bool)));
connect(chkGainPlot, SIGNAL(toggled(bool)), myPlot, SLOT(EnableGainPlot(bool)));
// gap pixels
if (chkGapPixels->isEnabled())
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
@ -198,12 +198,11 @@ void qTabPlot::Initialization() {
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
}
void qTabPlot::Select1DPlot(bool enable) {
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
isOneD = enable;
is1d = enable;
box1D->setEnabled(enable);
box2D->setEnabled(!enable);
chkZAxis->setEnabled(!enable);
@ -212,14 +211,10 @@ void qTabPlot::Select1DPlot(bool enable) {
chkZMax->setEnabled(!enable);
dispZMin->setEnabled(!enable);
dispZMax->setEnabled(!enable);
if(enable) {
myPlot->Select1DPlot();
} else {
myPlot->Select2DPlot();
}
myplot->Select1dPlot(enable);
SetTitles();
SetXYRange();
if (!isOneD) {
if (!is1d) {
SetZRange();
}
}
@ -242,7 +237,7 @@ void qTabPlot::SetPlot() {
if (plotEnable) {
SetTitles();
SetXYRange();
if (!isOneD) {
if (!is1d) {
SetZRange();
}
}
@ -303,7 +298,7 @@ void qTabPlot::EnablePersistency(bool enable) {
void qTabPlot::SetBinary() {
bool binary1D = chkBinary->isChecked();
bool binary2D = chkBinary_2->isChecked();
if (isOneD) {
if (is1d) {
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
lblFrom->setEnabled(binary1D);
lblTo->setEnabled(binary1D);
@ -364,15 +359,15 @@ void qTabPlot::SetTitles() {
}
// x
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
dispXAxis->setText(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
myPlot->SetXAxisTitle(isOneD ? defaultHistXAxisTitle : defaultImageXAxisTitle);
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
myPlot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
} else {
myPlot->SetXAxisTitle(dispXAxis->text());
}
// y
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
dispYAxis->setText(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
myPlot->SetYAxisTitle(isOneD ? defaultHistYAxisTitle : defaultImageYAxisTitle);
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
myPlot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
} else {
myPlot->SetYAxisTitle(dispYAxis->text());
}
@ -490,7 +485,7 @@ void qTabPlot::SetXYRange() {
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
// to update plot with range
myPlot->SetXYRange(true);
myplot->SetXYRangeChanged();
myPlot->DisableZoom(disablezoom);
emit DisableZoomSignal(disablezoom);
}
@ -594,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
myPlot->IsXYRangeValues(true, qDefs::YMAXIMUM);
// to update plot with range
myPlot->SetXYRange(true);
myplot->SetXYRangeChanged();
myPlot->DisableZoom(true);
emit DisableZoomSignal(true);
}
@ -609,7 +604,7 @@ void qTabPlot::SetZRange() {
if (!dispZMax->text().isEmpty()) {
zmax = dispZMax->text().toDouble();
}
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
myPlot->SetZRange(isZmin, isZmax, zmin, zmax);
}
void qTabPlot::GetStreamingFrequency() {