mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 07:17:13 +02:00
going to start actions
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@19 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -16,8 +16,8 @@ using namespace std;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent,slsDetectorUtils*& detector,int detID):
|
||||
QWidget(parent),myDet(detector),detID(detID){
|
||||
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID):
|
||||
QWidget(parent),myDet(detector),detID(detID), expertMode(false){
|
||||
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
@ -41,6 +41,22 @@ void qTabSettings::SetupWidgetWindow(){
|
||||
SetupDetectorSettings();
|
||||
comboSettings->setCurrentIndex(myDet->getSettings(detID));
|
||||
|
||||
/**expert mode is not enabled initially*/
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
|
||||
/** Number of Modules */
|
||||
spinNumModules->setMaximum(myDet->getMaxNumberOfModules());
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
|
||||
/** Dynamic Range */
|
||||
switch(myDet->setDynamicRange(-1)){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
case 8: comboDynamicRange->setCurrentIndex(2); break;
|
||||
case 4: comboDynamicRange->setCurrentIndex(3); break;
|
||||
default: comboDynamicRange->setCurrentIndex(0); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -107,15 +123,12 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. "
|
||||
"Exiting GUI.","Settings");
|
||||
#ifdef VERBOSE
|
||||
cout<<"ERROR: Unknown Detector Settings retrieved from detector."<<endl;
|
||||
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
/** Setting the detector settings */
|
||||
else {
|
||||
comboSettings->setCurrentIndex((int)sett);
|
||||
|
||||
}
|
||||
else comboSettings->setCurrentIndex((int)sett);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +136,13 @@ void qTabSettings::SetupDetectorSettings(){
|
||||
|
||||
void qTabSettings::Initialization(){
|
||||
/** Settings */
|
||||
connect(comboSettings,SIGNAL(currentIndexChanged(int)),this,SLOT(setSettings(int)));
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||
/** Number of Modules */
|
||||
connect(spinNumModules, SIGNAL(valueChanged(int)), this, SLOT(SetNumberOfModules(int)));
|
||||
/** Dynamic Range */
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
/** Threshold */
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -142,11 +161,91 @@ void qTabSettings::setSettings(int index){
|
||||
}
|
||||
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett)<<endl;
|
||||
cout << "Settings have been set to "<<myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
|
||||
#endif
|
||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}else{
|
||||
if((index==Undefined)||(index==Uninitialized)){
|
||||
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}else{
|
||||
lblThreshold->setEnabled(expertMode);
|
||||
spinThreshold->setEnabled(expertMode);
|
||||
if(expertMode) SetEnergy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabSettings::SetNumberOfModules(int index){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting number of modules to "<< index << endl;
|
||||
#endif
|
||||
int i = myDet->setNumberOfModules(index);
|
||||
if(index!=i)
|
||||
qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings");
|
||||
#ifdef VERBOSE
|
||||
cout << "ERROR: Setting number of modules to "<< i << endl;
|
||||
#endif
|
||||
spinNumModules->setValue(i);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index){
|
||||
int ret,dr;
|
||||
switch (index) {
|
||||
case 0: dr=32; break;
|
||||
case 1: dr=16; break;
|
||||
case 2: dr=8; break;
|
||||
case 3: dr=4; break;
|
||||
default: dr=32; break;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting dynamic range to "<< dr << endl;
|
||||
#endif
|
||||
ret=myDet->setDynamicRange(dr);
|
||||
if(ret!=dr){
|
||||
qDefs::WarningMessage("Dynamic Range cannot be set for this value.","Settings");
|
||||
#ifdef VERBOSE
|
||||
cout << "ERROR: Setting dynamic range to "<< ret << endl;
|
||||
#endif
|
||||
switch(ret){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
case 8: comboDynamicRange->setCurrentIndex(2); break;
|
||||
case 4: comboDynamicRange->setCurrentIndex(3); break;
|
||||
default: comboDynamicRange->setCurrentIndex(0); break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabSettings::SetEnergy(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Settings threshold energy to "<< index << endl;
|
||||
#endif
|
||||
int index = spinThreshold->value();
|
||||
myDet->setThresholdEnergy(index);
|
||||
int ret = (int)myDet->getThresholdEnergy();
|
||||
if(ret!=index){
|
||||
qDefs::WarningMessage("Threshold energy could not be set.","Settings");
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
spinThreshold->setValue(ret);
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -154,6 +253,33 @@ void qTabSettings::Refresh(){
|
||||
/** Settings */
|
||||
SetupDetectorSettings();
|
||||
comboSettings->setCurrentIndex(myDet->getSettings(detID));
|
||||
/** Number of Modules */
|
||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||
|
||||
/** Dynamic Range */
|
||||
switch(myDet->setDynamicRange(-1)){
|
||||
case 32: comboDynamicRange->setCurrentIndex(0); break;
|
||||
case 16: comboDynamicRange->setCurrentIndex(1); break;
|
||||
case 8: comboDynamicRange->setCurrentIndex(2); break;
|
||||
case 4: comboDynamicRange->setCurrentIndex(3); break;
|
||||
default: comboDynamicRange->setCurrentIndex(0); break;
|
||||
}
|
||||
|
||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}else{
|
||||
if((comboSettings->currentIndex()==Undefined)||(comboSettings->currentIndex()==Uninitialized)){
|
||||
lblThreshold->setEnabled(false);
|
||||
spinThreshold->setEnabled(false);
|
||||
}else{
|
||||
lblThreshold->setEnabled(expertMode);
|
||||
spinThreshold->setEnabled(expertMode);
|
||||
if(expertMode) SetEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user