rxr sls namespace (#457)

* rxr src files and classes (detectordata, ZmqSocket) added to sls namespace

* moving defines inside namespace

* moving defines inside namespace, added helpdacs to namespace

* added namespace to gui

* gui also updated

* removed unnecessary sls:: when already in sls namespace for slsDetectoSoftware, receverSoftware, slsDetectorGui and slsSupportlib
This commit is contained in:
Dhanya Thattil
2022-05-18 11:48:38 +02:00
committed by GitHub
parent fcc7f7aef8
commit 4259363169
88 changed files with 1200 additions and 923 deletions

View File

@ -5,6 +5,8 @@
#include <QMainWindow>
#include <QString>
namespace sls {
class SlsQtH1D;
class SlsQt1DPlot;
class SlsQt2DPlot;
@ -43,3 +45,5 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
static int NumClones;
};
} // namespace sls

View File

@ -6,11 +6,13 @@
#include "ui_form_dac.h"
#include <string>
namespace sls {
class qDacWidget : public QWidget, private Ui::WidgetDacObject {
Q_OBJECT
public:
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
qDacWidget(QWidget *parent, Detector *detector, bool d, std::string n,
slsDetectorDefs::dacIndex i);
~qDacWidget();
void SetDetectorIndex(int id);
@ -25,8 +27,10 @@ class qDacWidget : public QWidget, private Ui::WidgetDacObject {
void GetAdc();
void Refresh();
sls::Detector *det;
Detector *det;
bool isDac{true};
slsDetectorDefs::dacIndex index;
int detectorIndex{-1};
};
} // namespace sls

View File

@ -14,6 +14,8 @@
#include <ostream>
#include <string>
namespace sls {
using std::chrono::duration;
using std::chrono::duration_cast;
using std::chrono::hours;
@ -47,9 +49,9 @@ class qDefs : public QWidget {
static void DisplayExceptions(std::string emsg, std::string src) {
try {
throw;
} catch (const sls::SocketError &e) {
} catch (const SocketError &e) {
throw;
} catch (const sls::SharedMemoryError &e) {
} catch (const SharedMemoryError &e) {
throw;
} catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
@ -63,9 +65,9 @@ class qDefs : public QWidget {
typename NonDeduced<CT>::type... Args) {
try {
throw;
} catch (const sls::SocketError &e) {
} catch (const SocketError &e) {
throw;
} catch (const sls::SharedMemoryError &e) {
} catch (const SharedMemoryError &e) {
throw;
} catch (const std::exception &e) {
ExceptionMessage(emsg, e.what(), src);
@ -329,3 +331,5 @@ class qDefs : public QWidget {
source);
}
};
} // namespace sls

View File

@ -6,6 +6,11 @@
#include "ui_form_detectormain.h"
#include <QTabWidget>
class QScrollArea;
class QResizeEvent;
namespace sls {
class qDrawPlot;
class qTabMeasurement;
class qTabDataOutput;
@ -15,8 +20,6 @@ class qTabSettings;
class qTabDebugging;
class qTabDeveloper;
class qTabMessages;
class QScrollArea;
class QResizeEvent;
/** To Over-ride the QTabWidget class to get the tabBar protected
* methodTabWidget */
@ -70,7 +73,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
NumberOfTabs
};
slsDetectorDefs::detectorType detType;
std::unique_ptr<sls::Detector> det;
std::unique_ptr<Detector> det;
qDrawPlot *plot;
MyTabWidget *tabs;
QScrollArea *scroll[NumberOfTabs];
@ -88,3 +91,5 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
QString zoomToolTip;
QColor defaultTabColor;
};
} // namespace sls

View File

@ -6,18 +6,21 @@
#include "ui_form_plot.h"
#include <mutex>
class QResizeEvent;
namespace sls {
class SlsQt1DPlot;
class SlsQtH1D;
class SlsQt2DPlot;
class qCloneWidget;
class detectorData;
class QResizeEvent;
class qDrawPlot : public QWidget, private Ui::PlotObject {
Q_OBJECT
public:
qDrawPlot(QWidget *parent, sls::Detector *detector);
qDrawPlot(QWidget *parent, Detector *detector);
~qDrawPlot();
bool GetIsRunning();
void SetRunning(bool enable);
@ -96,7 +99,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
static const int NUM_PEDESTAL_FRAMES = 20;
static const int NUM_GOTTHARD25_CHANS = 1280;
sls::Detector *det;
Detector *det;
slsDetectorDefs::detectorType detType;
SlsQt1DPlot *plot1d{nullptr};
@ -172,3 +175,5 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
int gainOffset{0};
bool gotthard25;
};
} // namespace sls

View File

@ -4,13 +4,15 @@
#include "sls/Detector.h"
#include "ui_form_tab_advanced.h"
namespace sls {
class qDrawPlot;
class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
Q_OBJECT
public:
qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
qTabAdvanced(QWidget *parent, Detector *detector, qDrawPlot *p);
~qTabAdvanced();
public slots:
@ -74,6 +76,8 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void GetExposureTime();
void GetGateDelay();
sls::Detector *det;
Detector *det;
qDrawPlot *plot;
};
} // namespace sls

