should all be done now

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@56 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-09-14 14:55:53 +00:00
parent 62b14f4199
commit 38451caa7c
9 changed files with 823 additions and 168 deletions

View File

@ -227,8 +227,6 @@
<addaction name="actionOpenSetup"/>
<addaction name="actionSaveSetup"/>
<addaction name="separator"/>
<addaction name="actionMeasurementWizard"/>
<addaction name="separator"/>
<addaction name="actionOpenConfiguration"/>
<addaction name="actionSaveConfiguration"/>
<addaction name="separator"/>

View File

@ -34,124 +34,385 @@
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>140</y>
<width>321</width>
<height>156</height>
<x>45</x>
<y>75</y>
<width>686</width>
<height>231</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="title">
<string>Digital Tests</string>
<string>Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<y>110</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="chk">
<widget class="QCheckBox" name="chkDetectorFirmware">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Detector Module</string>
<string>Readout Firmware</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_2">
<widget class="QCheckBox" name="chkDetectorSoftware">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Test xxx</string>
<string>Readout Software</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnDigital">
<property name="geometry">
<rect>
<x>75</x>
<y>115</y>
<width>150</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Run</string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>425</x>
<y>140</y>
<width>321</width>
<height>156</height>
</rect>
</property>
<property name="title">
<string>Analog Tests</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_3">
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>15</x>
<y>20</y>
<y>185</y>
<width>656</width>
<height>36</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btnTest">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Run Test </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget_5">
<property name="geometry">
<rect>
<x>415</x>
<y>30</y>
<width>256</width>
<height>31</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="lblModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Module:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry">
<rect>
<x>280</x>
<y>110</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_3">
<widget class="QCheckBox" name="chkDetectorBus">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Detector Module</string>
<string>Readout Bus</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBox_4">
<widget class="QCheckBox" name="chkDetectorMemory">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Test xxx</string>
<string>Readout Memory</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btnAnalog">
<widget class="QWidget" name="gridLayoutWidget_6">
<property name="geometry">
<rect>
<x>85</x>
<y>115</y>
<width>150</width>
<height>25</height>
<x>530</x>
<y>110</y>
<width>141</width>
<height>26</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QCheckBox" name="chkChip">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Chip</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget_4">
<property name="geometry">
<rect>
<x>15</x>
<y>30</y>
<width>276</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Run</string>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="lblDetector">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Readout:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboDetector">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_4">
<property name="geometry">
<rect>
<x>15</x>
<y>60</y>
<width>276</width>
<height>31</height>
</rect>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/start.png</normaloff>:/icons/images/start.png</iconset>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="lblStatusLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lblStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>IDLE</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget_7">
<property name="geometry">
<rect>
<x>530</x>
<y>135</y>
<width>141</width>
<height>26</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QCheckBox" name="chkModuleFirmware">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Module Firmware</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>5</x>
<y>95</y>
<width>676</width>
<height>16</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>5</x>
<y>165</y>
<width>676</width>
<height>16</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</widget>
@ -159,70 +420,16 @@
<property name="geometry">
<rect>
<x>45</x>
<y>30</y>
<width>291</width>
<height>36</height>
<y>25</y>
<width>686</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lblModule_2">
<property name="text">
<string>Detector Status:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblStatus">
<property name="text">
<string>Offline</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>440</x>
<y>29</y>
<width>291</width>
<height>76</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblModule">
<property name="text">
<string>Module Number:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnGetInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -235,12 +442,12 @@
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Get Information</string>
<string>Get ID Information </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">

View File

@ -431,7 +431,7 @@ QString filePath;
QString fileName;
/** Max Number of Clone Windows */
static const int TRIM_HISTOGRAM_XMAX = 600;
static const int TRIM_HISTOGRAM_XMAX = 63;

View File

