17#include <QHashIterator>
27const int NUMTESTS = 5;
29const QString TESTS[NUMTESTS] = {
"Hard mask",
"First detector vanadium test",
"Second detector vanadium test",
30 "Background test",
"PSD Bleed test"};
32int find_test(
const std::string &test_name) {
34 for (
int i = 0; i < NUMTESTS; i++) {
35 if (TESTS[i].toStdString() == test_name) {
49 setWindowTitle(
"Failed detectors list");
51 addRow(
"Test",
"Number of failed spectra");
54 for (
auto col1 : TESTS) {
59 auto *close =
new QPushButton(
"Close");
60 m_Grid->addWidget(close, row, 1);
61 connect(close, SIGNAL(clicked()),
this, SLOT(close()));
65 setAttribute(Qt::WA_DeleteOnClose,
false);
73 if (!testSummary.contains(
"Diagnostic Test Summary")) {
74 throw std::runtime_error(
"Diagnostic results string does not have expected format.");
77 QStringList results = testSummary.split(
"\n");
78 int nTestStrings = results.length();
81 for (
int i = 0; i <= nTestStrings; ++i) {
82 QString testName = results[i].section(
":", 0, 1);
83 std::string tn = testName.toStdString();
91 QStringList NameValPair = results[i].split(
":");
92 tn = NameValPair[0].toStdString();
93 QStringList columns = NameValPair[1].split(QRegExp(
"\\s+"), Qt::SkipEmptyParts);
94 Q_ASSERT(columns.size() == 2);
96 if (columns[0] ==
"None")
100 int test_ind = find_test(tn);
113 int row =
m_Grid->rowCount();
114 m_Grid->addWidget(
new QLabel(firstColumn), row, 0);
115 m_Grid->addWidget(
new QLabel(secondColumn), row, 1);
125 QWidget *widget =
m_Grid->itemAtPosition(row, 1)->widget();
126 QLabel *label = qobject_cast<QLabel *>(widget);
127 label->setText(text);