View File

@ -4,11 +4,13 @@
#include "sls/Detector.h"
#include "ui_form_tab_dataoutput.h"
namespace sls {
class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
Q_OBJECT
public:
qTabDataOutput(QWidget *parent, sls::Detector *detector);
qTabDataOutput(QWidget *parent, Detector *detector);
~qTabDataOutput();
void Refresh();
@ -39,7 +41,9 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
void GetSpeed();
void GetParallel();
sls::Detector *det;
Detector *det;
// Button group for radiobuttons for rate
QButtonGroup *btnGroupRate;
};
} // namespace sls

View File

@ -7,11 +7,13 @@
class QTreeWidget;
class QTreeWidgetItem;
namespace sls {
class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
Q_OBJECT
public:
qTabDebugging(QWidget *parent, sls::Detector *detector);
qTabDebugging(QWidget *parent, Detector *detector);
~qTabDebugging();
void Refresh();
@ -26,10 +28,12 @@ class qTabDebugging : public QWidget, private Ui::TabDebuggingObject {
void Initialization();
void PopulateDetectors();
sls::Detector *det;
Detector *det;
/** Tree Widget displaying the detectors, modules */
QTreeWidget *treeDet;
QLabel *lblDetectorHostname;
QLabel *lblDetectorFirmware;
QLabel *lblDetectorSoftware;
};
} // namespace sls

View File

@ -6,13 +6,15 @@
#include "ui_form_tab_developer.h"
#include <vector>
namespace sls {
class qDacWidget;
class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
Q_OBJECT
public:
qTabDeveloper(QWidget *parent, sls::Detector *detector);
qTabDeveloper(QWidget *parent, Detector *detector);
~qTabDeveloper();
public slots:
@ -29,7 +31,7 @@ class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
int index);
sls::Detector *det;
Detector *det;
std::vector<qDacWidget *> dacWidgets;
std::vector<qDacWidget *> adcWidgets;
@ -38,3 +40,5 @@ class qTabDeveloper : public QWidget, private Ui::TabDeveloperObject {
static const int HV_MIN = 60;
static const int HV_MAX = 200;
};
} // namespace sls

View File

@ -4,14 +4,17 @@
#include "sls/Detector.h"
#include "ui_form_tab_measurement.h"
class qDrawPlot;
class QStandardItemModel;
namespace sls {
class qDrawPlot;
class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
Q_OBJECT
public:
qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
qTabMeasurement(QWidget *parent, Detector *detector, qDrawPlot *p);
~qTabMeasurement();
void Refresh();
@ -81,7 +84,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void FileNameChangedSignal(QString);
private:
sls::Detector *det;
Detector *det;
qDrawPlot *plot;
// enum for the timing mode
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
@ -98,3 +101,5 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
int numMeasurements{1};
int currentMeasurement{0};
};
} // namespace sls