@ -12,8 +12,9 @@
#include "ui_form_tab_debugging.h"
/** Project Class Headers */
class multiSlsDetector;
class slsDetector;
/** Qt Include Headers */
#include <QTreeWidget>
/** C++ Include Headers */
#include "sls_detector_defs.h"
@ -39,12 +40,6 @@ public:
void Refresh();
private:
/** The sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/** Sets up the widget
*/
void SetupWidgetWindow();
@ -54,6 +49,50 @@ private:
void Initialization();
private slots:
/** Updates the module list depending on current detector
*/
void UpdateModuleList();
/** Updates the status depending on current detector
*/
void UpdateStatus();
/** Gets id and versions etc
*/
void GetInfo();
/** Sets id and versions on the display widget
*/
void SetParameters(QTreeWidgetItem *item);
/** Test detector and module
*/
void TestDetector();
private:
/** The multi sls detector object */
multiSlsDetector *myDet;
/** detector type */
slsDetectorDefs::detectorType detType;
/**sls detecctor object */
slsDetector *det;
/** Tree Widget displaying the detectors, modules */
QTreeWidget *treeDet;
/** Widget displaying the serial numbers, mac addresses etc */
QFrame *dispFrame;
QLabel *lblDetectorId;
QLabel *lblDetectorSerial;
QLabel *lblDetectorFirmware;
QLabel *lblDetectorSoftware;
QLabel *lblModuleId;
QLabel *lblModuleFirmware;
QLabel *lblModuleSerial;
QPalette *blue;
};

View File

