mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Qt5 built in qwt (#570)
- qt4->qt5 - in built qt5 6.1.5 because rhel7 is not upto date with qt5, removed findqwt.cmake - made a fix in qwt lib (qwt_plot_layout.h) to work with 5.15 and lower versions for qrect constr. - qt5 forms fixed, qt4 many hard coding forms switched to forms including qtabwidget, scrolls etc, fonts moved to forms - docking option enabled by default, removed option to disable docking feature from "Mode" - added qVersionResolve utility functions to handle compatibility before and after qt5.12 - qtplots (ian's code) takes in gain mode enable to set some settings within the class, with proper gain plot ticks - ensure gain plots have no zooming of z axis in 2d and y axis in 1d - removed placeholder text in qpalette in main window form as its not supportd until 5.12 (so using qt5.9 designer insted of qt5.15 to cope) - tab order Servers: - fixed some error messages that were empty for fail in funcs (mostly minor as if this error, major issues)
This commit is contained in:
@ -49,7 +49,6 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
std::string(" - ") + Logger::Timestamp();
|
||||
setWindowTitle(QString(winTitle.c_str()));
|
||||
|
||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
boxPlot->setTitle(title);
|
||||
|
||||
// 1d
|
||||
@ -108,7 +107,7 @@ void qCloneWidget::SavePlot() {
|
||||
QString fName = filePath + QString('/') + fileName + QString("_clone") +
|
||||
QString("%1").arg(id) + QString("_acq") +
|
||||
QString("%1").arg(acqIndex) + QString(".png");
|
||||
LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
||||
LOG(logINFO) << "Saving Clone:" << fName.toLatin1().constData();
|
||||
// save
|
||||
QImage img(centralwidget->size().width(), centralwidget->size().height(),
|
||||
QImage::Format_RGB32);
|
||||
|
@ -61,7 +61,7 @@ void qDacWidget::GetDac() {
|
||||
|
||||
void qDacWidget::SetDac() {
|
||||
int val = (int)spinDac->value();
|
||||
LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : "
|
||||
LOG(logINFO) << "Setting dac:" << lblDac->text().toLatin1().data() << " : "
|
||||
<< val;
|
||||
|
||||
try {
|
||||
|
@ -16,9 +16,7 @@
|
||||
#include "sls/versionAPI.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
|
||||
#include "sls/Version.h"
|
||||
@ -102,7 +100,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new QPlastiqueStyle); // style is deleted by QApplication
|
||||
try {
|
||||
sls::qDetectorMain det(multiId, fname, isDeveloper);
|
||||
det.show();
|
||||
@ -120,7 +117,7 @@ namespace sls {
|
||||
qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
|
||||
bool isDevel)
|
||||
: QMainWindow(nullptr), detType(slsDetectorDefs::GENERIC),
|
||||
isDeveloper(isDevel), heightPlotWindow(0), heightCentralWidget(0) {
|
||||
isDeveloper(isDevel) {
|
||||
|
||||
setupUi(this);
|
||||
SetUpDetector(fname, multiId);
|
||||
@ -129,94 +126,45 @@ qDetectorMain::qDetectorMain(int multiId, const std::string &fname,
|
||||
|
||||
qDetectorMain::~qDetectorMain() {
|
||||
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));
|
||||
for (int i = 0; i < NumberOfTabs; ++i) {
|
||||
delete scroll[i];
|
||||
}
|
||||
}
|
||||
|
||||
void qDetectorMain::SetUpWidgetWindow() {
|
||||
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
|
||||
// plot setup
|
||||
plot = new qDrawPlot(dockWidgetPlot, det.get());
|
||||
LOG(logDEBUG) << "DockPlot ready";
|
||||
dockWidgetPlot->setWidget(plot);
|
||||
|
||||
// tabs setup
|
||||
tabs = new MyTabWidget(this);
|
||||
layoutTabs->addWidget(tabs);
|
||||
dockWidgetPlot->setFloating(false);
|
||||
zoomToolTip = dockWidgetPlot->toolTip();
|
||||
|
||||
// creating all the other tab widgets
|
||||
tabMeasurement = new qTabMeasurement(this, det.get(), plot);
|
||||
tabDataOutput = new qTabDataOutput(this, det.get());
|
||||
tabPlot = new qTabPlot(this, det.get(), plot);
|
||||
tabSettings = new qTabSettings(this, det.get());
|
||||
tabAdvanced = new qTabAdvanced(this, det.get(), plot);
|
||||
tabDebugging = new qTabDebugging(this, det.get());
|
||||
tabDeveloper = new qTabDeveloper(this, det.get());
|
||||
tabMeasurement = new qTabMeasurement(tMeasurement, det.get(), plot);
|
||||
tabDataOutput = new qTabDataOutput(tDataOutput, det.get());
|
||||
tabPlot = new qTabPlot(tPlot, det.get(), plot);
|
||||
tabSettings = new qTabSettings(tSettings, det.get());
|
||||
tabAdvanced = new qTabAdvanced(tAdvanced, det.get(), plot);
|
||||
tabDebugging = new qTabDebugging(tDebugging, det.get());
|
||||
tabDeveloper = new qTabDeveloper(tDeveloper, det.get());
|
||||
|
||||
// creating the scroll area widgets for the tabs
|
||||
for (int i = 0; i < NumberOfTabs; ++i) {
|
||||
scroll[i] = new QScrollArea();
|
||||
scroll[i]->setFrameShape(QFrame::NoFrame);
|
||||
}
|
||||
// setting the tab widgets to the scrollareas
|
||||
scroll[MEASUREMENT]->setWidget(tabMeasurement);
|
||||
scroll[DATAOUTPUT]->setWidget(tabDataOutput);
|
||||
scroll[PLOT]->setWidget(tabPlot);
|
||||
scroll[SETTINGS]->setWidget(tabSettings);
|
||||
scroll[ADVANCED]->setWidget(tabAdvanced);
|
||||
scroll[DEBUGGING]->setWidget(tabDebugging);
|
||||
scroll[DEVELOPER]->setWidget(tabDeveloper);
|
||||
// inserting all the tabs
|
||||
tabs->insertTab(MEASUREMENT, scroll[MEASUREMENT], "Measurement");
|
||||
tabs->insertTab(DATAOUTPUT, scroll[DATAOUTPUT], "Data Output");
|
||||
tabs->insertTab(PLOT, scroll[PLOT], "Plot");
|
||||
tabs->insertTab(SETTINGS, scroll[SETTINGS], "Settings");
|
||||
tabs->insertTab(ADVANCED, scroll[ADVANCED], "Advanced");
|
||||
tabs->insertTab(DEBUGGING, scroll[DEBUGGING], "Debugging");
|
||||
tabs->insertTab(DEVELOPER, scroll[DEVELOPER], "Developer");
|
||||
// no scroll buttons this way
|
||||
tabs->insertTab(MESSAGES, tabMessages, "Terminal");
|
||||
scrollMeasurement->setWidget(tabMeasurement);
|
||||
scrollDataOutput->setWidget(tabDataOutput);
|
||||
scrollPlot->setWidget(tabPlot);
|
||||
scrollSettings->setWidget(tabSettings);
|
||||
scrollAdvanced->setWidget(tabAdvanced);
|
||||
scrollDebugging->setWidget(tabDebugging);
|
||||
scrollDeveloper->setWidget(tabDeveloper);
|
||||
scrollTerminal->setWidget(tabMessages);
|
||||
|
||||
// swap tabs so that messages is last tab
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMeasurement), MEASUREMENT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabSettings), SETTINGS);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDataOutput), DATAOUTPUT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabPlot), PLOT);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabAdvanced), ADVANCED);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDebugging), DEBUGGING);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabDeveloper), DEVELOPER);
|
||||
tabs->tabBar()->moveTab(tabs->indexOf(tabMessages), MESSAGES);
|
||||
tabs->setCurrentIndex(MEASUREMENT);
|
||||
|
||||
// other tab properties
|
||||
// Default tab color
|
||||
defaultTabColor = tabs->tabBar()->tabTextColor(DATAOUTPUT);
|
||||
// Set the current tab(measurement) to blue as it is the current one
|
||||
// set current tab to blue
|
||||
tabs->tabBar()->setTabTextColor(0, QColor(0, 0, 200, 255));
|
||||
tabs->tabBar()->setExpanding(true);
|
||||
|
||||
// mode setup - to set up the tabs initially as disabled, not in form so
|
||||
// done here
|
||||
LOG(logINFO)
|
||||
<< "Dockable Mode: 0, Debug Mode: 0, Expert Mode: 0, Developer Mode: "
|
||||
<< isDeveloper;
|
||||
tabs->setTabEnabled(DEBUGGING, false);
|
||||
tabs->setTabEnabled(ADVANCED, false);
|
||||
tabs->setTabEnabled(DEVELOPER, isDeveloper);
|
||||
actionLoadTrimbits->setVisible(false);
|
||||
actionSaveTrimbits->setVisible(false);
|
||||
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
|
||||
// Other setup
|
||||
// Height of plot and central widget
|
||||
heightPlotWindow = dockWidgetPlot->size().height();
|
||||
heightCentralWidget = centralwidget->size().height();
|
||||
// Default zoom Tool Tip
|
||||
zoomToolTip = dockWidgetPlot->toolTip();
|
||||
LOG(logINFO) << "Debug Mode: 0, Expert Mode: 0, Developer Mode: "
|
||||
<< isDeveloper;
|
||||
|
||||
Initialization();
|
||||
}
|
||||
@ -227,7 +175,7 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
||||
det = make_unique<Detector>(multiID);
|
||||
|
||||
// create messages tab to capture config file loading logs
|
||||
tabMessages = new qTabMessages(this);
|
||||
tabMessages = new qTabMessages(tTerminal);
|
||||
|
||||
// loads the config file at startup
|
||||
if (!config_file.empty())
|
||||
@ -357,18 +305,8 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
actionSaveTrimbits->setVisible(visible);
|
||||
tabSettings->SetExportMode(enable);
|
||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||
}
|
||||
|
||||
// Set DockableMode
|
||||
else {
|
||||
enable = actionDockable->isChecked();
|
||||
if (enable) {
|
||||
dockWidgetPlot->setFeatures(QDockWidget::DockWidgetFloatable);
|
||||
} else {
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable);
|
||||
} else {
|
||||
LOG(logERROR) << "Unknown action";
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +323,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadConfig(std::string(fName.toAscii().constData()));
|
||||
det->loadConfig(std::string(fName.toLatin1().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Configuration Parameters have been "
|
||||
"configured successfully.",
|
||||
@ -403,7 +341,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadParameters(std::string(fName.toAscii().constData()));
|
||||
det->loadParameters(std::string(fName.toLatin1().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Detector Parameters have been "
|
||||
"configured successfully.",
|
||||
@ -423,7 +361,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
fileDialog->setFileMode(QFileDialog::AnyFile);
|
||||
if (fileDialog->exec() == QDialog::Accepted) {
|
||||
fName = fileDialog->selectedFiles()[0];
|
||||
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
||||
det->loadTrimbits(std::string(fName.toLatin1().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
@ -439,7 +377,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
this, tr("Save Detector Trimbits"), fPath,
|
||||
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||
if (!fName.isEmpty()) {
|
||||
det->saveTrimbits(std::string(fName.toAscii().constData()));
|
||||
det->saveTrimbits(std::string(fName.toLatin1().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Trimbits have been saved successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
@ -549,36 +487,17 @@ void qDetectorMain::Refresh(int index) {
|
||||
|
||||
void qDetectorMain::ResizeMainWindow(bool b) {
|
||||
LOG(logDEBUG1) << "Resizing Main Window: height:" << height();
|
||||
|
||||
// undocked from the main window
|
||||
if (b) {
|
||||
// sets the main window height to a smaller maximum to get rid of space
|
||||
setMaximumHeight(height() - heightPlotWindow - 9);
|
||||
dockWidgetPlot->setMinimumHeight(0);
|
||||
LOG(logINFO) << "Undocking from main window";
|
||||
setMaximumHeight(centralwidget->height() + menu->height());
|
||||
LOG(logINFO) << "Plot undocked from main window";
|
||||
} else {
|
||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
// the minimum for plot will be set when the widget gets resized
|
||||
// automatically
|
||||
LOG(logINFO) << "Plot docked back to main window";
|
||||
}
|
||||
}
|
||||
|
||||
void qDetectorMain::resizeEvent(QResizeEvent *event) {
|
||||
if (!dockWidgetPlot->isFloating()) {
|
||||
dockWidgetPlot->setMinimumHeight(height() - centralwidget->height() -
|
||||
50);
|
||||
centralwidget->setMaximumHeight(heightCentralWidget);
|
||||
}
|
||||
|
||||
// adjusting tab width
|
||||
if (width() >= 800) {
|
||||
tabs->tabBar()->setFixedWidth(width() + 61);
|
||||
} else {
|
||||
tabs->tabBar()->setMinimumWidth(0);
|
||||
tabs->tabBar()->setExpanding(true);
|
||||
tabs->tabBar()->setUsesScrollButtons(true);
|
||||
}
|
||||
|
||||
tabs->tabBar()->setFixedWidth(width());
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include <QResizeEvent>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <qwt_scale_engine.h>
|
||||
|
||||
namespace sls {
|
||||
@ -99,8 +99,6 @@ void qDrawPlot::Initialization() {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetupPlots() {
|
||||
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
|
||||
// default image size
|
||||
slsDetectorDefs::xy res = det->getDetectorSize();
|
||||
nPixelsX = res.x;
|
||||
@ -108,10 +106,10 @@ void qDrawPlot::SetupPlots() {
|
||||
LOG(logINFO) << "nPixelsX:" << nPixelsX;
|
||||
LOG(logINFO) << "nPixelsY:" << nPixelsY;
|
||||
|
||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
widgetStatistics->hide();
|
||||
lblCompleteImage->hide();
|
||||
lblInCompleteImage->hide();
|
||||
lblRxRoiEnabled->hide();
|
||||
|
||||
// setup 1d data
|
||||
|
||||
@ -137,11 +135,6 @@ void qDrawPlot::SetupPlots() {
|
||||
hists1d.append(h);
|
||||
// setup 1d plot
|
||||
plot1d = new SlsQt1DPlot(boxPlot);
|
||||
plot1d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitle("");
|
||||
plot1d->SetXTitle(xTitle1d);
|
||||
plot1d->SetYTitle(yTitle1d);
|
||||
@ -159,24 +152,11 @@ void qDrawPlot::SetupPlots() {
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot);
|
||||
gainplot1d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetTitle("");
|
||||
gainplot1d->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div(0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
gainplot1d->setAxisScaleDiv(QwtPlot::yLeft, div);
|
||||
|
||||
gainhist1d->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot, true);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
gainplot1d->DisableZoom(true);
|
||||
gainplot1d->hide();
|
||||
|
||||
connect(plot1d, SIGNAL(PlotZoomedSignal(const QRectF &)), this,
|
||||
SLOT(Zoom1DGainPlot(const QRectF &)));
|
||||
|
||||
@ -205,32 +185,15 @@ void qDrawPlot::SetupPlots() {
|
||||
plot2d = new SlsQt2DPlot(boxPlot);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, data2d);
|
||||
plot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetZFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->setTitle("");
|
||||
plot2d->SetXTitle(xTitle2d);
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot);
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot, true);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("Gain");
|
||||
gainplot2d->SetZTitle("");
|
||||
gainplot2d->enableAxis(QwtPlot::yLeft, false);
|
||||
// gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
gainplot2d->setAxisScaleDiv(QwtPlot::yRight, div);
|
||||
gainplot2d->DisableZoom(true);
|
||||
gainplot2d->hide();
|
||||
|
||||
connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this,
|
||||
SLOT(Zoom2DGainPlot(const QRectF &)));
|
||||
|
||||
@ -301,13 +264,13 @@ void qDrawPlot::Select1dPlot(bool enable) {
|
||||
|
||||
void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
LOG(logINFO) << "Setting Title to " << title.toAscii().constData();
|
||||
LOG(logINFO) << "Setting Title to " << title.toLatin1().constData();
|
||||
plotTitlePrefix = title;
|
||||
}
|
||||
|
||||
void qDrawPlot::SetXAxisTitle(QString title) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
||||
LOG(logINFO) << "Setting X Axis Title to " << title.toLatin1().constData();
|
||||
if (is1d) {
|
||||
xTitle1d = title;
|
||||
} else {
|
||||
@ -317,7 +280,7 @@ void qDrawPlot::SetXAxisTitle(QString title) {
|
||||
|
||||
void qDrawPlot::SetYAxisTitle(QString title) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
||||
LOG(logINFO) << "Setting Y Axis Title to " << title.toLatin1().constData();
|
||||
if (is1d) {
|
||||
yTitle1d = title;
|
||||
} else {
|
||||
@ -327,7 +290,7 @@ void qDrawPlot::SetYAxisTitle(QString title) {
|
||||
|
||||
void qDrawPlot::SetZAxisTitle(QString title) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
||||
LOG(logINFO) << "Setting Z Axis Title to " << title.toLatin1().constData();
|
||||
zTitle2d = title;
|
||||
}
|
||||
|
||||
@ -509,7 +472,7 @@ void qDrawPlot::EnableGainPlot(bool enable) {
|
||||
void qDrawPlot::SetSaveFileName(QString val) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
LOG(logDEBUG) << "Setting Clone/Save File Name to "
|
||||
<< val.toAscii().constData();
|
||||
<< val.toLatin1().constData();
|
||||
fileSaveName = val;
|
||||
}
|
||||
|
||||
@ -524,14 +487,6 @@ void qDrawPlot::ClonePlot() {
|
||||
if (is1d) {
|
||||
LOG(logDEBUG) << "Cloning 1D Image";
|
||||
cloneplot1D = new SlsQt1DPlot();
|
||||
cloneplot1D->setFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetXFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetTitle(plot1d->title().text());
|
||||
cloneplot1D->SetXTitle(xTitle1d);
|
||||
cloneplot1D->SetYTitle(yTitle1d);
|
||||
@ -551,36 +506,14 @@ void qDrawPlot::ClonePlot() {
|
||||
h->setStyleLinesorDots(isLines);
|
||||
h->setSymbolMarkers(isMarkers);
|
||||
h->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
clonegainplot1D = new SlsQt1DPlot();
|
||||
clonegainplot1D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetTitle("");
|
||||
clonegainplot1D->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div(0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot1D->setAxisScaleDiv(QwtPlot::yLeft, div);
|
||||
clonegainplot1D->DisableZoom(true);
|
||||
clonegainplot1D = new SlsQt1DPlot(NULL, true);
|
||||
h->Attach(clonegainplot1D);
|
||||
|
||||
connect(cloneplot1D, SIGNAL(PlotZoomedSignal(const QRectF &)),
|
||||
clonegainplot1D, SLOT(SetZoomX(const QRectF &)));
|
||||
}
|
||||
} else {
|
||||
LOG(logDEBUG) << "Cloning 2D Image";
|
||||
cloneplot2D = new SlsQt2DPlot();
|
||||
cloneplot2D->setFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetXFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetZFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->setTitle(plot2d->title().text());
|
||||
cloneplot2D->SetXTitle(xTitle2d);
|
||||
cloneplot2D->SetYTitle(yTitle2d);
|
||||
@ -590,25 +523,9 @@ void qDrawPlot::ClonePlot() {
|
||||
cloneplot2D->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||
|
||||
if (isGainDataExtracted) {
|
||||
clonegainplot2D = new SlsQt2DPlot();
|
||||
clonegainplot2D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitle("Gain");
|
||||
clonegainplot2D->SetZTitle("");
|
||||
clonegainplot2D->enableAxis(QwtPlot::yLeft, false);
|
||||
clonegainplot2D->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div(0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot2D->setAxisScaleDiv(QwtPlot::yRight, div);
|
||||
|
||||
clonegainplot2D->enableAxis(0, false);
|
||||
clonegainplot2D->enableAxis(1, false);
|
||||
clonegainplot2D->enableAxis(2, false);
|
||||
clonegainplot2D = new SlsQt2DPlot(NULL, true);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||
-0.5, nPixelsY - 0.5, gainData);
|
||||
clonegainplot2D->DisableZoom(true);
|
||||
|
||||
connect(cloneplot2D, SIGNAL(PlotZoomedSignal(const QRectF &)),
|
||||
clonegainplot2D, SLOT(SetZoom(const QRectF &)));
|
||||
}
|
||||
@ -1141,14 +1058,12 @@ void qDrawPlot::Update1dXYRange() {
|
||||
|
||||
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
||||
plot1d->EnableYAutoScaling();
|
||||
gainplot1d->EnableYAutoScaling();
|
||||
} else {
|
||||
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN]
|
||||
: plot1d->GetYMinimum());
|
||||
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX]
|
||||
: plot1d->GetYMaximum());
|
||||
plot1d->SetYMinMax(ymin, ymax);
|
||||
gainplot1d->SetYMinMax(ymin, ymax);
|
||||
}
|
||||
plot1d->Update();
|
||||
gainplot1d->Update();
|
||||
|
@ -400,7 +400,7 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
|
||||
void qTabAdvanced::SetDetector() {
|
||||
LOG(logDEBUG) << "Set Detector: "
|
||||
<< comboDetector->currentText().toAscii().data();
|
||||
<< comboDetector->currentText().toLatin1().data();
|
||||
|
||||
GetControlPort();
|
||||
GetStopPort();
|
||||
@ -441,7 +441,7 @@ void qTabAdvanced::SetDetectorUDPIP(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispDetectorUDPIP->isModified() || force) {
|
||||
dispDetectorUDPIP->setModified(false);
|
||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||
std::string s = dispDetectorUDPIP->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
try {
|
||||
det->setSourceUDPIP(IpAddr{s}, {comboDetector->currentIndex()});
|
||||
@ -458,7 +458,7 @@ void qTabAdvanced::SetDetectorUDPMAC(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispDetectorUDPMAC->isModified() || force) {
|
||||
dispDetectorUDPMAC->setModified(false);
|
||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||
std::string s = dispDetectorUDPMAC->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
try {
|
||||
det->setSourceUDPMAC(MacAddr{s}, {comboDetector->currentIndex()});
|
||||
@ -485,7 +485,7 @@ void qTabAdvanced::SetCltZMQIP(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispZMQIP->isModified() || force) {
|
||||
dispZMQIP->setModified(false);
|
||||
std::string s = dispZMQIP->text().toAscii().constData();
|
||||
std::string s = dispZMQIP->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
try {
|
||||
det->setClientZmqIp(IpAddr{s}, {comboDetector->currentIndex()});
|
||||
@ -502,7 +502,7 @@ void qTabAdvanced::SetRxrHostname(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispRxrHostname->isModified() || force) {
|
||||
dispRxrHostname->setModified(false);
|
||||
std::string s = dispRxrHostname->text().toAscii().constData();
|
||||
std::string s = dispRxrHostname->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||
try {
|
||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||
@ -542,7 +542,7 @@ void qTabAdvanced::SetRxrUDPIP(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispRxrUDPIP->isModified() || force) {
|
||||
dispRxrUDPIP->setModified(false);
|
||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||
std::string s = dispRxrUDPIP->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
try {
|
||||
det->setDestinationUDPIP(IpAddr{s},
|
||||
@ -560,7 +560,7 @@ void qTabAdvanced::SetRxrUDPMAC(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispRxrUDPMAC->isModified() || force) {
|
||||
dispRxrUDPMAC->setModified(false);
|
||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||
std::string s = dispRxrUDPMAC->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
try {
|
||||
det->setDestinationUDPMAC(MacAddr{s},
|
||||
@ -588,7 +588,7 @@ void qTabAdvanced::SetRxrZMQIP(bool force) {
|
||||
// return forces modification (inconsistency from command line)
|
||||
if (dispRxrZMQIP->isModified() || force) {
|
||||
dispRxrZMQIP->setModified(false);
|
||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||
std::string s = dispRxrZMQIP->text().toLatin1().constData();
|
||||
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
try {
|
||||
det->setRxZmqIP(IpAddr{s}, {comboDetector->currentIndex()});
|
||||
|
@ -192,7 +192,7 @@ void qTabDataOutput::SetOutputDir(bool force) {
|
||||
dispOutputDir->setModified(false);
|
||||
QString path = dispOutputDir->text();
|
||||
LOG(logDEBUG) << "Setting output directory to "
|
||||
<< path.toAscii().constData();
|
||||
<< path.toLatin1().constData();
|
||||
|
||||
// empty
|
||||
if (path.isEmpty()) {
|
||||
@ -208,7 +208,7 @@ void qTabDataOutput::SetOutputDir(bool force) {
|
||||
path.chop(1);
|
||||
}
|
||||
}
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
std::string spath = std::string(path.toLatin1().constData());
|
||||
try {
|
||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||
}
|
||||
@ -245,7 +245,7 @@ void qTabDataOutput::GetFileFormat() {
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
LOG(logINFO) << "Setting File Format to "
|
||||
<< comboFileFormat->currentText().toAscii().data();
|
||||
<< comboFileFormat->currentText().toLatin1().data();
|
||||
try {
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(
|
||||
comboFileFormat->currentIndex()));
|
||||
@ -388,7 +388,7 @@ void qTabDataOutput::GetSpeed() {
|
||||
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
LOG(logINFO) << "Setting Readout Speed to "
|
||||
<< comboClkDivider->currentText().toAscii().data();
|
||||
<< comboClkDivider->currentText().toLatin1().data();
|
||||
try {
|
||||
det->setReadoutSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||
}
|
||||
|
@ -3,49 +3,36 @@
|
||||
#include "qTabDebugging.h"
|
||||
#include "qDefs.h"
|
||||
#include "sls/ToString.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QTreeWidget>
|
||||
|
||||
namespace sls {
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, Detector *detector)
|
||||
: QWidget(parent), det(detector), treeDet(nullptr),
|
||||
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
||||
lblDetectorSoftware(nullptr) {
|
||||
: QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
LOG(logDEBUG) << "Debugging ready";
|
||||
}
|
||||
|
||||
qTabDebugging::~qTabDebugging() {
|
||||
delete treeDet;
|
||||
delete lblDetectorHostname;
|
||||
delete lblDetectorFirmware;
|
||||
delete lblDetectorSoftware;
|
||||
}
|
||||
qTabDebugging::~qTabDebugging() {}
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow() {
|
||||
// enabling according to det type
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
lblDetector->setText("Half Module:");
|
||||
chkDetectorFirmware->setEnabled(false);
|
||||
chkDetectorBus->setEnabled(false);
|
||||
btnTest->setEnabled(false);
|
||||
groupTest->setEnabled(false);
|
||||
} else {
|
||||
EnableTest();
|
||||
}
|
||||
|
||||
PopulateDetectors();
|
||||
|
||||
Initialization();
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qTabDebugging::Initialization() {
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetDetectorStatus()));
|
||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||
if (btnTest->isEnabled()) {
|
||||
SLOT(GetInfo()));
|
||||
connect(chkDetectorFirmware, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnableTest()));
|
||||
connect(chkDetectorBus, SIGNAL(toggled(bool)), this, SLOT(EnableTest()));
|
||||
if (groupTest->isEnabled()) {
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
}
|
||||
}
|
||||
@ -53,20 +40,73 @@ void qTabDebugging::Initialization() {
|
||||
void qTabDebugging::PopulateDetectors() {
|
||||
LOG(logDEBUG) << "Populating detectors";
|
||||
|
||||
comboDetector->clear();
|
||||
auto res = det->getHostname();
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
try {
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
auto res = det->getHostname();
|
||||
if (det->size() > 1) {
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
}
|
||||
CATCH_DISPLAY("Could not populate readouts for debugging",
|
||||
"qTabDebugging::PopulateDetectors")
|
||||
}
|
||||
|
||||
void qTabDebugging::GetFirmwareVersion() {
|
||||
LOG(logDEBUG) << "Firmware Version";
|
||||
try {
|
||||
auto retval =
|
||||
det->getFirmwareVersion({comboDetector->currentIndex() - 1})
|
||||
.squash(-1);
|
||||
std::string s = "inconsistent";
|
||||
if (retval != -1) {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
s = ToString(retval);
|
||||
} else {
|
||||
s = ToStringHex(retval);
|
||||
}
|
||||
}
|
||||
dispFirmwareVersion->setText(s.c_str());
|
||||
}
|
||||
CATCH_DISPLAY("Could not get firmware version.",
|
||||
"qTabDebugging::GetFirmwareVersion")
|
||||
}
|
||||
|
||||
void qTabDebugging::GetServerSoftwareVersion() {
|
||||
LOG(logDEBUG) << "Server Software Version";
|
||||
try {
|
||||
std::string s =
|
||||
det->getDetectorServerVersion({comboDetector->currentIndex() - 1})
|
||||
.squash("inconsistent");
|
||||
dispSoftwareVersion->setText(s.c_str());
|
||||
}
|
||||
CATCH_DISPLAY("Could not get on-board software version.",
|
||||
"qTabDebugging::GetServerSoftwareVersion")
|
||||
}
|
||||
|
||||
void qTabDebugging::GetReceiverVersion() {
|
||||
LOG(logDEBUG) << "Server Receiver Version";
|
||||
try {
|
||||
std::string s =
|
||||
det->getReceiverVersion({comboDetector->currentIndex() - 1})
|
||||
.squash("inconsistent");
|
||||
dispReceiverVersion->setText(s.c_str());
|
||||
}
|
||||
CATCH_DISPLAY("Could not receiver version.",
|
||||
"qTabDebugging::GetReceiverVersion")
|
||||
}
|
||||
|
||||
void qTabDebugging::GetDetectorStatus() {
|
||||
LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
try {
|
||||
std::string status = ToString(
|
||||
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
std::string s =
|
||||
ToString(det->getDetectorStatus({comboDetector->currentIndex() - 1})
|
||||
.squash(defs::runStatus::ERROR));
|
||||
lblStatus->setText(QString(s.c_str()).toUpper());
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector status.",
|
||||
"qTabDebugging::GetDetectorStatus")
|
||||
@ -74,172 +114,53 @@ void qTabDebugging::GetDetectorStatus() {
|
||||
|
||||
void qTabDebugging::GetInfo() {
|
||||
LOG(logDEBUG) << "Getting Readout Info";
|
||||
|
||||
// open info in a new popup
|
||||
QFrame *popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow);
|
||||
QList<QTreeWidgetItem *> items;
|
||||
QGridLayout *layout = new QGridLayout(popup1);
|
||||
treeDet = new QTreeWidget(popup1);
|
||||
layout->addWidget(treeDet, 0, 0);
|
||||
QFrame *dispFrame = new QFrame(popup1);
|
||||
QGridLayout *formLayout = new QGridLayout(dispFrame);
|
||||
lblDetectorHostname = new QLabel("");
|
||||
lblDetectorFirmware = new QLabel("");
|
||||
lblDetectorSoftware = new QLabel("");
|
||||
// to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
QString detName =
|
||||
QString(ToString(det->getDetectorType().squash()).c_str());
|
||||
|
||||
switch (det->getDetectorType().squash()) {
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1,
|
||||
0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2,
|
||||
0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
treeDet->setHeaderLabel("Eiger Detector");
|
||||
// get num modules
|
||||
for (int i = 0; i < comboDetector->count() / 2; ++i)
|
||||
items.append(
|
||||
new QTreeWidgetItem((QTreeWidget *)nullptr,
|
||||
QStringList(QString("Module %1").arg(i))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
// gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i) {
|
||||
QList<QTreeWidgetItem *> childItems;
|
||||
childItems.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)nullptr,
|
||||
QStringList(QString("Half Module (%1)")
|
||||
.arg(comboDetector->itemText(i)))));
|
||||
treeDet->topLevelItem(i * 2)->insertChildren(0, childItems);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
formLayout->addWidget(new QLabel("Module:"), 0, 0);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
treeDet->setHeaderLabel(QString(detName + " Detector"));
|
||||
// gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i)
|
||||
items.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)nullptr,
|
||||
QStringList(
|
||||
QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
break;
|
||||
}
|
||||
|
||||
// show and center widget
|
||||
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
||||
int y =
|
||||
((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int screen = desktop->screenNumber(this);
|
||||
popup1->setWindowModality(Qt::WindowModal);
|
||||
popup1->move((desktop->screenGeometry(screen).x()) + x,
|
||||
(desktop->screenGeometry(screen).y()) + y);
|
||||
popup1->show();
|
||||
|
||||
// put the first parameters
|
||||
SetParameters(treeDet->topLevelItem(0));
|
||||
|
||||
// connect to slots
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
|
||||
SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
GetFirmwareVersion();
|
||||
GetServerSoftwareVersion();
|
||||
GetReceiverVersion();
|
||||
GetDetectorStatus();
|
||||
}
|
||||
|
||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
// eiger: if half module clicked, others: true always
|
||||
bool ignoreOrHalfModuleClicked = true;
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
if (!(item->text(0).contains("Half Module"))) {
|
||||
ignoreOrHalfModuleClicked = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ignoreOrHalfModuleClicked) {
|
||||
// find index
|
||||
for (int i = 0; i < comboDetector->count(); ++i) {
|
||||
if (item == treeDet->topLevelItem(i))
|
||||
break;
|
||||
}
|
||||
try {
|
||||
auto retval = std::string("0x") +
|
||||
std::to_string((unsigned long)det->getFirmwareVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval = det->getDetectorServerVersion(
|
||||
{comboDetector->currentIndex()})[0];
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
void qTabDebugging::EnableTest() {
|
||||
btnTest->setEnabled(chkDetectorFirmware->isChecked() ||
|
||||
chkDetectorBus->isChecked());
|
||||
lblBusTestOk->hide();
|
||||
lblBusTestFail->hide();
|
||||
lblFwTestOk->hide();
|
||||
lblFwTestFail->hide();
|
||||
}
|
||||
|
||||
void qTabDebugging::TestDetector() {
|
||||
LOG(logINFO) << "Testing Readout";
|
||||
|
||||
try {
|
||||
QString moduleName = "Module";
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
moduleName = "Half Module";
|
||||
// hide results if clicking button again
|
||||
EnableTest();
|
||||
|
||||
// detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
try {
|
||||
det->executeFirmwareTest({comboDetector->currentIndex() - 1});
|
||||
LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||
lblFwTestOk->show();
|
||||
} catch (std::exception &e) {
|
||||
LOG(logWARNING)
|
||||
<< "Detector Firmware Test: Fail (" << e.what() << ")";
|
||||
lblFwTestFail->show();
|
||||
}
|
||||
}
|
||||
|
||||
// detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
try {
|
||||
det->executeBusTest({comboDetector->currentIndex() - 1});
|
||||
LOG(logINFO) << "Detector Bus Test: Pass";
|
||||
lblBusTestOk->show();
|
||||
} catch (std::exception &e) {
|
||||
LOG(logWARNING) << "Detector Bus Test: Fail (" << e.what() << ")";
|
||||
lblBusTestFail->show();
|
||||
}
|
||||
|
||||
// construct message
|
||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>")
|
||||
.arg(comboDetector->currentText());
|
||||
|
||||
// detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
try {
|
||||
det->executeFirmwareTest({comboDetector->currentIndex()});
|
||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>")
|
||||
.arg(moduleName));
|
||||
LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||
}
|
||||
CATCH_DISPLAY("Firmware test failed.",
|
||||
"qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
try {
|
||||
det->executeBusTest({comboDetector->currentIndex()});
|
||||
message.append(
|
||||
QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||
LOG(logINFO) << "Detector Bus Test: Pass";
|
||||
}
|
||||
CATCH_DISPLAY("Bus test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(),
|
||||
"qTabDebugging::TestDetector");
|
||||
}
|
||||
CATCH_DISPLAY("Could not execute digital test.",
|
||||
"qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
void qTabDebugging::Refresh() {
|
||||
LOG(logDEBUG) << "**Updating Debugging Tab";
|
||||
GetDetectorStatus();
|
||||
LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||
}
|
||||
void qTabDebugging::Refresh() { GetInfo(); }
|
||||
|
||||
} // namespace sls
|
||||
|
@ -279,15 +279,19 @@ void qTabDeveloper::Initialization() {
|
||||
void qTabDeveloper::PopulateDetectors() {
|
||||
LOG(logDEBUG) << "Populating detectors";
|
||||
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
auto res = det->getHostname();
|
||||
if (det->size() > 1) {
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
try {
|
||||
comboDetector->clear();
|
||||
comboDetector->addItem("All");
|
||||
auto res = det->getHostname();
|
||||
if (det->size() > 1) {
|
||||
for (auto &it : res) {
|
||||
comboDetector->addItem(QString(it.c_str()));
|
||||
}
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
}
|
||||
comboDetector->setCurrentIndex(0);
|
||||
CATCH_DISPLAY("Could not populate readouts for dacs/adcs",
|
||||
"qTabDeveloper::PopulateDetectors")
|
||||
}
|
||||
|
||||
slsDetectorDefs::dacIndex
|
||||
|
@ -20,6 +20,7 @@ qTabMeasurement::qTabMeasurement(QWidget *parent, Detector *detector,
|
||||
qTabMeasurement::~qTabMeasurement() { delete progressTimer; }
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow() {
|
||||
setFont(QFont("Carlito", 9, QFont::Normal));
|
||||
// palette
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active, QPalette::WindowText, Qt::red);
|
||||
@ -384,7 +385,7 @@ void qTabMeasurement::GetTimingMode() {
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int val) {
|
||||
LOG(logINFO) << "Setting timing mode:"
|
||||
<< comboTimingMode->currentText().toAscii().data();
|
||||
<< comboTimingMode->currentText().toLatin1().data();
|
||||
try {
|
||||
det->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
|
||||
EnableWidgetsforTimingMode();
|
||||
@ -420,7 +421,7 @@ void qTabMeasurement::GetBurstMode() {
|
||||
|
||||
void qTabMeasurement::SetBurstMode(int val) {
|
||||
LOG(logINFO) << "Setting burst mode:"
|
||||
<< comboBurstMode->currentText().toAscii().data();
|
||||
<< comboBurstMode->currentText().toLatin1().data();
|
||||
try {
|
||||
det->setBurstMode(static_cast<slsDetectorDefs::burstMode>(val));
|
||||
ShowTriggerDelay();
|
||||
@ -800,7 +801,7 @@ void qTabMeasurement::SetFileName(bool force) {
|
||||
if (dispFileName->isModified() || force) {
|
||||
dispFileName->setModified(false);
|
||||
std::string val =
|
||||
std::string(dispFileName->text().toAscii().constData());
|
||||
std::string(dispFileName->text().toLatin1().constData());
|
||||
LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||
try {
|
||||
det->setFileNamePrefix(val);
|
||||
@ -966,7 +967,7 @@ void qTabMeasurement::AcquireFinished() {
|
||||
void qTabMeasurement::AbortAcquire(QString exmsg) {
|
||||
LOG(logINFORED) << "Abort Acquire";
|
||||
qDefs::ExceptionMessage("Acquire unsuccessful.",
|
||||
exmsg.toAscii().constData(),
|
||||
exmsg.toLatin1().constData(),
|
||||
"qDrawPlot::AcquireFinished");
|
||||
isAcquisitionStopped = true;
|
||||
AcquireFinished();
|
||||
@ -978,8 +979,7 @@ void qTabMeasurement::Enable(bool enable) {
|
||||
|
||||
// shortcut each time, else it doesnt work a second time
|
||||
btnStart->setShortcut(QApplication::translate("TabMeasurementObject",
|
||||
"Shift+Space", nullptr,
|
||||
QApplication::UnicodeUTF8));
|
||||
"Shift+Space", nullptr));
|
||||
}
|
||||
|
||||
void qTabMeasurement::Refresh() {
|
||||
|
@ -78,9 +78,9 @@ void qTabMessages::ExecuteCommand() {
|
||||
|
||||
QString command = param.at(0);
|
||||
param.removeFirst();
|
||||
LOG(logINFO) << "Executing Command:[" << command.toAscii().constData()
|
||||
LOG(logINFO) << "Executing Command:[" << command.toLatin1().constData()
|
||||
<< "] with Arguments:["
|
||||
<< param.join(" ").toAscii().constData() << "]";
|
||||
<< param.join(" ").toLatin1().constData() << "]";
|
||||
|
||||
process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
process->start(command, param);
|
||||
@ -117,15 +117,15 @@ void qTabMessages::SaveLog() {
|
||||
outfile.setFileName(fName);
|
||||
if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&outfile);
|
||||
out << dispLog->toPlainText() << endl;
|
||||
out << dispLog->toPlainText() << '\n';
|
||||
std::string mess =
|
||||
std::string("The Log has been successfully saved to ") +
|
||||
fName.toAscii().constData();
|
||||
fName.toLatin1().constData();
|
||||
qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog");
|
||||
LOG(logINFO) << mess;
|
||||
} else {
|
||||
LOG(logWARNING) << "Attempt to save log file failed: "
|
||||
<< fName.toAscii().constData();
|
||||
<< fName.toLatin1().constData();
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.",
|
||||
"qTabMessages::SaveLog");
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
stackedWidget1D->setCurrentIndex(0);
|
||||
stackedWidget2D->setCurrentIndex(0);
|
||||
// Plot Axis
|
||||
// its not spinboxes to not take value when checkbox checked
|
||||
dispXMin->setValidator(new QDoubleValidator(dispXMin));
|
||||
dispYMin->setValidator(new QDoubleValidator(dispYMin));
|
||||
dispZMin->setValidator(new QDoubleValidator(dispZMin));
|
||||
@ -73,9 +74,11 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
Initialization();
|
||||
Refresh();
|
||||
|
||||
// set zmq high water mark to GUI_ZMQ_RCV_HWM (2)
|
||||
spinSndHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||
spinRcvHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||
// update both zmq high water mark to GUI_ZMQ_RCV_HWM (2)
|
||||
comboHwm->setCurrentIndex(SND_HWM);
|
||||
spinHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||
comboHwm->setCurrentIndex(RX_HWM);
|
||||
spinHwm->setValue(qDefs::GUI_ZMQ_RCV_HWM);
|
||||
|
||||
if (chkGapPixels->isEnabled()) {
|
||||
chkGapPixels->setChecked(true);
|
||||
@ -85,10 +88,9 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
void qTabPlot::Initialization() {
|
||||
// Plotting frequency box
|
||||
connect(chkNoPlot, SIGNAL(toggled(bool)), this, SLOT(SetPlot()));
|
||||
connect(spinSndHwm, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStreamingHwm(int)));
|
||||
connect(spinRcvHwm, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetReceivingHwm(int)));
|
||||
connect(comboHwm, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SelectHwm(int)));
|
||||
connect(spinHwm, SIGNAL(valueChanged(int)), this, SLOT(SetHwm(int)));
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
@ -196,15 +198,14 @@ void qTabPlot::Initialization() {
|
||||
void qTabPlot::Select1DPlot(bool enable) {
|
||||
LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||
is1d = enable;
|
||||
box1D->setEnabled(enable);
|
||||
box2D->setEnabled(!enable);
|
||||
chkZAxis->setEnabled(!enable);
|
||||
dispZAxis->setEnabled(!enable);
|
||||
chkZMin->setEnabled(!enable);
|
||||
chkZMax->setEnabled(!enable);
|
||||
dispZMin->setEnabled(!enable);
|
||||
dispZMax->setEnabled(!enable);
|
||||
plot->Select1dPlot(enable);
|
||||
stackedPlotOptions->setCurrentIndex(is1d ? 0 : 1);
|
||||
chkZAxis->setEnabled(!is1d);
|
||||
dispZAxis->setEnabled(!is1d);
|
||||
chkZMin->setEnabled(!is1d);
|
||||
chkZMax->setEnabled(!is1d);
|
||||
dispZMin->setEnabled(!is1d);
|
||||
dispZMax->setEnabled(!is1d);
|
||||
plot->Select1dPlot(is1d);
|
||||
SetTitles();
|
||||
SetXYRange();
|
||||
if (!is1d) {
|
||||
@ -221,14 +222,12 @@ void qTabPlot::SetPlot() {
|
||||
plotEnable = true;
|
||||
}
|
||||
comboFrequency->setEnabled(plotEnable);
|
||||
lblSndHwm->setEnabled(plotEnable);
|
||||
spinSndHwm->setEnabled(plotEnable);
|
||||
lblRcvHwm->setEnabled(plotEnable);
|
||||
spinRcvHwm->setEnabled(plotEnable);
|
||||
comboHwm->setEnabled(plotEnable);
|
||||
spinHwm->setEnabled(plotEnable);
|
||||
stackedTimeInterval->setEnabled(plotEnable);
|
||||
box1D->setEnabled(plotEnable);
|
||||
box2D->setEnabled(plotEnable);
|
||||
boxSave->setEnabled(plotEnable);
|
||||
stackedPlotOptions->setEnabled(plotEnable);
|
||||
btnSave->setEnabled(plotEnable);
|
||||
btnClone->setEnabled(plotEnable);
|
||||
boxPlotAxis->setEnabled(plotEnable);
|
||||
|
||||
if (plotEnable) {
|
||||
@ -249,8 +248,6 @@ void qTabPlot::Set1DPlotOptionsRight() {
|
||||
stackedWidget1D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i + 1);
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
@ -260,8 +257,6 @@ void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i - 1);
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsRight() {
|
||||
@ -271,8 +266,6 @@ void qTabPlot::Set2DPlotOptionsRight() {
|
||||
stackedWidget2D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i + 1);
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
@ -282,8 +275,6 @@ void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i - 1);
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::EnablePersistency(bool enable) {
|
||||
@ -711,20 +702,34 @@ void qTabPlot::SetStreamingFrequency() {
|
||||
&qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
|
||||
void qTabPlot::SelectHwm(int value) { GetHwm(); }
|
||||
|
||||
void qTabPlot::GetHwm() {
|
||||
if (comboHwm->currentIndex() == SND_HWM)
|
||||
GetStreamingHwm();
|
||||
else
|
||||
GetReceivingHwm();
|
||||
}
|
||||
|
||||
void qTabPlot::SetHwm(int value) {
|
||||
if (comboHwm->currentIndex() == SND_HWM)
|
||||
SetStreamingHwm(value);
|
||||
else
|
||||
SetReceivingHwm(value);
|
||||
}
|
||||
|
||||
void qTabPlot::GetStreamingHwm() {
|
||||
LOG(logDEBUG) << "Getting Streaming Hwm for receiver";
|
||||
disconnect(spinSndHwm, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStreamingHwm(int)));
|
||||
disconnect(spinHwm, SIGNAL(valueChanged(int)), this, SLOT(SetHwm(int)));
|
||||
try {
|
||||
int value = det->getRxZmqHwm().tsquash(
|
||||
"Inconsistent streaming hwm for all receivers.");
|
||||
LOG(logDEBUG) << "Got streaming hwm for receiver " << value;
|
||||
spinSndHwm->setValue(value);
|
||||
spinHwm->setValue(value);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get streaming hwm for receiver.",
|
||||
"qTabPlot::GetStreamingHwm")
|
||||
connect(spinSndHwm, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStreamingHwm(int)));
|
||||
connect(spinHwm, SIGNAL(valueChanged(int)), this, SLOT(SetHwm(int)));
|
||||
}
|
||||
|
||||
void qTabPlot::SetStreamingHwm(int value) {
|
||||
@ -733,17 +738,20 @@ void qTabPlot::SetStreamingHwm(int value) {
|
||||
det->setRxZmqHwm(value);
|
||||
}
|
||||
CATCH_HANDLE("Could not set streaming hwm for receiver.",
|
||||
"qTabPlot::SetStreamingHwm", this, &qTabPlot::GetStreamingHwm)
|
||||
"qTabPlot::SetStreamingHwm", this, &qTabPlot::GetHwm)
|
||||
}
|
||||
|
||||
void qTabPlot::GetReceivingHwm() {
|
||||
LOG(logDEBUG) << "Getting Receiving Hwm for client";
|
||||
disconnect(spinHwm, SIGNAL(valueChanged(int)), this, SLOT(SetHwm(int)));
|
||||
try {
|
||||
int value = det->getClientZmqHwm();
|
||||
LOG(logDEBUG) << "Got receiving hwm for client " << value;
|
||||
spinHwm->setValue(value);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiving hwm for client.",
|
||||
"qTabPlot::GetReceivingHwm")
|
||||
connect(spinHwm, SIGNAL(valueChanged(int)), this, SLOT(SetHwm(int)));
|
||||
}
|
||||
|
||||
void qTabPlot::SetReceivingHwm(int value) {
|
||||
@ -752,7 +760,7 @@ void qTabPlot::SetReceivingHwm(int value) {
|
||||
det->setClientZmqHwm(value);
|
||||
}
|
||||
CATCH_HANDLE("Could not set receiving hwm from client.",
|
||||
"qTabPlot::SetReceivingHwm", this, &qTabPlot::GetReceivingHwm)
|
||||
"qTabPlot::SetReceivingHwm", this, &qTabPlot::GetHwm)
|
||||
}
|
||||
|
||||
void qTabPlot::Refresh() {
|
||||
@ -760,19 +768,8 @@ void qTabPlot::Refresh() {
|
||||
|
||||
if (!plot->GetIsRunning()) {
|
||||
boxFrequency->setEnabled(true);
|
||||
|
||||
// streaming frequency
|
||||
if (!chkNoPlot->isChecked()) {
|
||||
comboFrequency->setEnabled(true);
|
||||
stackedTimeInterval->setEnabled(true);
|
||||
lblSndHwm->setEnabled(true);
|
||||
spinSndHwm->setEnabled(true);
|
||||
lblRcvHwm->setEnabled(true);
|
||||
spinRcvHwm->setEnabled(true);
|
||||
}
|
||||
GetStreamingFrequency();
|
||||
GetStreamingHwm();
|
||||
GetReceivingHwm();
|
||||
GetHwm();
|
||||
// gain plot, gap pixels enable
|
||||
switch (det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
|
@ -18,7 +18,6 @@ qTabSettings::qTabSettings(QWidget *parent, Detector *detector)
|
||||
qTabSettings::~qTabSettings() {}
|
||||
|
||||
void qTabSettings::SetupWidgetWindow() {
|
||||
|
||||
comboHV->hide();
|
||||
lblComboHV->hide();
|
||||
lblSpinHV->hide();
|
||||
@ -402,7 +401,7 @@ void qTabSettings::SetGainMode(int index) {
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Setting Gain Mode to "
|
||||
<< comboGainMode->currentText().toAscii().data();
|
||||
<< comboGainMode->currentText().toLatin1().data();
|
||||
auto val = static_cast<slsDetectorDefs::gainMode>(index);
|
||||
try {
|
||||
|
||||
@ -449,7 +448,7 @@ void qTabSettings::GetDynamicRange() {
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index) {
|
||||
LOG(logINFO) << "Setting dynamic range to "
|
||||
<< comboDynamicRange->currentText().toAscii().data();
|
||||
<< comboDynamicRange->currentText().toLatin1().data();
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
|
17
slsDetectorGui/src/qVersionResolve.cpp
Normal file
17
slsDetectorGui/src/qVersionResolve.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "qVersionResolve.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sls {
|
||||
|
||||
int qResolve_GetQFontWidth(const QFontMetrics fm, const QString &text,
|
||||
int len) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
return fm.horizontalAdvance(text, len);
|
||||
#else
|
||||
return fm.width(text, len);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace sls
|
Reference in New Issue
Block a user