This commit is contained in:
maliakal_d 2019-06-06 18:41:31 +02:00
parent bb760f3210
commit 48dd0fb084
5 changed files with 200 additions and 292 deletions

View File

@ -413,7 +413,7 @@
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
<widget class="QLineEdit" name="dispdetectorUDPMAC"> <widget class="QLineEdit" name="dispDetectorUDPMAC">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -759,7 +759,7 @@
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
<widget class="QSpinBox" name="spinZmqPort"> <widget class="QSpinBox" name="spinZMQPort">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>

View File

@ -207,80 +207,4 @@ class qDefs : public QWidget {
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source); return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
} }
/**
* Wrap around to ignore non critical exceptions
*/
template <class CT> struct NonDeduced { using type = CT; };
// only executing multiSlsDetector function
template <typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
const std::string message, const std::string source,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
((det->*somefunc)(Args...));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
ExceptionMessage(message, e.what(), source);
}
};
// executing multiSlsDetector funtion and using return value to set QWidget function
template <class W, typename WRT, typename RT, typename... CT>
static void IgnoreNonCriticalExceptions(multiSlsDetector* det,
const std::string message, const std::string source,
W* wid, void (W::*someQfunc)(WRT),
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
auto val = ((det->*somefunc)(Args...));
(wid->*someQfunc)(static_cast<RT>(val));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
ExceptionMessage(message, e.what(), source);
}
};
// executing multiSlsDetector funtion and using return value to set QWidget function
// (handling -1 for comboboxes)
/*template <class W, typename WRT, typename RT, typename... CT>
static void IgnoreNonCriticalExceptionsandMinus1(multiSlsDetector* det,
const std::string message, const std::string source,
W* wid, void (W::*someQfunc)(WRT),
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
int val = static_cast<int>((det->*somefunc)(Args...));
if (val == -1) {
Message(qDefs::WARNING, message + std::string(" is inconsistent for all detectors\n"), source);
} else {
(wid->*someQfunc)(val);
}
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
ExceptionMessage(message, e.what(), source);
}
};
*/
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
/* can easily get out of hand
template <typename RT, typename... CT>
static RT IgnoreNonCriticalExceptionsandReturn(
multiSlsDetector* det, const std::string loc,
RT (multiSlsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
try {
return ((det->*somefunc)(Args...));
}
// catch them here as they are not critical
catch (const sls::NonCriticalError &e) {
Message(qDefs::WARNING, e.what(), loc);
return static_cast<RT>(-1);
}
};*/
}; };

View File