@ -352,11 +352,6 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main");
}
}
else if(action==actionMeasurementWizard){
#ifdef VERBOSE
cout << "Measurement Wizard" << endl;
#endif
}
else if(action==actionOpenConfiguration){
#ifdef VERBOSE
cout << "Loading Configuration" << endl;
@ -461,13 +456,18 @@ void qDetectorMain::ExecuteHelp(QAction *action){
#ifdef VERBOSE
cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl;
#endif
char version[200];
sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
string thisClientVersion = string(version);
//<h1 style="font-family:verdana;">A heading</h1>
qDefs::Message(qDefs::INFORMATION,"<p style=\"font-family:verdana;\">SLS Detector GUI version: 1.0<br><br>"
qDefs::Message(qDefs::INFORMATION,"<p style=\"font-family:verdana;\">"
"SLS Detector GUI version: 1.0<br>"
"SLS Detector Client version: "+thisClientVersion+"<br><br>"
"Common GUI to control the SLS Detectors: "
"Mythen, Eiger, Gotthard and Agipd.<br><br>"
"It can be operated in parallel with the command line interface:<br>"
"sls_detector_put,<br>sls_detector_get,<br>sls_detector_acquire and<br>sls_detector_help.<br><br>"
"The software is still in progress. "
"The GUI Software is still in progress. "
"Please report bugs to dhanya.maliakal@psi.ch.<\\p>","About SLS Detector GUI");
}
}

View File

@ -1220,7 +1220,7 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
for(i=0;i<actualPixelsX;i++){
if((temp[i]<=TRIM_HISTOGRAM_XMAX))/**shouldnt be the case*/
histYAxis[0][(int)temp[i]]+=1;
//else cout<<"OUT OF BOUNDS:"<<i<<"-"<<temp[i]<<endl;
else cout<<"OUT OF BOUNDS:"<<i<<"-"<<temp[i]<<endl;
}
/* for(i=0;i<TRIM_HISTOGRAM_XMAX;i++)

View File

@ -24,7 +24,6 @@ qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlo
QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){
setupUi(this);
SetupWidgetWindow();
Initialization();
}
@ -58,6 +57,10 @@ void qTabAdvanced::SetupWidgetWindow(){
btnGroup = new QButtonGroup(this);
btnGroup->addButton(btnRefresh,0);
btnGroup->addButton(btnGetTrimbits,1);
Initialization();
}
}

View File

@ -9,6 +9,9 @@
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
// Qt Include Headers
#include <QDesktopWidget>
#include <QGridLayout>
// C++ Include Headers
#include<iostream>
using namespace std;
@ -18,7 +21,8 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
qTabDebugging::qTabDebugging(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector),treeDet(NULL){
setupUi(this);
SetupWidgetWindow();
Initialization();
@ -37,41 +41,443 @@ qTabDebugging::~qTabDebugging(){
void qTabDebugging::SetupWidgetWindow(){
blue = new QPalette();
blue->setColor(QPalette::Active,QPalette::WindowText,Qt::darkBlue);
// Detector Type
detType=myDet->getDetectorsType();
//status
int detStatus = (int)myDet->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
lblStatus->setText(QString(status.c_str()).toUpper());
if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:");
else lblModule->setText("Module Number:");
// loading combo box module numbers
int max = myDet->setNumberOfModules();
///change module label
switch(detType){
case slsDetectorDefs::EIGER:
lblDetector->setText("Half Module:");
chkDetectorFirmware->setText("Half Module Firmware:");
chkDetectorSoftware->setText("Half Module Software:");
chkDetectorMemory->setText("Half Module Memory:");
chkDetectorBus->setText("Half Module Bus:");
lblModule->hide();
comboModule->hide();
chkModuleFirmware->hide();
chkChip->setEnabled(false);
chkModuleFirmware->setEnabled(false);
break;
case slsDetectorDefs::GOTTHARD:
lblDetector->setText("Module:");
chkDetectorFirmware->setText("Module Firmware:");
chkDetectorSoftware->setText("Module Software:");
chkDetectorMemory->setText("Module Memory:");
chkDetectorBus->setText("Module Bus:");
lblModule->hide();
comboModule->hide();
chkModuleFirmware->hide();
chkChip->setEnabled(false);
chkModuleFirmware->setEnabled(false);
break;
case slsDetectorDefs::MYTHEN:
break;
default:
//leave everything as it is(mythen is default)
break;
}
/* for(int i=0;i<max;i++){
slsDetector *s = myDet->getSlsDetector(i);
if(s->setTCPSocket()!=slsDetectorDefs::FAIL){
comboModule->addItem(QString::number(i));
}
}*/
//add detectors
for(int i=0;i<myDet->getNumberOfDetectors();i++){
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
}
//add modules and status for current detector
if(detType==slsDetectorDefs::MYTHEN) UpdateModuleList();
UpdateStatus();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::Initialization(){
if(detType==slsDetectorDefs::MYTHEN)
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateModuleList()));
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateStatus()));
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::UpdateModuleList(){
det = myDet->getSlsDetector(comboDetector->currentIndex());
//deletes all modules except "all modules"
for(int i=0;i<comboModule->count()-1;i++)
comboModule->removeItem(i);
for(int i=0;i<det->getNMods();i++){
comboModule->addItem(QString("Module %1").arg(i));
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::UpdateStatus(){
det = myDet->getSlsDetector(comboDetector->currentIndex());
int detStatus = (int)det->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
lblStatus->setText(QString(status.c_str()).toUpper());
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::GetInfo(){
//window
QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow );
QList<QTreeWidgetItem *> items;
//layout
QGridLayout *layout = new QGridLayout(popup1);
//treewidget
treeDet = new QTreeWidget(popup1);
layout->addWidget(treeDet,0,0);
//display the details
dispFrame = new QFrame(popup1);
QGridLayout *formLayout = new QGridLayout(dispFrame);
lblDetectorId = new QLabel(""); lblDetectorId->setPalette(*blue);
lblDetectorSerial = new QLabel(""); lblDetectorSerial->setPalette(*blue);
lblDetectorFirmware = new QLabel(""); lblDetectorFirmware->setPalette(*blue);
lblDetectorSoftware = new QLabel(""); lblDetectorSoftware->setPalette(*blue);
lblModuleId = new QLabel(""); lblModuleId->setPalette(*blue);
lblModuleSerial = new QLabel(""); lblModuleSerial->setPalette(*blue);
lblModuleFirmware = new QLabel(""); lblModuleFirmware->setPalette(*blue);
//to make sure the size is constant
lblDetectorFirmware->setFixedWidth(100);
layout->addWidget(dispFrame,0,1);
switch(detType){
case slsDetectorDefs::MYTHEN:{
//display widget
formLayout->addWidget(new QLabel("Readout:"),0,0);
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
formLayout->addWidget(lblDetectorId,0,2);
formLayout->addWidget(new QLabel("Readout MAC Address:"),1,0);
formLayout->addWidget(lblDetectorSerial,1,2);
formLayout->addWidget(new QLabel("Readout Firmware Version:"),2,0);
formLayout->addWidget(lblDetectorFirmware,2,2);
formLayout->addWidget(new QLabel("Readout Software Version:"),3,0);
formLayout->addWidget(lblDetectorSoftware,3,2);
formLayout->addWidget(new QLabel("Module:"),4,0);
formLayout->addWidget(lblModuleId,4,2);
formLayout->addWidget(new QLabel("Module Serial Number:"),5,0);
formLayout->addWidget(lblModuleSerial,5,2);
formLayout->addWidget(new QLabel("Module Firmware Version:"),6,0);
formLayout->addWidget(lblModuleFirmware,6,2);
//tree widget
treeDet->setHeaderLabel("Mythen Detector");
//gets det names
for (int i=0;i<comboDetector->count();i++)
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Readout (%1)").arg(comboDetector->itemText(i)))));
treeDet->insertTopLevelItems(0, items);
//gets module names
for (int i=0;i<comboDetector->count();i++){
QList<QTreeWidgetItem *> childItems;
det = myDet->getSlsDetector(i);
for(int j=0;j<det->getNMods();j++)
childItems.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module %1").arg(j))));
treeDet->topLevelItem(i)->insertChildren(0,childItems);
}
break;
}
case slsDetectorDefs::EIGER:{
//display widget
formLayout->addWidget(new QLabel("Half Module:"),0,0);
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
formLayout->addWidget(lblDetectorId,0,2);
formLayout->addWidget(new QLabel("Half Module MAC Address:"),1,0);
formLayout->addWidget(lblDetectorSerial,1,2);
formLayout->addWidget(new QLabel("Half Module Firmware Version:"),2,0);
formLayout->addWidget(lblDetectorFirmware,2,2);
formLayout->addWidget(new QLabel("Half Module Software Version:"),3,0);
formLayout->addWidget(lblDetectorSoftware,3,2);
//tree widget
treeDet->setHeaderLabel("Eiger Detector");
//get num modules
for (int i=0;i<comboDetector->count()/2;i++)
items.append(new QTreeWidgetItem((QTreeWidget*)0, 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*)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i)))));
treeDet->topLevelItem(i*2)->insertChildren(0,childItems);
}
break;
}
case slsDetectorDefs::GOTTHARD:{
//display widget
formLayout->addWidget(new QLabel("Module:"),0,0);
formLayout->addItem(new QSpacerItem(15,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,1);
formLayout->addWidget(lblDetectorId,0,2);
formLayout->addWidget(new QLabel("Module MAC Address:"),1,0);
formLayout->addWidget(lblDetectorSerial,1,2);
formLayout->addWidget(new QLabel("Module Firmware Version:"),2,0);
formLayout->addWidget(lblDetectorFirmware,2,2);
formLayout->addWidget(new QLabel("Module Software Version:"),3,0);
formLayout->addWidget(lblDetectorSoftware,3,2);
//tree widget
treeDet->setHeaderLabel("Gotthard Detector");
//gets det names
for (int i=0;i<comboDetector->count();i++)
items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
treeDet->insertTopLevelItems(0, items);
break;
}
default:
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));
//initializations
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)) , this, SLOT(SetParameters(QTreeWidgetItem *)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::SetParameters(QTreeWidgetItem *item){
char value[200];
int i;
switch(detType){
case slsDetectorDefs::MYTHEN:{
if(item->text(0).contains("Readout")){
//find index
for(i=0;i<comboDetector->count();i++)
if(item== treeDet->topLevelItem(i))
break;
det = myDet->getSlsDetector(i);
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
lblModuleId->setText("");
lblModuleSerial->setText("");
lblModuleFirmware->setText("");
}else{
//find index
for(i=0;i<comboDetector->count();i++)
if(item->parent() == treeDet->topLevelItem(i))
break;
int im = item->parent()->indexOfChild(item);
det = myDet->getSlsDetector(i);
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
lblModuleId->setText(QString("%1").arg(im));
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im));
lblModuleSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im));
lblModuleFirmware->setText(QString(value));
}
break;
}
case slsDetectorDefs::EIGER:{
//only if half module clicked
if(item->text(0).contains("Half Module")){
//find index
for(i=0;i<comboDetector->count();i++)
if(item== treeDet->topLevelItem(i))
break;
det = myDet->getSlsDetector(i);
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
}
break;
}
case slsDetectorDefs::GOTTHARD:{
//find index
for(i=0;i<comboDetector->count();i++)
if(item== treeDet->topLevelItem(i))
break;
det = myDet->getSlsDetector(i);
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
break;
}
default:
break;
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::TestDetector(){
#ifdef VERBOSE
cout << "Testing" << endl;
#endif
int retval=slsDetectorDefs::FAIL;
QString message;
QString Detector = "Detector";
//main messagebox title
switch(detType){
case slsDetectorDefs::MYTHEN:
message = QString("<nobr>Test Results for %1 and %2:</nobr><br><br>").arg(comboDetector->currentText(),comboModule->currentText());
break;
case slsDetectorDefs::EIGER: Detector = "Half Module"; break;
case slsDetectorDefs::GOTTHARD: Detector = "Module"; break;
default: break;
}
if(detType==slsDetectorDefs::MYTHEN)
message = QString("<nobr>Test Results for %1 and %2:</nobr><br><br>").arg(comboDetector->currentText(),comboModule->currentText());
else message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
//get sls det object
det = myDet->getSlsDetector(comboDetector->currentIndex());
//detector firmware
if(chkDetectorFirmware->isChecked()){
retval = det->digitalTest(slsDetectorDefs::DETECTOR_FIRMWARE_TEST);
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Firmware: FAIL</nobr><br>").arg(Detector));
else message.append(QString("<nobr>%1 Firmware: %2</nobr><br>").arg(Detector,QString::number(retval)));
#ifdef VERBOSE
cout<<"Detector Firmware: "<<retval<<endl;
#endif
}
//detector software
if(chkDetectorSoftware->isChecked()){
retval = det->digitalTest(slsDetectorDefs::DETECTOR_SOFTWARE_TEST);
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Software: FAIL</nobr><br>").arg(Detector));
else message.append(QString("<nobr>%1 Software: %2</nobr><br>").arg(Detector,QString::number(retval)));
#ifdef VERBOSE
cout<<"Detector Software: "<<retval<<endl;
#endif
}
//detector CPU-FPGA bus
if(chkDetectorBus->isChecked()){
retval = det->digitalTest(slsDetectorDefs::DETECTOR_BUS_TEST);
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Bus: &nbsp;&nbsp;&nbsp;&nbsp;FAIL</nobr><br>").arg(Detector));
else message.append(QString("<nobr>%1 Bus: &nbsp;&nbsp;&nbsp;&nbsp;%2</nobr><br>").arg(Detector,QString::number(retval)));
#ifdef VERBOSE
cout<<"Detector Bus: "<<retval<<endl;
#endif
}
//detector Memory
if(chkDetectorMemory->isChecked()){
retval = det->digitalTest(slsDetectorDefs::DETECTOR_MEMORY_TEST);
if(retval== slsDetectorDefs::FAIL) message.append(QString("<nobr>%1 Memory: &nbsp;FAIL</nobr><br>").arg(Detector));
else message.append(QString("<nobr>%1 Memory: &nbsp;%2</nobr><br>").arg(Detector,QString::number(retval)));
#ifdef VERBOSE
cout<<"Detector Memory: "<<retval<<endl;
#endif
}
//chip
if(chkChip->isChecked()){
retval = det->digitalTest(slsDetectorDefs::CHIP_TEST,comboModule->currentIndex());
if(retval== slsDetectorDefs::FAIL) message.append("<br><nobr>Chip: FAIL</nobr><br>");
else message.append(QString("<nobr>Chip: %1</nobr><br>").arg(retval));
#ifdef VERBOSE
cout<<"Chip: "<<retval<<endl;
#endif
}
//module firmware
if(chkModuleFirmware->isChecked()){
retval = det->digitalTest(slsDetectorDefs::MODULE_FIRMWARE_TEST,comboModule->currentIndex());
if(retval== slsDetectorDefs::FAIL) message.append("<nobr>Module Firmware: FAIL</nobr><br>");
else message.append(QString("<nobr>Module Firmware: %1</nobr><br>").arg(retval));
#ifdef VERBOSE
cout<<"Module Firmware: "<<retval<<endl;
#endif
}
//display message
qDefs::Message(qDefs::INFORMATION,message.toAscii().constData(),"Debugging");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDebugging::Refresh(){
UpdateStatus();
}

View File

@ -57,9 +57,11 @@ void qTabMessages::SetupWidgetWindow(){
btnClear->setFixedWidth(100);
btnClear->setIcon(QIcon( ":/icons/images/erase.png" ));
gridLayout->addWidget(btnSave,0,0,1,1);
gridLayout->addWidget(btnClear,0,4,1,1);
gridLayout->addWidget(dispLog,1,0,1,5);
gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),0,0);
gridLayout->addWidget(btnSave,1,0,1,1);
gridLayout->addWidget(btnClear,1,4,1,1);
gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0);
gridLayout->addWidget(dispLog,3,0,1,5);
qout=new qDebugStream(std::cout,this);
}