View File

@ -6,6 +6,8 @@
class QProcess;
class QKeyEvent;
namespace sls {
class qTabMessages : public QWidget, private Ui::TabMessagesObject {
Q_OBJECT
@ -34,3 +36,5 @@ class qTabMessages : public QWidget, private Ui::TabMessagesObject {
QProcess *process;
QStringList lastCommand;
};
} // namespace sls

View File

@ -4,13 +4,15 @@
#include "sls/Detector.h"
#include "ui_form_tab_plot.h"
namespace sls {
class qDrawPlot;
class qTabPlot : public QWidget, private Ui::TabPlotObject {
Q_OBJECT
public:
qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p);
qTabPlot(QWidget *parent, Detector *detector, qDrawPlot *p);
~qTabPlot();
void SetScanArgument();
void Refresh();
@ -53,7 +55,7 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
void SetXYRange();
void MaintainAspectRatio(int dimension);
sls::Detector *det;
Detector *det;
qDrawPlot *plot;
bool is1d;
@ -65,3 +67,5 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle;
};
} // namespace sls

View File

@ -5,11 +5,13 @@
#include "ui_form_tab_settings.h"
#include <QCheckBox>
namespace sls {
class qTabSettings : public QWidget, private Ui::TabSettingsObject {
Q_OBJECT
public:
qTabSettings(QWidget *parent, sls::Detector *detector);
qTabSettings(QWidget *parent, Detector *detector);
~qTabSettings();
void Refresh();
public slots:
@ -37,7 +39,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
void GetThresholdEnergies();
void GetCounterMask();
sls::Detector *det;
Detector *det;
std::vector<QCheckBox *> counters;
enum {
@ -77,3 +79,5 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
DYNAMICRANGE_4
};
};
} // namespace sls

View File

@ -12,9 +12,12 @@
#include <qwt_plot_shapeitem.h>
class QPen;
class SlsQt1DPlot;
class QwtSymbol;
namespace sls {
class SlsQt1DPlot;
class SlsQtH1D : public QwtPlotCurve {
public:
@ -170,4 +173,8 @@ class SlsQt1DPlot : public QwtPlot {
void Update();
};
} // namespace sls
#endif

View File

@ -8,6 +8,8 @@
#include <qwt_plot_panner.h>
#include <qwt_plot_zoomer.h>
namespace sls {
class SlsQtH1D;
class SlsQt1DZoomer : public QwtPlotZoomer {
@ -51,4 +53,6 @@ class SlsQt1DZoomer : public QwtPlotZoomer {
}
};
} // namespace sls
#endif

View File

@ -9,6 +9,8 @@
#include <qwt_scale_draw.h>
#include <qwt_scale_widget.h>
namespace sls {
class SlsQt2DHist : public QwtRasterData {
private:
@ -125,4 +127,6 @@ class SlsQt2DHist : public QwtRasterData {
}
};
} // namespace sls
#endif

View File

@ -12,6 +12,8 @@ class QwtPlotPanner;
class QwtScaleWidget;
class QwtLinearColorMap;
namespace sls {
class SlsQt2DPlot : public QwtPlot {
Q_OBJECT
@ -91,3 +93,5 @@ class SlsQt2DPlot : public QwtPlot {
int isLog;
QwtPlotShapeItem *roiBox{nullptr};
};
} // namespace sls

View File

@ -7,6 +7,8 @@
#include <qwt_plot_panner.h>
#include <qwt_plot_zoomer.h>
namespace sls {
class SlsQt2DZoomer : public QwtPlotZoomer {
private:
SlsQt2DHist *hist;
@ -40,4 +42,6 @@ class SlsQt2DZoomer : public QwtPlotZoomer {
}
};
} // namespace sls
#endif

View File

@ -15,6 +15,8 @@
#include <qwt_symbol.h>
#include <stdlib.h>
namespace sls {
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
@ -602,3 +604,5 @@ void SlsQt1DPlot::DisableZoom(bool disable) {
}
}
}
} // namespace sls