@ -50,8 +50,10 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
#if QWT_VERSION<0x060000 #if QWT_VERSION<0x060000
virtual QwtText trackerText(const QwtDoublePoint &pos) const{ virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#else #elif QWT_VERSION==0x060000
virtual QwtText trackerText(const QPointF &pos) const{ virtual QwtText trackerText(const QPointF &pos) const{
#else
virtual QwtText trackerTextF(const QPointF &pos) const{
#endif #endif
QColor bg(Qt::white); QColor bg(Qt::white);

View File

@ -35,14 +35,14 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
if(plot()){ if(plot()){
if(xIsLog){ if(xIsLog){
#if QWT_VERSION < 0x50200 #if QWT_VERSION < 0x50200
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
#elif QWT_VERSION < 0x060100 #elif QWT_VERSION < 0x060100
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound();
#else #else
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound(); double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound(); double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
#endif #endif
if(xmin_curr<xmin) xmin_curr=xmin; if(xmin_curr<xmin) xmin_curr=xmin;
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width; if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width;
@ -50,14 +50,14 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
} }
if(yIsLog){ if(yIsLog){
#if QWT_VERSION < 0x50200 #if QWT_VERSION < 0x50200
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
#elif QWT_VERSION < 0x060100 #elif QWT_VERSION < 0x060100
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound();
#else #else
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound(); double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound(); double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
#endif #endif
if(ymin_curr<ymin) ymin_curr=ymin; if(ymin_curr<ymin) ymin_curr=ymin;
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width; if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;

View File

@ -48,10 +48,8 @@ void qTabAdvanced::SetupWidgetWindow(){
// set initially to network tab // set initially to network tab
tabAdvancedSettings->setCurrentWidget(tab_network); tabAdvancedSettings->setCurrentWidget(tab_network);
Initialization(); Initialization();
// udpate detector list in network
PopulateDetectors(); PopulateDetectors();
Refresh(); Refresh();
@ -59,62 +57,62 @@ void qTabAdvanced::SetupWidgetWindow(){
void qTabAdvanced::Initialization(){ void qTabAdvanced::Initialization(){
connect(tabAdvancedSettings,SIGNAL(currentChanged(int)), this, SLOT(Refresh())); connect(tabAdvancedSettings, SIGNAL(currentChanged(int)), this, SLOT(Refresh()));
// trimming // trimming
if (tab_trimming->isEnabled()) { if (tab_trimming->isEnabled()) {
// editingFinished to not set trimbits for every character input // editingFinished to not set trimbits for every character input
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits()));
} }
//network //network
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int)));
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP()));
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC()));
connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int)));
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname()));
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC()));
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int)));
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
// roi // roi
if (gridRoi->isEnabled()) { if (gridRoi->isEnabled()) {
connect(btnAddRoi, SIGNAL(clicked()), this, SLOT(AddROISlot())); connect(btnAddRoi, SIGNAL(clicked()), this, SLOT(AddROISlot()));
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI())); connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(GetROI())); connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(GetROI()));
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI())); connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
} }
// storage cells // storage cells
if (lblNumStoragecells->isEnabled()) { if (lblNumStoragecells->isEnabled()) {
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
} }
// subexptime, subdeadtime // subexptime, subdeadtime
if (lblSubExpTime->isEnabled()) { if (lblSubExpTime->isEnabled()) {
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime())); connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
connect(spinSubDeadTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); connect(spinSubDeadTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime()));
connect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime())); connect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime()));
} }
} }
void qTabAdvanced::PopulateDetectors() { void qTabAdvanced::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors"; FILE_LOG(logDEBUG) << "Populating detectors";
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int)));
comboDetector->clear(); comboDetector->clear();
for(int i = 0; i < myDet->getNumberOfDetectors(); ++i) for(int i = 0; i < myDet->getNumberOfDetectors(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str())); comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
comboDetector->setCurrentIndex(0); comboDetector->setCurrentIndex(0);
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int))); connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector(int)));
} }
void qTabAdvanced::GetOnline() { void qTabAdvanced::GetOnline() {
@ -149,113 +147,106 @@ void qTabAdvanced::GetOnline() {
} }
// display any other exception // display any other exception
catch (const std::exception &e) { catch (const std::exception &e) {
qDefs::ExceptionMessage("Could not check detector online status", e.what(), "qTabAdvanced::GetOnline"); qDefs::ExceptionMessage("Could not get detector online status", e.what(), "qTabAdvanced::GetOnline");
} }
} }
void qTabAdvanced::GetControlPort() { void qTabAdvanced::GetControlPort() {
FILE_LOG(logDEBUG) << "Getting control port "; FILE_LOG(logDEBUG) << "Getting control port ";
disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->setControlPort(-1, comboDetector->currentIndex());
"Could not get detector control port.", spinControlPort->setValue(retval);
"qTabAdvanced::GetControlPort", } catch (const sls::NonCriticalError &e) {
spinControlPort, qDefs::ExceptionMessage("Could not get detector control port.", e.what(), "qTabAdvanced::GetControlPort");
&QSpinBox::setValue, }
&multiSlsDetector::setControlPort, -1, comboDetector->currentIndex());
connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); connect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int)));
} }
void qTabAdvanced::GetStopPort() { void qTabAdvanced::GetStopPort() {
FILE_LOG(logDEBUG) << "Getting stop port"; FILE_LOG(logDEBUG) << "Getting stop port";
disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->setStopPort(-1, comboDetector->currentIndex());
"Could not get detector stop port.", spinStopPort->setValue(retval);
"qTabAdvanced::GetStopPort", } catch (const sls::NonCriticalError &e) {
spinStopPort, qDefs::ExceptionMessage("Could not get detector stop port.", e.what(), "qTabAdvanced::GetStopPort");
&QSpinBox::setValue, }
&multiSlsDetector::setStopPort, -1, comboDetector->currentIndex());
connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); connect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int)));
} }
void qTabAdvanced::GetDetectorUDPIP() { void qTabAdvanced::GetDetectorUDPIP() {
FILE_LOG(logDEBUG) << "Getting Detector UDP IP"; FILE_LOG(logDEBUG) << "Getting Detector UDP IP";
disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getDetectorIP(comboDetector->currentIndex());
"Could not get detector UDP IP.", dispDetectorUDPIP->setText(QString(retval.c_str()));
"qTabAdvanced::GetDetectorUDPIP", } catch (const sls::NonCriticalError &e) {
dispDetectorUDPIP, qDefs::ExceptionMessage("Could not get detector UDP IP.", e.what(), "qTabAdvanced::GetDetectorUDPIP");
&QLineEdit::setText, }
&multiSlsDetector::getDetectorIP, comboDetector->currentIndex());
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP()));
} }
void qTabAdvanced::GetDetectorUDPMAC() { void qTabAdvanced::GetDetectorUDPMAC() {
FILE_LOG(logDEBUG) << "Getting Detector UDP MAC"; FILE_LOG(logDEBUG) << "Getting Detector UDP MAC";
disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getDetectorMAC(comboDetector->currentIndex());
"Could not get detector UDP MAC.", dispDetectorUDPMAC->setText(QString(retval.c_str()));
"qTabAdvanced::GetDetectorUDPMAC", } catch (const sls::NonCriticalError &e) {
dispDetectorUDPMAC, qDefs::ExceptionMessage("Could not get detector UDP MAC.", e.what(), "qTabAdvanced::GetDetectorUDPMAC");
&QLineEdit::setText, }
&multiSlsDetector::getDetectorMAC, comboDetector->currentIndex());
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC()));
} }
void qTabAdvanced::GetCltZMQPort() { void qTabAdvanced::GetCltZMQPort() {
FILE_LOG(logDEBUG) << "Getting Client ZMQ port"; FILE_LOG(logDEBUG) << "Getting Client ZMQ port";
disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->getClientStreamingPort(comboDetector->currentIndex());
"Could not get client zmq port.", spinZMQPort->setValue(retval);
"qTabAdvanced::GetCltZMQPort", } catch (const sls::NonCriticalError &e) {
spinZMQPort, qDefs::ExceptionMessage("Could not get client zmq port.", e.what(), "qTabAdvanced::GetCltZMQPort");
&QSpinBox::setValue, }
&multiSlsDetector::getClientStreamingPort, comboDetector->currentIndex());
connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); connect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int)));
} }
void qTabAdvanced::GetCltZMQIP() { void qTabAdvanced::GetCltZMQIP() {
FILE_LOG(logDEBUG) << "Getting Client ZMQ IP"; FILE_LOG(logDEBUG) << "Getting Client ZMQ IP";
disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getClientStreamingIP(comboDetector->currentIndex());
"Could not get client zmq ip.", dispZMQIP->setText(QString(retval.c_str()));
"qTabAdvanced::GetCltZMQIP", } catch (const sls::NonCriticalError &e) {
dispZMQIP, qDefs::ExceptionMessage("Could not get client zmq ip.", e.what(), "qTabAdvanced::GetCltZMQIP");
&QLineEdit::setText, }
&multiSlsDetector::getClientStreamingIP, comboDetector->currentIndex());
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
} }
void qTabAdvanced::GetRxrHostname() { void qTabAdvanced::GetRxrHostname() {
FILE_LOG(logDEBUG) << "Getting Receiver Hostname"; FILE_LOG(logDEBUG) << "Getting Receiver Hostname";
disconnect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); disconnect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getReceiverHostname(comboDetector->currentIndex());
"Could not get receiver hostname.", dispRxrHostname->setText(QString(retval.c_str()));
"qTabAdvanced::GetRxrHostname", } catch (const sls::NonCriticalError &e) {
dispRxrHostname, qDefs::ExceptionMessage("Could not get receiver hostname.", e.what(), "qTabAdvanced::GetRxrHostname");
&QLineEdit::setText, }
&multiSlsDetector::getReceiverHostname, comboDetector->currentIndex());
connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); connect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname()));
} }
void qTabAdvanced::GetReceiverOnline() { void qTabAdvanced::GetReceiverOnline() {
@ -289,99 +280,93 @@ void qTabAdvanced::GetReceiverOnline() {
; ;
} }
// display any other exception // display any other exception
catch (const exception &e) { catch (const std::exception &e) {
qDefs::ExceptionMessage("Could not check receiver online status", e.what(), "qTabAdvanced::GetReceiverOnline"); qDefs::ExceptionMessage("Could not check receiver online status", e.what(), "qTabAdvanced::GetReceiverOnline");
} }
} }
void qTabAdvanced::GetRxrTCPPort() { void qTabAdvanced::GetRxrTCPPort() {
FILE_LOG(logDEBUG) << "Getting Receiver TCP port"; FILE_LOG(logDEBUG) << "Getting Receiver TCP port";
disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->getReceiverPort(comboDetector->currentIndex());
"Could not get receiver tcp port.", spinRxrTCPPort->setValue(retval);
"qTabAdvanced::GetRxrTCPPort", } catch (const sls::NonCriticalError &e) {
spinRxrTCPPort, qDefs::ExceptionMessage("Could not get receiver tcp port.", e.what(), "qTabAdvanced::GetRxrTCPPort");
&QSpinBox::setValue, }
&multiSlsDetector::getReceiverPort, comboDetector->currentIndex());
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
} }
void qTabAdvanced::GetRxrUDPPort() { void qTabAdvanced::GetRxrUDPPort() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP port"; FILE_LOG(logDEBUG) << "Getting Receiver UDP port";
disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->getReceiverUDPPort(comboDetector->currentIndex());
"Could not get receiver udp port.", spinRxrUDPPort->setValue(retval);
"qTabAdvanced::GetRxrUDPPort", } catch (const sls::NonCriticalError &e) {
spinRxrUDPPort, qDefs::ExceptionMessage("Could not get receiver udp port.", e.what(), "qTabAdvanced::GetRxrUDPPort");
&QSpinBox::setValue, }
&multiSlsDetector::getReceiverUDPPort, comboDetector->currentIndex());
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
} }
void qTabAdvanced::GetRxrUDPIP() { void qTabAdvanced::GetRxrUDPIP() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP IP"; FILE_LOG(logDEBUG) << "Getting Receiver UDP IP";
disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getReceiverUDPIP(comboDetector->currentIndex());
"Could not get receiver udp ip.", dispRxrUDPIP->setText(QString(retval.c_str()));
"qTabAdvanced::GetRxrUDPIP", } catch (const sls::NonCriticalError &e) {
dispRxrUDPIP, qDefs::ExceptionMessage("Could not get receiver udp ip.", e.what(), "qTabAdvanced::GetRxrUDPIP");
&QLineEdit::setText, }
&multiSlsDetector::getReceiverUDPIP, comboDetector->currentIndex());
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
} }
void qTabAdvanced::GetRxrUDPMAC() { void qTabAdvanced::GetRxrUDPMAC() {
FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC"; FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC";
disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getReceiverUDPMAC(comboDetector->currentIndex());
"Could not get receiver udp mac.", dispRxrUDPMAC->setText(QString(retval.c_str()));
"qTabAdvanced::GetRxrUDPMAC", } catch (const sls::NonCriticalError &e) {
dispRxrUDPMAC, qDefs::ExceptionMessage("Could not get receiver udp mac.", e.what(), "qTabAdvanced::GetRxrUDPMAC");
&QLineEdit::setText, }
&multiSlsDetector::getReceiverUDPMAC, comboDetector->currentIndex());
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC()));
} }
void qTabAdvanced::GetRxrZMQPort() { void qTabAdvanced::GetRxrZMQPort() {
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port"; FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port";
disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->getReceiverStreamingPort(comboDetector->currentIndex());
"Could not get receiver zmq port.", spinRxrZMQPort->setValue(retval);
"qTabAdvanced::GetRxrZMQPort", } catch (const sls::NonCriticalError &e) {
spinRxrZMQPort, qDefs::ExceptionMessage("Could not get receiver zmq port.", e.what(), "qTabAdvanced::GetRxrZMQPort");
&QSpinBox::setValue, }
&multiSlsDetector::getReceiverStreamingPort, comboDetector->currentIndex());
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int)));
} }
void qTabAdvanced::GetRxrZMQIP() { void qTabAdvanced::GetRxrZMQIP() {
FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP"; FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP";
disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
qDefs::IgnoreNonCriticalExceptions<QLineEdit>( try {
myDet, auto retval = myDet->getReceiverStreamingIP(comboDetector->currentIndex());
"Could not get receiver zmq ip.", dispRxrZMQIP->setText(QString(retval.c_str()));
"qTabAdvanced::GetRxrZMQIP", } catch (const sls::NonCriticalError &e) {
dispRxrZMQIP, qDefs::ExceptionMessage("Could not get receiver zmq ip.", e.what(), "qTabAdvanced::GetRxrZMQIP");
&QLineEdit::setText, }
&multiSlsDetector::getReceiverStreamingIP, comboDetector->currentIndex());
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
} }
void qTabAdvanced::SetDetector(int index) { void qTabAdvanced::SetDetector(int index) {
@ -552,14 +537,14 @@ void qTabAdvanced::SetRxrZMQIP(){
void qTabAdvanced::AddROISlot() { void qTabAdvanced::AddROISlot() {
FILE_LOG(logDEBUG) << "Add ROI Slot"; FILE_LOG(logDEBUG) << "Add ROI Slot";
QLabel* lFromX = new QLabel("x min:"); QLabel* lFromX = new QLabel("x min:");
QLabel* lFromY = new QLabel("y min:"); QLabel* lFromY = new QLabel("y min:");
QLabel* lToX = new QLabel("x max:"); QLabel* lToX = new QLabel("x max:");
QLabel* lToY = new QLabel("y max:"); QLabel* lToY = new QLabel("y max:");
QLabel* sFromX = new QSpinBox(); QSpinBox* sFromX = new QSpinBox();
QLabel* sFromY = new QSpinBox(); QSpinBox* sFromY = new QSpinBox();
QLabel* sToX = new QSpinBox(); QSpinBox* sToX = new QSpinBox();
QLabel* sToY = new QSpinBox(); QSpinBox* sToY = new QSpinBox();
lFromX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lFromX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
lFromY->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lFromY->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
lToX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); lToX->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
@ -603,17 +588,17 @@ void qTabAdvanced::AddROISlot() {
spinToY.push_back(sToY); spinToY.push_back(sToY);
int nroi = (int)lblFromX.size(); int nroi = (int)lblFromX.size();
gridRoi->addWidget(lblFromX[nroi], i,0,Qt::AlignTop); gridRoi->addWidget(lblFromX[nroi], nroi,0,Qt::AlignTop);
gridRoi->addWidget(spinFromX[nroi], i,1,Qt::AlignTop); gridRoi->addWidget(spinFromX[nroi], nroi,1,Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,2,Qt::AlignTop); //FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,2,Qt::AlignTop);
gridRoi->addWidget(lblToX[nroi], i,3,Qt::AlignTop); gridRoi->addWidget(lblToX[nroi], nroi,3,Qt::AlignTop);
gridRoi->addWidget(spinToX[nroi], i,4,Qt::AlignTop); gridRoi->addWidget(spinToX[nroi], nroi,4,Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,5,Qt::AlignTop); //FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,5,Qt::AlignTop);
gridRoi->addWidget(lblFromY[nroi], i,6,Qt::AlignTop); gridRoi->addWidget(lblFromY[nroi], nroi,6,Qt::AlignTop);
gridRoi->addWidget(spinFromY[nroi], i,7,Qt::AlignTop); gridRoi->addWidget(spinFromY[nroi], nroi,7,Qt::AlignTop);
//FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), i,8,Qt::AlignTop); //FIXME: gridRoi->addItem(new QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed), nroi,8,Qt::AlignTop);
gridRoi->addWidget(lblToY[nroi], i,9,Qt::AlignTop); gridRoi->addWidget(lblToY[nroi], nroi,9,Qt::AlignTop);
gridRoi->addWidget(spinToY[nroi], i,10,Qt::AlignTop); gridRoi->addWidget(spinToY[nroi], nroi,10,Qt::AlignTop);
lblFromX[nroi]->show(); lblFromX[nroi]->show();
spinFromX[nroi]->show(); spinFromX[nroi]->show();
@ -633,7 +618,7 @@ void qTabAdvanced::GetROI(){
try { try {
int nroi = 0; int nroi = 0;
slsDetectorDefs::ROI* roi = myDet->getROI(nroi); const slsDetectorDefs::ROI* roi = myDet->getROI(nroi);
if (roi != nullptr) { if (roi != nullptr) {
for (int i = 0; i < nroi; ++i) { for (int i = 0; i < nroi; ++i) {
AddROISlot(); AddROISlot();
@ -663,7 +648,7 @@ void qTabAdvanced::ClearROIWidgets() {
} }
// delete widgets // delete widgets
for (int i = 0; i < lblFromX.size(); ++i) { for (size_t i = 0; i < lblFromX.size(); ++i) {
delete lblFromX[i]; delete lblFromX[i];
delete spinFromX[i]; delete spinFromX[i];
delete lblToX[i]; delete lblToX[i];
@ -708,11 +693,11 @@ void qTabAdvanced::SetROI() {
// set roi // set roi
FILE_LOG(logINFO) << "Setting ROI:" << nroi; FILE_LOG(logINFO) << "Setting ROI:" << nroi;
qDefs::IgnoreNonCriticalExceptions( try {
myDet, myDet->setROI(nroi, roi, -1);
"Could not set these ROIs.", } catch (const sls::NonCriticalError &e) {
"qTabAdvanced::SetROI", qDefs::ExceptionMessage("Could not set these ROIs.", e.what(), "qTabAdvanced::SetROI");
&multiSlsDetector::setROI, nroi, roi, -1); }
// update corrected list // update corrected list
GetROI(); GetROI();
@ -720,17 +705,16 @@ void qTabAdvanced::SetROI() {
void qTabAdvanced::GetAllTrimbits() { void qTabAdvanced::GetAllTrimbits() {
FILE_LOG(logDEBUG) << "Getting all trimbits value"; FILE_LOG(logDEBUG) << "Getting all trimbits value";
disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits()));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, int retval = myDet->setAllTrimbits(-1);
"Could not get all trimbits value.", spinSetAllTrimbits->setValue(retval);
"qTabAdvanced::GetAllTrimbits", } catch (const sls::NonCriticalError &e) {
spinSetAllTrimbits, qDefs::ExceptionMessage("Could not get all trimbits.", e.what(), "qTabAdvanced::GetAllTrimbits");
&QSpinBox::setValue, }
&multiSlsDetector::setAllTrimbits, -1, -1);
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits()));
} }
void qTabAdvanced::SetAllTrimbits() { void qTabAdvanced::SetAllTrimbits() {
@ -747,17 +731,16 @@ void qTabAdvanced::SetAllTrimbits() {
void qTabAdvanced::GetNumStoragecells() { void qTabAdvanced::GetNumStoragecells() {
FILE_LOG(logDEBUG) << "Getting number of additional storage cells"; FILE_LOG(logDEBUG) << "Getting number of additional storage cells";
disconnect(spinNumStoragecells,SIGNAL(valueChanged(int)),this, SLOT(SetNumStoragecells(int))); disconnect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
qDefs::IgnoreNonCriticalExceptions<QSpinBox>( try {
myDet, auto retval = myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER);
"Could not get number of additional storage cells.", spinNumStoragecells->setValue(retval);
"qTabAdvanced::GetNumStoragecells", } catch (const sls::NonCriticalError &e) {
spinNumStoragecells, qDefs::ExceptionMessage("Could not get number of additional storage cells.", e.what(), "qTabAdvanced::GetNumStoragecells");
&QSpinBox::setValue, }
&multiSlsDetector::setTimer, slsDetectorDefs::STORAGE_CELL_NUMBER, -1, -1);
connect(spinNumStoragecells,SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
} }
void qTabAdvanced::SetNumStoragecells(int value) { void qTabAdvanced::SetNumStoragecells(int value) {
@ -772,8 +755,8 @@ void qTabAdvanced::SetNumStoragecells(int value) {
void qTabAdvanced::GetSubExposureTime() { void qTabAdvanced::GetSubExposureTime() {
FILE_LOG(logDEBUG) << "Getting sub exposure time"; FILE_LOG(logDEBUG) << "Getting sub exposure time";
disconnect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); disconnect(spinSubExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
disconnect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubExposureTime())); disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
try { try {
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME); int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME);
@ -791,8 +774,8 @@ void qTabAdvanced::GetSubExposureTime() {
qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime"); qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime");
} }
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); connect(spinSubExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime())); connect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
} }
void qTabAdvanced::SetSubExposureTime() { void qTabAdvanced::SetSubExposureTime() {
@ -809,8 +792,8 @@ void qTabAdvanced::SetSubExposureTime() {
void qTabAdvanced::GetSubDeadTime() { void qTabAdvanced::GetSubDeadTime() {
FILE_LOG(logDEBUG) << "Getting sub dead time"; FILE_LOG(logDEBUG) << "Getting sub dead time";
disconnect(spinSubDeadTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); disconnect(spinSubDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime()));
disconnect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubDeadTime())); disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime()));
try { try {
int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME); int64_t retval = myDet->setTimer(slsDetectorDefs::SUBFRAME_DEADTIME);
@ -828,8 +811,8 @@ void qTabAdvanced::GetSubDeadTime() {
qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime"); qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime");
} }
connect(spinSubDeadTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime()));
connect(comboSubDeadTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubDeadTime())); connect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubDeadTime()));
} }
void qTabAdvanced::SetSubDeadTime() { void qTabAdvanced::SetSubDeadTime() {
@ -874,4 +857,3 @@ void qTabAdvanced::Refresh(){
FILE_LOG(logDEBUG) << "**Updated Advanced Tab"; FILE_LOG(logDEBUG) << "**Updated Advanced Tab";
} }