mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
WIP
This commit is contained in:
parent
7b456cb9c6
commit
e4190285be
@ -99,7 +99,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
@ -610,167 +610,6 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageHistogram_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>0</y>
|
||||
<width>315</width>
|
||||
<height>35</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layoutThreshold_4">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistFrom_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistFrom_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-16777215</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistTo_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> to </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistTo_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-16777215</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistSize_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> size </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistSize_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-16777215</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnLeft2D">
|
||||
<property name="geometry">
|
||||
@ -871,7 +710,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
@ -1468,167 +1307,6 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageHistogram">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>0</y>
|
||||
<width>331</width>
|
||||
<height>36</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layoutThreshold_3">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistFrom">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistFrom">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistTo">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> to </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistTo">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-16777215</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistSize">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> size </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistSize">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-16777215</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnLeft1D">
|
||||
<property name="geometry">
|
||||
@ -2233,7 +1911,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>355</width>
|
||||
<width>345</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -2251,7 +1929,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="3">
|
||||
<widget class="QRadioButton" name="radioDataGraph">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -2267,49 +1945,33 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="radioHistogram">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Histogram</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>120</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -2751,7 +2413,6 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>radioNoPlot</tabstop>
|
||||
<tabstop>radioHistogram</tabstop>
|
||||
<tabstop>radioDataGraph</tabstop>
|
||||
<tabstop>chkInterpolate</tabstop>
|
||||
<tabstop>chkContour</tabstop>
|
||||
|
@ -30,7 +30,7 @@ class qDefs : public QWidget {
|
||||
QF_NUM_FUNCTIONS
|
||||
};
|
||||
|
||||
const char* getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||
static const char* getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||
switch (func) {
|
||||
case QF_GET_DETECTOR_STATUS: return "QF_GET_DETECTOR_STATUS";
|
||||
case QF_START_ACQUISITION: return "QF_START_ACQUISITION";
|
||||
@ -142,7 +142,7 @@ class qDefs : public QWidget {
|
||||
valueMS /= 1000;
|
||||
case MICROSECONDS:
|
||||
valueMS /= 1000;
|
||||
return valueMs;
|
||||
return valueMS;
|
||||
|
||||
case HOURS:
|
||||
valueMS *= 60;
|
||||
|
@ -19,13 +19,13 @@ class qServer : public QWidget {
|
||||
|
||||
private:
|
||||
void FunctionTable();
|
||||
void DecodeFunction(sls::ServerInterface2 *socket);
|
||||
void DecodeFunction(sls::ServerInterface2 &socket);
|
||||
void ServerThread(bool isControlServer);
|
||||
void GetStatus(sls::ServerInterface2* socket);
|
||||
void StartAcquisition(sls::ServerInterface2* socket);
|
||||
void StopsAcquisition(sls::ServerInterface2* socket);
|
||||
void Acquire(sls::ServerInterface2* socket);
|
||||
void ExitServer(sls::ServerInterface2* socket);
|
||||
void GetStatus(sls::ServerInterface2 &socket);
|
||||
void StartAcquisition(sls::ServerInterface2 &socket);
|
||||
void StopsAcquisition(sls::ServerInterface2 &socket);
|
||||
void Acquire(sls::ServerInterface2 &socket);
|
||||
void ExitServer(sls::ServerInterface2 &socket);
|
||||
|
||||
signals:
|
||||
// to update the Listening to Gui check box
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
void SetXTitle(QString st);
|
||||
void SetYTitle(QString st);
|
||||
void SetZTitle(QString st);
|
||||
void KeepZRangeIfSet();
|
||||
void KeepZRangeIfSet();
|
||||
|
||||
|
||||
private:
|
||||
|
@ -1,3 +1,6 @@
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qtoolbutton.h>
|
||||
@ -6,10 +9,6 @@
|
||||
#include <qlabel.h>
|
||||
#include <QString>
|
||||
|
||||
#include "SlsQt2DPlotLayout.h"
|
||||
|
||||
|
||||
|
||||
SlsQt2DPlotLayout::SlsQt2DPlotLayout(QWidget *parent):QGroupBox(parent){
|
||||
the_layout=0;
|
||||
the_plot = new SlsQt2DPlot(this);
|
||||
@ -39,8 +38,12 @@ void SlsQt2DPlotLayout::ConnectSignalsAndSlots(){
|
||||
connect(this, SIGNAL(LogzSignal(bool)), this, SLOT(SetZScaleToLog(bool)));
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
||||
UpdateZRange(zmin, zmax);
|
||||
}
|
||||
|
||||
void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){
|
||||
isZMin = isMin;
|
||||
isZmin = isMin;
|
||||
isZmax = isMax;
|
||||
|
||||
// reset zmin and zmax first (recalculate from plot)
|
||||
@ -73,7 +76,7 @@ void SlsQt2DPlotLayout::SetZScaleToLog(bool enable) {
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Z Scale to log";
|
||||
isLog = enable;
|
||||
the_plot->LogZ(enable);
|
||||
SetZRange(isZMin, isZmax, zmin, zmax);
|
||||
SetZRange(isZmin, isZmax, zmin, zmax);
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,7 +187,7 @@ void qCloneWidget::SetCloneHists(int nHists, int histNBins, double *histXAxis, d
|
||||
|
||||
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d) {
|
||||
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
|
||||
cloneplot2D->UpdateNKeepSetRangeIfSet();
|
||||
cloneplot2D->KeepZRangeIfSet();
|
||||
}
|
||||
|
||||
void qCloneWidget::SetRange(bool IsXYRange[], double XYRangeValues[]) {
|
||||
|
@ -1433,7 +1433,7 @@ void qDrawPlot::UpdatePlot() {
|
||||
plot2D->SetYTitle(imageYAxisTitle);
|
||||
plot2D->SetZTitle(imageZAxisTitle);
|
||||
//zmin and zmax of plot already calculated using SetData, now recalculate if z is set
|
||||
plot2D->UpdateZRange();
|
||||
plot2D->KeepZRangeIfSet();
|
||||
if (gainPlotEnable) {
|
||||
gainplot2D->GetPlot()->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, startPixel, endPixel, gainImageArray);
|
||||
gainplot2D->setTitle(GetImageTitle());
|
||||
@ -1743,7 +1743,7 @@ void qDrawPlot::DisableZoom(bool disable) {
|
||||
plot2D->SetYTitle("Pixel");
|
||||
plot2D->SetZTitle("Trimbits");
|
||||
//zmin and zmax of plot already calculated using SetData, now recalculate if z is set
|
||||
plot2D->UpdateZRange();
|
||||
plot2D->KeepZRangeIfSet();
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Trimbits Plot updated" <<'\n';
|
||||
#endif
|
||||
|
@ -24,18 +24,18 @@ void qServer::FunctionTable() {
|
||||
flist[qDefs::QF_EXIT_SERVER] = &qServer::ExitServer;
|
||||
}
|
||||
|
||||
void qServer::DecodeFunction(sls::ServerInterface2 *socket) {
|
||||
qFuncNames fnum;
|
||||
void qServer::DecodeFunction(sls::ServerInterface2 &socket) {
|
||||
qDefs::qFuncNames fnum;
|
||||
socket.Receive(fnum);
|
||||
|
||||
if (fnum < 0 || fnum >= QF_NUM_FUNCTIONS) {
|
||||
throw RuntimeError("Unrecognized Function enum " + std::to_string(fnum) + "\n");
|
||||
if (fnum < 0 || fnum >= qDefs::QF_NUM_FUNCTIONS) {
|
||||
throw sls::RuntimeError("Unrecognized Function enum " + std::to_string(fnum) + "\n");
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum << " ("
|
||||
<< slsDetectorDefs::getQFunctionNameFromEnum(fnum) << ")";
|
||||
(this->*flist[fnum])(socket);
|
||||
FILE_LOG(logDEBUG1) << "Function " << getQFunctionNameFromEnum(fnum) << " finished";
|
||||
<< qDefs::getQFunctionNameFromEnum(fnum) << ")";
|
||||
(this->*flist[static_cast<int>(fnum)])(socket);
|
||||
FILE_LOG(logDEBUG1) << "Function " << qDefs::getQFunctionNameFromEnum(fnum) << " finished";
|
||||
}
|
||||
|
||||
void qServer::CreateServers() {
|
||||
@ -44,16 +44,16 @@ void qServer::CreateServers() {
|
||||
tcpThreadCreated = true;
|
||||
try {
|
||||
// start control server
|
||||
controlStatus = std::async(std::launch::async, ServerThread, true);
|
||||
controlStatus = std::async(std::launch::async, &qServer::ServerThread, this, true);
|
||||
FILE_LOG(logDEBUG) << "Gui control server thread created successfully.";
|
||||
// start stop server
|
||||
stopStatus = std::async(std::launch::async, ServerThread, false);
|
||||
stopStatus = std::async(std::launch::async, &qServer::ServerThread, this, false);
|
||||
FILE_LOG(logDEBUG) << "Gui stop server thread created successfully.";
|
||||
|
||||
} catch (...) {
|
||||
std::string mess = "Could not create Gui TCP servers";
|
||||
FILE_LOG(logERROR) << mess;
|
||||
qDefs::Message(qDefs::WARNING, message, "qServer::CreateServers");
|
||||
qDefs::Message(qDefs::WARNING, mess, "qServer::CreateServers");
|
||||
DestroyServers();
|
||||
}
|
||||
}
|
||||
@ -75,21 +75,18 @@ void qServer::DestroyServers() {
|
||||
}
|
||||
}
|
||||
|
||||
void qServer::ServerThread(isControlServer) {
|
||||
sls::ServerSocket* sock = nullptr;
|
||||
if (isControl) {
|
||||
void qServer::ServerThread(bool isControlServer) {
|
||||
if (isControlServer) {
|
||||
FILE_LOG(logDEBUG) << "Starting Gui Server (Control port: " << controlPort << ")";
|
||||
controlSocket = sls::make_unique<sls::ServerSocket>(controlPort);
|
||||
sock = controlSocket;
|
||||
} else {
|
||||
FILE_LOG(logDEBUG) << "Starting Gui Server (Stop port: " << stopPort << ")";
|
||||
stopSocket = sls::make_unique<sls::ServerSocket>(stopPort);
|
||||
sock = stopSocket;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
try{
|
||||
auto socket = sock->accept();
|
||||
auto socket = (isControlServer ? controlSocket->accept() : stopSocket->accept());
|
||||
try{
|
||||
decode_function(socket);
|
||||
} catch(const sls::NonCriticalError &e) {
|
||||
@ -116,46 +113,46 @@ void qServer::ServerThread(isControlServer) {
|
||||
FILE_LOG(logDEBUG) << "Stopped gui server thread";
|
||||
}
|
||||
|
||||
void qServer::GetStatus(sls::ServerInterface2* socket) {
|
||||
void qServer::GetStatus(sls::ServerInterface2 &socket) {
|
||||
slsDetectorDefs::runStatus status = slsDetectorDefs::ERROR;
|
||||
int progress = 0;
|
||||
if (myMainTab->isPlotRunning())
|
||||
if (mainTab->isPlotRunning())
|
||||
status = slsDetectorDefs::RUNNING;
|
||||
else
|
||||
status = slsDetectorDefs::IDLE;
|
||||
|
||||
progress = myMainTab->GetProgress();
|
||||
progress = mainTab->GetProgress();
|
||||
|
||||
int retvals[2] = {static_cast<int>(status), progress};
|
||||
socket.SendResult(retvals);
|
||||
}
|
||||
|
||||
void qServer::StartAcquisition(sls::ServerInterface2* socket) {
|
||||
if (myMainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
void qServer::StartAcquisition(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not start acquistion in Gui");
|
||||
}
|
||||
socket.Send(slsDetectorDefs::OK);
|
||||
}
|
||||
|
||||
void qServer::StopsAcquisition(sls::ServerInterface2* socket) {
|
||||
if (myMainTab->StartStopAcquisitionFromClient(false) == slsDetectorDefs::FAIL) {
|
||||
void qServer::StopsAcquisition(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(false) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not stop acquistion in Gui");
|
||||
}
|
||||
socket.Send(slsDetectorDefs::OK);
|
||||
}
|
||||
|
||||
void qServer::Acquire(sls::ServerInterface2* socket) {
|
||||
if (myMainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
void qServer::Acquire(sls::ServerInterface2 &socket) {
|
||||
if (mainTab->StartStopAcquisitionFromClient(true) == slsDetectorDefs::FAIL) {
|
||||
throw sls::NonCriticalError("Could not start blocking acquistion in Gui");
|
||||
}
|
||||
// blocking
|
||||
usleep(5000);
|
||||
while (myMainTab->isPlotRunning()) {
|
||||
while (mainTab->isPlotRunning()) {
|
||||
usleep(5000);
|
||||
}
|
||||
socket.Send(slsDetectorDefs::OK);
|
||||
}
|
||||
|
||||
void qServer::ExitServer(sls::ServerInterface2* socket) {
|
||||
void qServer::ExitServer(sls::ServerInterface2 &socket) {
|
||||
throw sls::NonCriticalError("Server exited");
|
||||
}
|
@ -21,8 +21,7 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
||||
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false),
|
||||
stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr),
|
||||
btnGroupPlotType(0) {
|
||||
btnGroupPlotType(0), stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Plot ready";
|
||||
@ -75,17 +74,11 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
dispZMax->setValidator(new QDoubleValidator(dispZMax));
|
||||
// Plot titles
|
||||
dispTitle->setText("");
|
||||
myPlot->SetPlotTitlePrefix("");
|
||||
dispXAxis->setText(defaultHistXAxisTitle);
|
||||
dispYAxis->setText(defaultHistYAxisTitle);
|
||||
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
||||
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
||||
dispXAxis->setText(defaultImageXAxisTitle);
|
||||
dispYAxis->setText(defaultImageYAxisTitle);
|
||||
dispZAxis->setText(defaultImageZAxisTitle);
|
||||
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
|
||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||
|
||||
// enabling according to det type
|
||||
isOneD = false;
|
||||
@ -202,7 +195,7 @@ void qTabPlot::Select1DPlot(bool enable) {
|
||||
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||
isOneD = enable;
|
||||
box1D->setEnabled(enable);
|
||||
box2D->setEnabled(!benable);
|
||||
box2D->setEnabled(!enable);
|
||||
chkZAxis->setEnabled(!enable);
|
||||
dispZAxis->setEnabled(!enable);
|
||||
chkZMin->setEnabled(!enable);
|
||||
@ -247,48 +240,48 @@ void qTabPlot::SetPlot() {
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsRight() {
|
||||
FILE_LOG(logDEBUG) << "1D Options Right";
|
||||
int i = stackedWidget->currentIndex();
|
||||
if (i == (stackedWidget->count() - 1))
|
||||
stackedWidget->setCurrentIndex(0);
|
||||
int i = stackedWidget1D->currentIndex();
|
||||
if (i == (stackedWidget1D->count() - 1))
|
||||
stackedWidget1D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget->setCurrentIndex(i + 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
|
||||
stackedWidget1D->setCurrentIndex(i + 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
FILE_LOG(logDEBUG) << "1D Options Left";
|
||||
int i = stackedWidget->currentIndex();
|
||||
int i = stackedWidget1D->currentIndex();
|
||||
if (i == 0)
|
||||
stackedWidget->setCurrentIndex(stackedWidget->count() - 1);
|
||||
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
||||
else
|
||||
stackedWidget->setCurrentIndex(i - 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget->currentIndex() + 1));
|
||||
stackedWidget1D->setCurrentIndex(i - 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsRight() {
|
||||
FILE_LOG(logDEBUG) << "2D Options Right";
|
||||
int i = stackedWidget_2->currentIndex();
|
||||
if (i == (stackedWidget_2->count() - 1))
|
||||
stackedWidget_2->setCurrentIndex(0);
|
||||
int i = stackedWidget2D->currentIndex();
|
||||
if (i == (stackedWidget2D->count() - 1))
|
||||
stackedWidget2D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget_2->setCurrentIndex(i + 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
|
||||
stackedWidget2D->setCurrentIndex(i + 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
FILE_LOG(logDEBUG) << "2D Options Left";
|
||||
int i = stackedWidget_2->currentIndex();
|
||||
int i = stackedWidget2D->currentIndex();
|
||||
if (i == 0)
|
||||
stackedWidget_2->setCurrentIndex(stackedWidget_2->count() - 1);
|
||||
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
||||
else
|
||||
stackedWidget_2->setCurrentIndex(i - 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget_2->currentIndex() + 1));
|
||||
stackedWidget2D->setCurrentIndex(i - 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::EnablePersistency(bool enable) {
|
||||
FILE_LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled");
|
||||
lblPersistency->setEnabled(val);
|
||||
spinPersistency->setEnabled(val);
|
||||
lblPersistency->setEnabled(enable);
|
||||
spinPersistency->setEnabled(enable);
|
||||
if (enable)
|
||||
myPlot->SetPersistency(spinPersistency->value());
|
||||
else
|
||||
@ -423,7 +416,7 @@ void qTabPlot::CheckAspectRatio() {
|
||||
}
|
||||
|
||||
void qTabPlot::SetXYRange() {
|
||||
FILE_LOG(LOGDEBUG) << "Set XY Range";
|
||||
FILE_LOG(logDEBUG) << "Set XY Range";
|
||||
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
||||
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
||||
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
@ -528,7 +521,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
ranges[qDefs::YMINIMUM] = myPlot->GetYMinimum();
|
||||
ranges[qDefs::YMAXIMUM] = myPlot->GetYMaximum();
|
||||
double idealAspectratio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: %f for x(%f - %f), y(%f - %f)\n", idealAspectratio, ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMINIMUM] << " - " << ranges[qDefs::XMAXIMUM] << "), y(" << ranges[qDefs::YMINIMUM] << " - " << ranges[qDefs::YMAXIMUM] << ")";
|
||||
|
||||
// calculate current aspect ratio
|
||||
ranges[qDefs::XMINIMUM] = dispXMin->text().toDouble();
|
||||
@ -536,9 +529,9 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
ranges[qDefs::YMINIMUM] = dispYMin->text().toDouble();
|
||||
ranges[qDefs::YMAXIMUM] = dispYMax->text().toDouble();
|
||||
double currentAspectRatio = (ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) / (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]);
|
||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: %f for x(%f - %f), y(%f - %f)\n", currentAspectRatio, ranges[qDefs::XMINIMUM], ranges[qDefs::XMAXIMUM], ranges[qDefs::YMINIMUM], ranges[qDefs::YMAXIMUM]);
|
||||
|
||||
if (newAspectRatio != idealAspectratio) {
|
||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x(" << ranges[qDefs::XMINIMUM] << " - " << ranges[qDefs::XMAXIMUM] << "), y(" << ranges[qDefs::YMINIMUM] << " - " << ranges[qDefs::YMAXIMUM] << ")";
|
||||
|
||||
if (currentAspectRatio != idealAspectratio) {
|
||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted), -1(aspect ratio clicked: larger one adjusted)
|
||||
if (dimension == -1) {
|
||||
dimension = ((ranges[qDefs::XMAXIMUM] - ranges[qDefs::XMINIMUM]) > (ranges[qDefs::YMAXIMUM] - ranges[qDefs::YMINIMUM]))
|
||||
@ -603,10 +596,10 @@ void qTabPlot::SetZRange() {
|
||||
bool isZmin = chkZMin->isChecked();
|
||||
bool isZmax = chkZMax->isChecked();
|
||||
double zmin = 0, zmax = 1;
|
||||
if (!dispZMin->text().empty()) {
|
||||
if (!dispZMin->text().isEmpty()) {
|
||||
zmin = dispZMin->text().toDouble();
|
||||
}
|
||||
if (!dispZMax->text().empty()) {
|
||||
if (!dispZMax->text().isEmpty()) {
|
||||
zmax = dispZMax->text().toDouble();
|
||||
}
|
||||
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
|
||||
@ -636,7 +629,7 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
double timeS = static_cast<double>(timeMs) / 1000.00;
|
||||
auto time = qDefs::getCorrectTime(timeS);
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setcurrentIndex(static_cast<int>(time.second));
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
} catch(const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get streaming timer.", e.what(), "qTabPlot::GetStreamingFrequency");
|
||||
|
Loading…
x
Reference in New Issue
Block a user