View File

@ -7,6 +7,8 @@
#include <qwt_plot.h>
#include <qwt_scale_div.h>
namespace sls {
void SlsQt1DZoomer::ResetZoomBase() {
SetZoomBase(x0, y0, x1 - x0,
y1 - y0); // for going between log and nonlog plots
@ -93,3 +95,5 @@ void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D *h) {
ResetZoomBase();
}
} // namespace sls

View File

@ -9,6 +9,8 @@
using std::cout;
using std::endl;
namespace sls {
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
double ymin, double ymax, double *d, double zmin,
double zmax)
@ -143,3 +145,5 @@ double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
return z_min;
}
} // namespace sls

View File

@ -18,6 +18,8 @@
#include <cmath>
#include <iostream>
namespace sls {
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
isLog = 0;
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
@ -312,3 +314,4 @@ void SlsQt2DPlot::DisableRoiBox() {
}
}
} // namespace sls

View File

@ -11,6 +11,8 @@
#include <QPainter>
#include <qwt_text.h>
namespace sls {
int qCloneWidget::NumClones{0};
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
@ -44,7 +46,7 @@ qCloneWidget::~qCloneWidget() {
void qCloneWidget::SetupWidgetWindow(QString title) {
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
std::string(" - ") + sls::Logger::Timestamp();
std::string(" - ") + Logger::Timestamp();
setWindowTitle(QString(winTitle.c_str()));
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
@ -146,4 +148,6 @@ void qCloneWidget::resizeEvent(QResizeEvent *event) {
qDefs::DATA_GAIN_PLOT_RATIO);
}
event->accept();
}
}
} // namespace sls

View File

@ -3,7 +3,9 @@
#include "qDacWidget.h"
#include "qDefs.h"
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
namespace sls {
qDacWidget::qDacWidget(QWidget *parent, Detector *detector, bool d,
std::string n, slsDetectorDefs::dacIndex i)
: QWidget(parent), det(detector), isDac(d), index(i) {
setupUi(this);
@ -94,3 +96,5 @@ void qDacWidget::Refresh() {
GetAdc();
}
}
} // namespace sls

View File

@ -59,7 +59,7 @@ int main(int argc, char **argv) {
case 'f':
fname = optarg;
LOG(logDEBUG) << long_options[option_index].name << " " << optarg;
LOG(sls::logDEBUG) << long_options[option_index].name << " " << optarg;
break;
case 'd':
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
case 'v':
tempval = APIGUI;
LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
LOG(sls::logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
<< std::hex << tempval << ")";
return 0;
@ -88,7 +88,7 @@ int main(int argc, char **argv) {
"i. Default: 0. Required \n" +
"\t only when more than one multi "
"detector object is needed.\n\n";
LOG(logERROR) << help_message;
LOG(sls::logERROR) << help_message;
return -1;
}
}
@ -96,16 +96,18 @@ int main(int argc, char **argv) {
QApplication app(argc, argv);
app.setStyle(new QPlastiqueStyle); // style is deleted by QApplication
try {
qDetectorMain det(multiId, fname, isDeveloper);
sls::qDetectorMain det(multiId, fname, isDeveloper);
det.show();
app.exec();
} catch (const std::exception &e) {
qDefs::Message(qDefs::CRITICAL,
sls::qDefs::Message(sls::qDefs::CRITICAL,
std::string(e.what()) + "\nExiting Gui :'( ", "main");
}
return 0;
}
namespace sls {
qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
bool isDevel)
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC),
@ -212,7 +214,7 @@ void qDetectorMain::SetUpWidgetWindow() {
void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
// instantiate detector and set window title
det = sls::make_unique<sls::Detector>(multiID);
det = make_unique<Detector>(multiID);
// create messages tab to capture config file loading logs
tabMessages = new qTabMessages(this);
@ -238,15 +240,15 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
default:
std::ostringstream os;
os << det->getHostname() << " has "
<< sls::ToString(det->getDetectorType().squash())
<< ToString(det->getDetectorType().squash())
<< " detector type (" << std::to_string(detType)
<< "). Exiting GUI.";
std::string errorMess = os.str();
throw sls::RuntimeError(errorMess.c_str());
throw RuntimeError(errorMess.c_str());
}
std::ostringstream os;
os << "SLS Detector GUI : "
<< sls::ToString(det->getDetectorType().squash()) << " - "
<< ToString(det->getDetectorType().squash()) << " - "
<< det->getHostname();
std::string title = os.str();
LOG(logINFO) << title;
@ -441,10 +443,10 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
"Gotthard, Gotthard2 and Moench detectors";
std::string guiVersion = sls::ToStringHex(APIGUI);
std::string guiVersion = ToStringHex(APIGUI);
std::string clientVersion = "unknown";
try {
clientVersion = sls::ToStringHex(det->getClientVersion());
clientVersion = ToStringHex(det->getClientVersion());
}
CATCH_DISPLAY("Could not get client version.",
"qDetectorMain::ExecuteHelp")
@ -609,3 +611,5 @@ void qDetectorMain::SetZoomToolTip(bool disable) {
else
dockWidgetPlot->setToolTip(zoomToolTip);
}
} // namespace sls

View File

@ -14,7 +14,9 @@
#include <QResizeEvent>
#include <QtConcurrentRun>
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector)
namespace sls {
qDrawPlot::qDrawPlot(QWidget *parent, Detector *detector)
: QWidget(parent), det(detector) {
setupUi(this);
SetupWidgetWindow();
@ -728,7 +730,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
int detectorStatus) {
progress = currentProgress;
std::string status =
sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
if (detectorStatus == slsDetectorDefs::ERROR) {
qDefs::Message(qDefs::WARNING,
@ -761,7 +763,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
<< " \t dynamic range: " << data->dynamicRange << std::endl
<< " \t file index: " << data->fileIndex << std::endl
<< " \t complete image: " << data->completeImage << std::endl
<< " \t rx Roi: " << sls::ToString(data->rxRoi) << std::endl
<< " \t rx Roi: " << ToString(data->rxRoi) << std::endl
<< " ]";
progress = data->progressIndex;
@ -780,9 +782,9 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
rxRoi.xmax += ((rxRoi.xmax/1024) * 6 + (rxRoi.xmax/256) * 2);
rxRoi.ymin += ((rxRoi.ymin/512) * 34 + (rxRoi.ymin/256) * 2);
rxRoi.ymax += ((rxRoi.ymax/512) * 34 + (rxRoi.ymax/256) * 2);
LOG(logINFO) << "Rx_roi recalculated with gap pixels: " << sls::ToString(rxRoi);
LOG(logINFO) << "Rx_roi recalculated with gap pixels: " << ToString(rxRoi);
}
LOG(logDEBUG) << "Rx_roi: " << sls::ToString(rxRoi);
LOG(logDEBUG) << "Rx_roi: " << ToString(rxRoi);
}
@ -1272,3 +1274,5 @@ void qDrawPlot::UpdatePlot() {
LOG(logDEBUG) << "End of Update Plot";
}
} // namespace sls

View File

@ -5,7 +5,9 @@
#include "qDrawPlot.h"
#include "sls/network_utils.h"
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
namespace sls {
qTabAdvanced::qTabAdvanced(QWidget *parent, Detector *detector,
qDrawPlot *p)
: QWidget(parent), det(detector), plot(p) {
setupUi(this);
@ -443,7 +445,7 @@ void qTabAdvanced::SetDetectorUDPIP(bool force) {
std::string s = dispDetectorUDPIP->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP IP:" << s;
try {
det->setSourceUDPIP(sls::IpAddr{s},
det->setSourceUDPIP(IpAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Detector UDP IP.",
@ -461,7 +463,7 @@ void qTabAdvanced::SetDetectorUDPMAC(bool force) {
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
try {
det->setSourceUDPMAC(sls::MacAddr{s},
det->setSourceUDPMAC(MacAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Detector UDP MAC.",
@ -489,7 +491,7 @@ void qTabAdvanced::SetCltZMQIP(bool force) {
std::string s = dispZMQIP->text().toAscii().constData();
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
try {
det->setClientZmqIp(sls::IpAddr{s},
det->setClientZmqIp(IpAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Client ZMQ IP.",
@ -547,7 +549,7 @@ void qTabAdvanced::SetRxrUDPIP(bool force) {
std::string s = dispRxrUDPIP->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
try {
det->setDestinationUDPIP(sls::IpAddr{s},
det->setDestinationUDPIP(IpAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Receiver UDP IP.",
@ -565,7 +567,7 @@ void qTabAdvanced::SetRxrUDPMAC(bool force) {
std::string s = dispRxrUDPMAC->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
try {
det->setDestinationUDPMAC(sls::MacAddr{s},
det->setDestinationUDPMAC(MacAddr{s},
{comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Receiver UDP MAC.",
@ -593,7 +595,7 @@ void qTabAdvanced::SetRxrZMQIP(bool force) {
std::string s = dispRxrZMQIP->text().toAscii().constData();
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
try {
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
det->setRxZmqIP(IpAddr{s}, {comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Receiver ZMQ IP.",
"qTabAdvanced::SetRxrZMQIP", this,
@ -891,3 +893,5 @@ void qTabAdvanced::Refresh() {
}
LOG(logDEBUG) << "**Updated Advanced Tab";
}
} // namespace sls

View File

@ -11,7 +11,9 @@
#include <unistd.h>
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
namespace sls {
qTabDataOutput::qTabDataOutput(QWidget *parent, Detector *detector)
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
setupUi(this);
SetupWidgetWindow();
@ -232,7 +234,7 @@ void qTabDataOutput::GetFileFormat() {
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
break;
default:
throw sls::RuntimeError(std::string("Unknown file format: ") +
throw RuntimeError(std::string("Unknown file format: ") +
std::to_string(static_cast<int>(retval)));
}
}
@ -339,7 +341,7 @@ void qTabDataOutput::EnableRateCorrection() {
LOG(logINFO) << "Disabling Rate correction";
// disable
try {
det->setRateCorrection(sls::ns(0));
det->setRateCorrection(ns(0));
}
CATCH_HANDLE("Could not switch off rate correction.",
"qTabDataOutput::EnableRateCorrection", this,
@ -357,7 +359,7 @@ void qTabDataOutput::SetRateCorrection() {
int64_t deadtime = spinCustomDeadTime->value();
LOG(logINFO) << "Setting Rate Correction with custom dead time: "
<< deadtime;
det->setRateCorrection(sls::ns(deadtime));
det->setRateCorrection(ns(deadtime));
}
// default dead time
else {
@ -442,3 +444,5 @@ void qTabDataOutput::Refresh() {
LOG(logDEBUG) << "**Updated DataOutput Tab";
}
} // namespace sls

View File

@ -7,7 +7,9 @@
#include <QGridLayout>
#include <QTreeWidget>
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
namespace sls {
qTabDebugging::qTabDebugging(QWidget *parent, Detector *detector)
: QWidget(parent), det(detector), treeDet(nullptr),
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
lblDetectorSoftware(nullptr) {
@ -62,7 +64,7 @@ void qTabDebugging::GetDetectorStatus() {
LOG(logDEBUG) << "Getting Status";
try {
std::string status = sls::ToString(
std::string status = ToString(
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
lblStatus->setText(QString(status.c_str()).toUpper());
}
@ -88,7 +90,7 @@ void qTabDebugging::GetInfo() {
lblDetectorFirmware->setFixedWidth(100);
layout->addWidget(dispFrame, 0, 1);
QString detName =
QString(sls::ToString(det->getDetectorType().squash()).c_str());
QString(ToString(det->getDetectorType().squash()).c_str());
switch (det->getDetectorType().squash()) {
@ -241,3 +243,5 @@ void qTabDebugging::Refresh() {
GetDetectorStatus();
LOG(logDEBUG) << "**Updated Debugging Tab";
}
} // namespace sls

View File

@ -4,7 +4,9 @@
#include "qDacWidget.h"
#include "qDefs.h"
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector)
namespace sls {
qTabDeveloper::qTabDeveloper(QWidget *parent, Detector *detector)
: QWidget(parent), det(detector) {
setupUi(this);
SetupWidgetWindow();
@ -324,7 +326,7 @@ void qTabDeveloper::GetHighVoltage() {
// spinHV
if (spinHV->isVisible()) {
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
spinHV->setValue(retval);
@ -354,7 +356,7 @@ void qTabDeveloper::GetHighVoltage() {
comboHV->setCurrentIndex(HV_200);
break;
default:
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
}
}
@ -431,7 +433,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 22:
return slsDetectorDefs::TEMPERATURE_FPGA;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
@ -458,7 +460,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 9:
return slsDetectorDefs::TEMPERATURE_FPGA;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
@ -484,7 +486,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 8:
return slsDetectorDefs::TEMPERATURE_ADC;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
@ -508,7 +510,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 7:
return slsDetectorDefs::IBIAS_SFP;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
@ -550,7 +552,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 16:
return slsDetectorDefs::VTHRESHOLD;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
@ -586,13 +588,13 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 13:
return slsDetectorDefs::VCOM_ADC2;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
default:
throw sls::RuntimeError(std::string("Unknown detector type"));
throw RuntimeError(std::string("Unknown detector type"));
}
}
@ -607,3 +609,5 @@ void qTabDeveloper::Refresh() {
GetHighVoltage();
LOG(logDEBUG) << "**Updated Developer Tab";
}
} // namespace sls

View File

@ -7,7 +7,9 @@
#include <QStandardItemModel>
#include <QTimer>
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector,
namespace sls {
qTabMeasurement::qTabMeasurement(QWidget *parent, Detector *detector,
qDrawPlot *p)
: QWidget(parent), det(detector), plot(p), progressTimer(nullptr) {
setupUi(this);
@ -343,7 +345,7 @@ void qTabMeasurement::GetTimingMode() {
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
auto retvals = det->getTimingMode();
auto is_master = det->getMaster();
sls::Result<slsDetectorDefs::timingMode> masterRetvals;
Result<slsDetectorDefs::timingMode> masterRetvals;
for (size_t i = 0; i != is_master.size(); ++i) {
if (is_master[i]) {
masterRetvals.push_back(retvals[i]);
@ -370,7 +372,7 @@ void qTabMeasurement::GetTimingMode() {
}
break;
default:
throw sls::RuntimeError(std::string("Unknown timing mode: ") +
throw RuntimeError(std::string("Unknown timing mode: ") +
std::to_string(retval));
}
}
@ -407,7 +409,7 @@ void qTabMeasurement::GetBurstMode() {
ShowTriggerDelay();
break;
default:
throw sls::RuntimeError(std::string("Unknown burst mode: ") +
throw RuntimeError(std::string("Unknown burst mode: ") +
std::to_string(retval));
}
}
@ -1017,3 +1019,5 @@ void qTabMeasurement::Refresh() {
LOG(logDEBUG) << "**Updated Measurement Tab";
}
} // namespace sls

View File

@ -11,6 +11,8 @@
#include <QTextStream>
#include <string>
namespace sls {
qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) {
setupUi(this);
SetupWidgetWindow();
@ -142,3 +144,5 @@ void qTabMessages::Refresh() {
dispCommand->clear();
dispCommand->setFocus();
}
} // namespace sls

View File

@ -6,6 +6,8 @@
#include <QStackedLayout>
#include <QStandardItemModel>
namespace sls {
QString qTabPlot::defaultPlotTitle("");
QString qTabPlot::defaultHistXAxisTitle("Channel Number");
QString qTabPlot::defaultHistYAxisTitle("Counts");
@ -13,7 +15,7 @@ QString qTabPlot::defaultImageXAxisTitle("Pixel");
QString qTabPlot::defaultImageYAxisTitle("Pixel");
QString qTabPlot::defaultImageZAxisTitle("Intensity");
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
qTabPlot::qTabPlot(QWidget *parent, Detector *detector, qDrawPlot *p)
: QWidget(parent), det(detector), plot(p), is1d(false) {
setupUi(this);
SetupWidgetWindow();
@ -797,3 +799,5 @@ void qTabPlot::Refresh() {
LOG(logDEBUG) << "**Updated Plot Tab";
}
} // namespace sls

View File

@ -6,7 +6,9 @@
#include "sls/bit_utils.h"
#include <QStandardItemModel>
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
namespace sls {
qTabSettings::qTabSettings(QWidget *parent, Detector *detector)
: QWidget(parent), det(detector) {
setupUi(this);
SetupWidgetWindow();
@ -215,7 +217,7 @@ void qTabSettings::GetSettings() {
break;
default:
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
throw sls::RuntimeError(std::string("Unknown settings: ") +
throw RuntimeError(std::string("Unknown settings: ") +
std::to_string(retval));
}
comboSettings->setCurrentIndex(retval);
@ -231,7 +233,7 @@ void qTabSettings::SetSettings(int index) {
// settings
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
try {
LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
LOG(logINFO) << "Setting Settings to " << ToString(val);
det->setSettings(val);
}
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
@ -250,7 +252,7 @@ void qTabSettings::GetGainMode() {
auto retval = det->getGainMode().tsquash(
"Inconsistent gain mode for all detectors.");
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
throw sls::RuntimeError(std::string("Unknown gain mode: ") +
throw RuntimeError(std::string("Unknown gain mode: ") +
std::to_string(retval));
}
// warning when using fix_g0 and not in export mode
@ -321,7 +323,7 @@ void qTabSettings::GetDynamicRange() {
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
break;
default:
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
throw RuntimeError(std::string("Unknown dynamic range: ") +
std::to_string(retval));
}
}
@ -352,7 +354,7 @@ void qTabSettings::SetDynamicRange(int index) {
det->setDynamicRange(4);
break;
default:
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
throw RuntimeError(std::string("Unknown dynamic range: ") +
std::to_string(index));
}
}
@ -399,7 +401,7 @@ void qTabSettings::SetThresholdEnergies() {
slsDetectorDefs::detectorSettings sett =
static_cast<slsDetectorDefs::detectorSettings>(
comboSettings->currentIndex());
LOG(logINFO) << "Setting Threshold Energies to " << sls::ToString(eV)
LOG(logINFO) << "Setting Threshold Energies to " << ToString(eV)
<< " (eV)";
try {
det->setThresholdEnergy(eV, sett);
@ -430,7 +432,7 @@ void qTabSettings::GetCounterMask() {
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
SLOT(SetCounterMask()));
try {
auto retval = sls::getSetBits(det->getCounterMask().tsquash(
auto retval = getSetBits(det->getCounterMask().tsquash(
"Counter mask is inconsistent for all detectors."));
// default to unchecked
for (auto p : counters) {
@ -439,7 +441,7 @@ void qTabSettings::GetCounterMask() {
// if retval[i] = 2, chkCounter2 is checked
for (auto i : retval) {
if (i > 3) {
throw sls::RuntimeError(
throw RuntimeError(
std::string("Unknown counter index : ") +
std::to_string(static_cast<int>(i)));
}
@ -496,3 +498,5 @@ void qTabSettings::Refresh() {
LOG(logDEBUG) << "**Updated Settings Tab";
}
} // namespace sls