git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@60 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-09-19 14:40:27 +00:00
parent ee264e9b56
commit d01852892b
15 changed files with 450 additions and 216 deletions

View File

@ -241,7 +241,6 @@
<string>&amp;Modes</string> <string>&amp;Modes</string>
</property> </property>
<addaction name="actionDebug"/> <addaction name="actionDebug"/>
<addaction name="actionBeamline"/>
<addaction name="actionExpert"/> <addaction name="actionExpert"/>
<addaction name="actionDockable"/> <addaction name="actionDockable"/>
</widget> </widget>

View File

@ -656,7 +656,7 @@ Plots Trimbits from Detector. This will take time.
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="boxLogs">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>405</x> <x>405</x>

View File

@ -123,9 +123,13 @@ private:
* */ * */
void Initialization(); void Initialization();
/** Loads config file at start up
* */
void LoadConfigFile(const string fName);
private slots: private slots:
/** Enables modes as selected -Debug, Beamline, Expert, Dockable(calls setdockablemode()) /** Enables modes as selected -Debug, Expert, Dockable(calls setdockablemode())
* */ * */
void EnableModes(QAction *action); void EnableModes(QAction *action);

View File

@ -113,6 +113,8 @@ private:
/** Trimming mode */ /** Trimming mode */
slsDetectorDefs::trimMode trimmingMode; slsDetectorDefs::trimMode trimmingMode;
bool isEnergy;
bool isAngular;
}; };

View File

@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include
RESOURCES += icons.qrc RESOURCES += icons.qrc
DEFINES += VERBOSE VERYVERBOSE #DACS_INT #VERYVERBOSE DEFINES += VERBOSE #DACS_INT #VERYVERBOSE
target.path += $(DESTDIR) target.path += $(DESTDIR)

View File

@ -48,11 +48,12 @@ int main (int argc, char **argv) {
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) : qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *parent) :
QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){ QMainWindow(parent), theApp(app),myDet(0),detID(0),myPlot(NULL),tabs(NULL),isDeveloper(0){
string configFName = "";
// Getting all the command line arguments // Getting all the command line arguments
for(int iarg=1; iarg<argc; iarg++){ for(int iarg=1; iarg<argc; iarg++){
if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;} if(!strcasecmp(argv[iarg],"-developer")) {isDeveloper=1;}
if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);} if(!strcasecmp(argv[iarg],"-id")) {detID=atoi(argv[iarg+1]);}
if(!strcasecmp(argv[iarg],"-config")) {configFName=string(argv[iarg+1]);}
if(!strcasecmp(argv[iarg],"-help")){ if(!strcasecmp(argv[iarg],"-help")){
cout << "Possible Arguments are:" << endl; cout << "Possible Arguments are:" << endl;
cout << "-help \t\t : \t This help" << endl; cout << "-help \t\t : \t This help" << endl;
@ -66,6 +67,8 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *
SetUpDetector(); SetUpDetector();
SetUpWidgetWindow(); SetUpWidgetWindow();
Initialization(); Initialization();
if(!configFName.empty()) LoadConfigFile(configFName);
} }
@ -140,24 +143,22 @@ void qDetectorMain::SetUpWidgetWindow(){
// mode setup - to set up the tabs initially as disabled, not in form so done here // mode setup - to set up the tabs initially as disabled, not in form so done here
#ifdef VERBOSE #ifdef VERBOSE
cout << "Setting Debug Mode to 0\nSetting Beamline Mode to 0\n" cout << "Setting Debug Mode to 0\n"
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n" "Setting Expert Mode to 0\n"
"Setting Developer Mode to " << isDeveloper << endl; "Setting Developer Mode to " << isDeveloper << ""
"\nSetting Dockable Mode to false\n" << endl;
#endif #endif
tabs->setTabEnabled(Debugging,false); tabs->setTabEnabled(Debugging,false);
//beamline mode to false
tabs->setTabEnabled(Advanced,false); tabs->setTabEnabled(Advanced,false);
tabs->setTabEnabled(Developer,isDeveloper);
actionLoadTrimbits->setVisible(false); actionLoadTrimbits->setVisible(false);
actionSaveTrimbits->setVisible(false); actionSaveTrimbits->setVisible(false);
actionLoadCalibration->setVisible(false); actionLoadCalibration->setVisible(false);
actionSaveCalibration->setVisible(false); actionSaveCalibration->setVisible(false);
dockWidgetPlot->setFloating(false); dockWidgetPlot->setFloating(false);
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
tabs->setTabEnabled(Developer,isDeveloper);
if(!digitalDetector) actionExpert->setEnabled(false);
#ifdef VERBOSE
cout << "Advanced Enabled:" << digitalDetector << endl;
#endif
// Other setup // Other setup
//Height of plot and central widget //Height of plot and central widget
heightPlotWindow = dockWidgetPlot->size().height(); heightPlotWindow = dockWidgetPlot->size().height();
@ -175,7 +176,7 @@ void qDetectorMain::SetUpDetector(){
//instantiate detector and set window title //instantiate detector and set window title
myDet = new multiSlsDetector(); myDet = new multiSlsDetector(detID);
string host = myDet->getHostname(); string host = myDet->getHostname();
//if hostname doesnt exist even in shared memory //if hostname doesnt exist even in shared memory
@ -198,11 +199,10 @@ void qDetectorMain::SetUpDetector(){
// Check if type valid. If not, exit // Check if type valid. If not, exit
slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
switch(detType){ switch(detType){
//digitalDetector decides if trimbits should be shown case slsDetectorDefs::MYTHEN: break;
case slsDetectorDefs::MYTHEN: digitalDetector = true; break; case slsDetectorDefs::EIGER: break;
case slsDetectorDefs::EIGER: digitalDetector = true; break; case slsDetectorDefs::GOTTHARD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break;
case slsDetectorDefs::GOTTHARD: digitalDetector = false;break; case slsDetectorDefs::AGIPD: actionLoadTrimbits->setText("Load Settings"); actionSaveTrimbits->setText("Save Settings"); break;
case slsDetectorDefs::AGIPD: digitalDetector = false;break;
default: default:
string detName = myDet->slsDetectorBase::getDetectorType(detType); string detName = myDet->slsDetectorBase::getDetectorType(detType);
string errorMess = host+string(" has unknown detector type \"")+ string errorMess = host+string(" has unknown detector type \"")+
@ -236,9 +236,11 @@ void qDetectorMain::Initialization(){
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool))); connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
// Data Output Tab // Data Output Tab
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
//enable scanbox( for angles)
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_plot,SLOT(EnableScanBox()));
// Plot tab // Plot tab
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool))); connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
// Actions tab (also for angles) // Actions tab (only for scan)
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox())); connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
//settings to advanced tab(int=id is always 0 to only refresh) //settings to advanced tab(int=id is always 0 to only refresh)
connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int))); connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int)));
@ -259,6 +261,23 @@ void qDetectorMain::Initialization(){
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::LoadConfigFile(const string fName){
#ifdef VERBOSe
cout << "Loading config file at start up:" << fName << endl;
#endif
QString file = QString(fName.c_str());//.section('/',-1);
if((file.contains('.'))&&(QFile::exists(file))){
if(myDet->readConfigurationFile(fName)!=slsDetectorDefs::FAIL)
qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been loaded successfully at start up.","Main");
else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters at start up from file:\n")+fName,"Main");
}else qDefs::Message(qDefs::WARNING,string("Start up configuration failed to load. The following file does not exist:\n")+fName,"Main");
}
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -274,14 +293,6 @@ void qDetectorMain::EnableModes(QAction *action){
#endif #endif
} }
//Set BeamlineMode
else if(action==actionBeamline){
enable = actionBeamline->isChecked();
#ifdef VERBOSE
cout << "Setting Beamline Mode to " << enable << endl;
#endif
}
//Set ExpertMode(comes here only if its a digital detector) //Set ExpertMode(comes here only if its a digital detector)
else if(action==actionExpert){ else if(action==actionExpert){
enable = actionExpert->isChecked(); enable = actionExpert->isChecked();
@ -291,13 +302,8 @@ void qDetectorMain::EnableModes(QAction *action){
actionSaveTrimbits->setVisible(enable); actionSaveTrimbits->setVisible(enable);
actionLoadCalibration->setVisible(enable); actionLoadCalibration->setVisible(enable);
actionSaveCalibration->setVisible(enable); actionSaveCalibration->setVisible(enable);
if(digitalDetector){
tab_measurement->SetExpertMode(enable); tab_measurement->SetExpertMode(enable);
tab_settings->SetExpertMode(enable); tab_settings->SetExpertMode(enable);
}
#ifdef VERBOSE #ifdef VERBOSE
cout << "Setting Expert Mode to " << enable << endl; cout << "Setting Expert Mode to " << enable << endl;
#endif #endif
@ -385,10 +391,28 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
} }
} }
else if(action==actionLoadTrimbits){ else if(action==actionLoadTrimbits){
QString fName = QString(myDet->getSettingsDir());
//gotthard
if(actionLoadTrimbits->text().contains("Settings")){
#ifdef VERBOSE
cout << "Loading Settings" << endl;
#endif
fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Settings"),fName,
tr("Settings files (*.settings settings.sn*)"));
// Gets called when cancelled as well
if (!fName.isEmpty()){
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::Message(qDefs::INFORMATION,"The Settings have been loaded successfully.","Main");
else qDefs::Message(qDefs::WARNING,string("Could not load the Settings from file:\n")+fName.toAscii().constData(),"Main");
}
}//mythen and eiger
else{
#ifdef VERBOSE #ifdef VERBOSE
cout << "Loading Trimbits" << endl; cout << "Loading Trimbits" << endl;
#endif #endif
QString fName = QString(myDet->getSettingsDir());
fName = QFileDialog::getOpenFileName(this, fName = QFileDialog::getOpenFileName(this,
tr("Load Detector Trimbits"),fName, tr("Load Detector Trimbits"),fName,
tr("Trimbit files (*.trim noise.sn*)")); tr("Trimbit files (*.trim noise.sn*)"));
@ -399,7 +423,26 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
}
else if(action==actionSaveTrimbits){ else if(action==actionSaveTrimbits){
//gotthard
if(actionLoadTrimbits->text().contains("Settings")){
#ifdef VERBOSE
cout << "Saving Settings" << endl;
#endif
//different output directory so as not to overwrite
QString fName = QString(myDet->getSettingsDir());
fName = QFileDialog::getSaveFileName(this,
tr("Save Current Detector Settings"),fName,
tr("Settings files (*.settings settings.sn*) "));
// Gets called when cancelled as well
if (!fName.isEmpty()){
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::Message(qDefs::INFORMATION,"The Settings have been saved successfully.","Main");
else qDefs::Message(qDefs::WARNING,string("Could not save the Settings to file:\n")+fName.toAscii().constData(),"Main");
}
}//mythen and eiger
else{
#ifdef VERBOSE #ifdef VERBOSE
cout << "Saving Trimbits" << endl; cout << "Saving Trimbits" << endl;
#endif//different output directory so as not to overwrite #endif//different output directory so as not to overwrite
@ -414,6 +457,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main");
} }
} }
}
else if(action==actionLoadCalibration){ else if(action==actionLoadCalibration){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Loading Calibration Data" << endl; cout << "Loading Calibration Data" << endl;
@ -579,41 +623,20 @@ void qDetectorMain::EnableTabs(){
actionSaveConfiguration->setEnabled(enable); actionSaveConfiguration->setEnabled(enable);
actionMeasurementWizard->setEnabled(enable); actionMeasurementWizard->setEnabled(enable);
actionDebug->setEnabled(enable); actionDebug->setEnabled(enable);
actionBeamline->setEnabled(enable);
actionExpert->setEnabled(enable); actionExpert->setEnabled(enable);
// special tabs // special tabs
if(enable==false){ tabs->setTabEnabled(Debugging,enable && (actionDebug->isChecked()));
tabs->setTabEnabled(Debugging,enable); tabs->setTabEnabled(Developer,enable && isDeveloper);
tabs->setTabEnabled(Advanced,enable); //expert
actionLoadTrimbits->setVisible(false); bool expertTab = enable && (actionExpert->isChecked());
actionSaveTrimbits->setVisible(false); tabs->setTabEnabled(Advanced,expertTab);
actionLoadCalibration->setVisible(false); actionLoadTrimbits->setVisible(expertTab);
actionSaveCalibration->setVisible(false); actionSaveTrimbits->setVisible(expertTab);
tabs->setTabEnabled(Developer,enable); actionLoadCalibration->setVisible(expertTab);
} actionSaveCalibration->setVisible(expertTab);
else{
// enable these tabs only if they were enabled earlier
if(actionDebug->isChecked())
tabs->setTabEnabled(Debugging,enable);
if(actionExpert->isChecked()){
tabs->setTabEnabled(Advanced,enable);
if((enable)&&(digitalDetector)){
actionLoadTrimbits->setVisible(true);
actionSaveTrimbits->setVisible(true);
actionLoadCalibration->setVisible(true);
actionSaveCalibration->setVisible(true);
}else{
actionLoadTrimbits->setVisible(false);
actionSaveTrimbits->setVisible(false);
actionLoadCalibration->setVisible(false);
actionSaveCalibration->setVisible(false);
}
}
if(isDeveloper)
tabs->setTabEnabled(Developer,enable);
}
} }

View File

@ -468,13 +468,14 @@ void qDrawPlot::SetupMeasurement(int currentIndex){
endPixel = maxPixelsY + (pixelWidth/2); endPixel = maxPixelsY + (pixelWidth/2);
} }
} }
/*
cout<<"\nnPixelsY:"<<nPixelsY<<endl; cout<<"nPixelsX:"<<nPixelsX<<endl;
cout<<"minPixelsY:"<<minPixelsY; cout<<"nPixelsY:"<<nPixelsY<<endl;
cout<<"\tmaxPixelsY:"<<maxPixelsY<<endl; cout<<"minPixelsY:"<<minPixelsY<<endl;
cout<<"startPixel:"<<startPixel; cout<<"maxPixelsY:"<<maxPixelsY<<endl;
cout<<"\tendPixel:"<<endPixel<<endl<<endl; cout<<"startPixel:"<<startPixel<<endl;
cout<<"endPixel:"<<endPixel<<endl<<endl;
*/
UnlockLastImageArray(); UnlockLastImageArray();
} }
@ -520,6 +521,43 @@ int qDrawPlot::GetData(detectorData *data){
if(!plotEnable) return 0; if(!plotEnable) return 0;
//angle plotting
if(anglePlot){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
cout<<"angle plot"<<endl;
if(data->angles==NULL){
cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl;
lastImageNumber= currentFrame+1;
nAnglePixelsX = nPixelsX;
histNBins = nAnglePixelsX;
nHists=1;
memcpy(histXAngleAxis,histXAxis,nAnglePixelsX*sizeof(double));
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
SetHistXAxisTitle("Channel Number");
}
else{
lastImageNumber= currentFrame+1;
nAnglePixelsX = data->npoints;
histNBins = nAnglePixelsX;
nHists=1;
if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX];
if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX];
memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double));
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
SetHistXAxisTitle("Angles");
}
pthread_mutex_unlock(&(last_image_complete_mutex));
}
currentFrame++;
return 0;
}
//Nth Frame //Nth Frame
if(frameFactor){ if(frameFactor){
//plots if numfactor becomes 0 //plots if numfactor becomes 0
@ -535,7 +573,7 @@ int qDrawPlot::GetData(detectorData *data){
//Not Nth Frame, to check time out(NOT for 2dScans and angle plots) //Not Nth Frame, to check time out(NOT for 2dScans and angle plots)
else{ else{
if((scanArgument==None)&&(!anglePlot)){ if(scanArgument==None){
//if the time is not over, RETURN //if the time is not over, RETURN
if(!data_pause_over){ if(!data_pause_over){
return 0; return 0;
@ -548,25 +586,6 @@ int qDrawPlot::GetData(detectorData *data){
//angle plotting
if(anglePlot){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
lastImageNumber= currentFrame+1;
nAnglePixelsX = data->npoints;
histNBins = nAnglePixelsX;
nHists=1;
if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX];
if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX];
memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double));
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
pthread_mutex_unlock(&(last_image_complete_mutex));
}
currentFrame++;
return 0;
}
//if scan argument is 2d //if scan argument is 2d
if(scanArgument!=None){ if(scanArgument!=None){
//alframes //alframes
@ -708,9 +727,12 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto
int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
#ifdef VERBOSE
cout << "\nEntering Acquisition Finished with status " ;
#endif
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
#ifdef VERBOSE #ifdef VERBOSE
cout << "\nEntering Acquisition Finished with status " << status.toAscii().constData() << " and progress " << currentProgress << endl; cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
#endif #endif
//error or stopped //error or stopped
if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){ if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){
@ -766,7 +788,8 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl;
#endif #endif
//to make sure it plots the last frame before setting lastimagearray all to 0 //to make sure it plots the last frame before setting lastimagearray all to 0
if(plot_in_scope==2) usleep(500000); //if(plot_in_scope==2)
usleep(500000);
currentMeasurement = currentMeasurementIndex + 1; currentMeasurement = currentMeasurementIndex + 1;
#ifdef VERBOSE #ifdef VERBOSE
@ -827,6 +850,9 @@ void qDrawPlot::UpdatePlot(){
//1-d plot stuff //1-d plot stuff
if(plot_in_scope==1){ if(plot_in_scope==1){
if(lastImageNumber){ if(lastImageNumber){
#ifdef VERYVERBOSE
cout << "Last Image Number:" << lastImageNumber << endl;
#endif
if(histNBins){ if(histNBins){
Clear1DPlot(); Clear1DPlot();
plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
@ -902,7 +928,9 @@ void qDrawPlot::UpdatePlot(){
else else
plot_update_timer->start((int)PLOT_TIMER_MS); plot_update_timer->start((int)PLOT_TIMER_MS);
} }
#ifdef VERYVERBOSE
cout << "Exiting UpdatePlot function" << endl;
#endif
} }
@ -1071,20 +1099,6 @@ void qDrawPlot::SavePlot(){
} }
//-------------------------------------------------------------------------------------------------------------------------------------------------
/*
void qDrawPlot::SaveAll(bool enable){
string msg = string("The Files will be saved as:\n")+
string(myDet->getFilePath().c_str())+string("/")+
string(myDet->getFileName().c_str())+string("[title].png");
qDefs::Message(qDefs::INFORMATION,msg,"Dock");
saveAll = enable;
}
*/
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -324,7 +324,6 @@ void qTabActions::SetPosition(){
qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions"); qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions");
emit EnableScanBox();
} }
@ -375,6 +374,7 @@ void qTabActions::EnablePositions(bool enable){
lblName[NumPositions]->setEnabled(false); lblName[NumPositions]->setEnabled(false);
btnExpand[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false);
} }
} }
@ -383,7 +383,7 @@ void qTabActions::EnablePositions(bool enable){
void qTabActions::Refresh(){ void qTabActions::Refresh(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "\nUpdating all action widgets: " << endl; cout << endl <<"**Updating all action widgets: " << endl;
#endif #endif
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){ if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){
//positions is enabled only if angular conversion is enabled //positions is enabled only if angular conversion is enabled
@ -428,8 +428,10 @@ void qTabActions::Refresh(){
scanWidget[i]->Refresh(); scanWidget[i]->Refresh();
for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++) for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++)
actionWidget[i]->Refresh(); actionWidget[i]->Refresh();
cout << endl;
UpdateCollapseColors(); UpdateCollapseColors();
#ifdef VERBOSE
cout << "**Updated all action widgets: " << endl << endl;
#endif
} }

View File

@ -21,7 +21,7 @@ using namespace std;
qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):
QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){ QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL),isEnergy(false),isAngular(false){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
} }
@ -42,7 +42,24 @@ qTabAdvanced::~qTabAdvanced(){
void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::SetupWidgetWindow(){
//executed even for non digital, so make sure its necessary //executed even for non digital, so make sure its necessary
slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ switch(detType){
case slsDetectorDefs::MYTHEN: isEnergy = true; isAngular = true; break;
case slsDetectorDefs::EIGER: isEnergy = true; isAngular = false; break;
case slsDetectorDefs::GOTTHARD: isEnergy = false; isAngular = true; break;
default: break;
}
if(!isAngular && !isEnergy) boxLogs->setEnabled(false);
else{
if(!isAngular) chkAngularLog->setEnabled(false);
if(!isEnergy){
chkEnergyLog->setEnabled(false);
boxPlot->setEnabled(false);
boxTrimming->setEnabled(false);
}
else{
outputDirTip = dispFile->toolTip(); outputDirTip = dispFile->toolTip();
errOutputTip = QString("<br><br><font color=\"red\"><nobr>" errOutputTip = QString("<br><br><font color=\"red\"><nobr>"
"<b>Output Trim File</b> should contain both existing directory and a file name.</nobr><br>" "<b>Output Trim File</b> should contain both existing directory and a file name.</nobr><br>"
@ -57,12 +74,10 @@ void qTabAdvanced::SetupWidgetWindow(){
btnGroup = new QButtonGroup(this); btnGroup = new QButtonGroup(this);
btnGroup->addButton(btnRefresh,0); btnGroup->addButton(btnRefresh,0);
btnGroup->addButton(btnGetTrimbits,1); btnGroup->addButton(btnGetTrimbits,1);
}
Initialization(); Initialization();
} }
} }
@ -71,7 +86,10 @@ void qTabAdvanced::SetupWidgetWindow(){
void qTabAdvanced::Initialization(){ void qTabAdvanced::Initialization(){
//energy/angular logs //energy/angular logs
if(isAngular)
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
if(isEnergy){
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
//exptime //exptime
@ -99,7 +117,7 @@ void qTabAdvanced::Initialization(){
//refresh //refresh
connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int)));
}
} }
@ -295,7 +313,7 @@ void qTabAdvanced::SetTrimmingMethod(int mode){
void qTabAdvanced::StartTrimming(){ void qTabAdvanced::StartTrimming(){
int parameter1, parameter2; int parameter1=0, parameter2=0;
//optimize //optimize
bool optimize = chkOptimize->isChecked(); bool optimize = chkOptimize->isChecked();
@ -364,21 +382,38 @@ void qTabAdvanced::UpdateTrimbitPlot(int id){
void qTabAdvanced::Refresh(){ void qTabAdvanced::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating Advanced Tab" << endl;
#endif
if(isAngular){
#ifdef VERBOSE
cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl;
#endif
disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog));
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
}
if(isEnergy){
//disconnect //disconnect
disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
//energy/angular logs //energy/angular logs
chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog));
chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog));
#ifdef VERBOSE #ifdef VERBOSE
cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl; cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl;
cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl;
#endif #endif
//exptime //exptime
qDefs::timeUnit unit; qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
@ -396,13 +431,17 @@ void qTabAdvanced::Refresh(){
#endif #endif
spinThreshold->setValue(threshold); spinThreshold->setValue(threshold);
//connect //connect
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
}
#ifdef VERBOSE
cout << "**Updated Advanced Tab" << endl << endl;
#endif
} }

View File

@ -30,8 +30,6 @@ qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector){ QWidget(parent),myDet(detector){
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
Initialization();
Refresh();
} }
@ -66,6 +64,52 @@ void qTabDataOutput::SetupWidgetWindow(){
QString("<nobr><font color=\"red\">" QString("<nobr><font color=\"red\">"
"Enter a valid file to enable Flat Field.</font></nobr>"); "Enter a valid file to enable Flat Field.</font></nobr>");
Initialization();
// output dir
#ifdef VERBOSE
cout << "Getting output directory" << endl;
#endif
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
//flat field correction from server
#ifdef VERBOSE
cout << "Getting flat field" << endl;
#endif
UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){
#ifdef VERBOSE
cout << "Getting rate correction" << endl;
#endif
UpdateRateCorrectionFromServer();
}
//update angular conversion from server
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){
#ifdef VERBOSE
cout << "Getting angular conversion" << endl;
#endif
int ang;
if(myDet->getAngularConversion(ang))
chkAngular->setChecked(true);
emit AngularConversionSignal(chkAngular->isChecked());
}
//discard bad channels from server
#ifdef VERBOSE
cout << "Getting bad channel correction" << endl;
#endif
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
} }
@ -396,22 +440,56 @@ void qTabDataOutput::DiscardBadChannels(){
void qTabDataOutput::Refresh(){ void qTabDataOutput::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating DataOutput Tab" << endl;
#endif
// output dir // output dir
#ifdef VERBOSE
cout << "Getting output directory" << endl;
#endif
dispOutputDir->setText(QString(myDet->getFilePath().c_str())); dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
//flat field correction from server //flat field correction from server
#ifdef VERBOSE
cout << "Getting flat field" << endl;
#endif
UpdateFlatFieldFromServer(); UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors //rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){
#ifdef VERBOSE
cout << "Getting rate correction" << endl;
#endif
UpdateRateCorrectionFromServer(); UpdateRateCorrectionFromServer();
}
//update angular conversion from server //update angular conversion from server
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){ if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){
#ifdef VERBOSE
cout << "Getting angular conversion" << endl;
#endif
int ang; int ang;
if(myDet->getAngularConversion(ang)) if(myDet->getAngularConversion(ang))
chkAngular->setChecked(true); chkAngular->setChecked(true);
emit AngularConversionSignal(chkAngular->isChecked()); emit AngularConversionSignal(chkAngular->isChecked());
} }
//discard bad channels from server //discard bad channels from server
#ifdef VERBOSE
cout << "Getting bad channel correction" << endl;
#endif
if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true); if(myDet->getBadChannelCorrection()) chkDiscardBad->setChecked(true);
#ifdef VERBOSE
cout << "**Updated DataOutput Tab" << endl << endl;
#endif
} }

View File

@ -112,6 +112,9 @@ void qTabDebugging::Initialization(){
void qTabDebugging::UpdateModuleList(){ void qTabDebugging::UpdateModuleList(){
#ifdef VERBOSE
cout << "Getting Module List" << endl;
#endif
det = myDet->getSlsDetector(comboDetector->currentIndex()); det = myDet->getSlsDetector(comboDetector->currentIndex());
//deletes all modules except "all modules" //deletes all modules except "all modules"
for(int i=0;i<comboModule->count()-1;i++) for(int i=0;i<comboModule->count()-1;i++)
@ -127,6 +130,9 @@ void qTabDebugging::UpdateModuleList(){
void qTabDebugging::UpdateStatus(){ void qTabDebugging::UpdateStatus(){
#ifdef VERBOSE
cout << "Getting Status" << endl;
#endif
det = myDet->getSlsDetector(comboDetector->currentIndex()); det = myDet->getSlsDetector(comboDetector->currentIndex());
int detStatus = (int)det->getRunStatus(); int detStatus = (int)det->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
@ -140,6 +146,9 @@ void qTabDebugging::UpdateStatus(){
void qTabDebugging::GetInfo(){ void qTabDebugging::GetInfo(){
#ifdef VERBOSE
cout << "Getting Info" << endl;
#endif
//window //window
QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow ); QFrame* popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow );
QList<QTreeWidgetItem *> items; QList<QTreeWidgetItem *> items;
@ -477,8 +486,13 @@ void qTabDebugging::TestDetector(){
void qTabDebugging::Refresh(){ void qTabDebugging::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating Debugging Tab" << endl;
#endif
UpdateStatus(); UpdateStatus();
#ifdef VERBOSE
cout << "**Updated Debugging Tab" << endl << endl;
#endif
} }

View File

@ -313,7 +313,11 @@ void qTabDeveloper::RefreshAdcs(){
void qTabDeveloper::Refresh(){ void qTabDeveloper::Refresh(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Updating Dacs and Adcs" <<endl; cout << endl << "**Updating Developer Tab" << endl;
#endif
#ifdef VERBOSE
cout << "Gettings DACs" << endl;
#endif #endif
//dacs //dacs
for(int i=0;i<NUM_DAC_WIDGETS;i++) for(int i=0;i<NUM_DAC_WIDGETS;i++)
@ -331,7 +335,7 @@ void qTabDeveloper::Refresh(){
lblHV->setToolTip(tipHV); lblHV->setToolTip(tipHV);
comboHV->setToolTip(tipHV); comboHV->setToolTip(tipHV);
//getting hv value //getting hv value
int ret = myDet->setDAC(-1,slsDetectorDefs::HV_POT); int ret = (int)myDet->setDAC(-1,slsDetectorDefs::HV_POT);
switch(ret){ switch(ret){
case 0: comboHV->setCurrentIndex(0);break; case 0: comboHV->setCurrentIndex(0);break;
case 90: comboHV->setCurrentIndex(1);break; case 90: comboHV->setCurrentIndex(1);break;
@ -353,6 +357,9 @@ void qTabDeveloper::Refresh(){
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
} }
#ifdef VERBOSE
cout << "**Updated Developer Tab" << endl << endl;
#endif
} }

View File

@ -726,16 +726,35 @@ void qTabMeasurement::EnableFileWrite(bool enable){
void qTabMeasurement::Refresh(){ void qTabMeasurement::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating Measurement Tab" << endl;
#endif
if(!myPlot->isRunning()){ if(!myPlot->isRunning()){
//Number of measurements //Number of measurements
#ifdef VERBOSE
cout << "Getting number of measurements" << endl;
#endif
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
//File Name //File Name
#ifdef VERBOSE
cout << "Getting file name" << endl;
#endif
dispFileName->setText(QString(myDet->getFileName().c_str())); dispFileName->setText(QString(myDet->getFileName().c_str()));
//File Index //File Index
#ifdef VERBOSE
cout << "Getting file index" << endl;
#endif
spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<<myDet->getFileIndex()<<endl; spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<<myDet->getFileIndex()<<endl;
//progress label index //progress label index
lblProgressIndex->setText(QString::number(myDet->getFileIndex())); lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
//Timing mode*
//Timing mode
SetupTimingMode(); SetupTimingMode();
// to let qdrawplot know that triggers or frames are used // to let qdrawplot know that triggers or frames are used
@ -743,6 +762,9 @@ void qTabMeasurement::Refresh(){
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
} }
#ifdef VERBOSE
cout << "**Updated Measurement Tab" << endl << endl;
#endif
} }

View File

@ -506,9 +506,9 @@ void qTabPlot::EnableScanBox(){
//if it was checked before or disabled before, it remembers to check it again //if it was checked before or disabled before, it remembers to check it again
bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled())); bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled()));
int ang;
//none of these scan plotting options make sense if positions>0 //none of these scan plotting options make sense if positions>0
bool positionsExist = myDet->getPositions(); bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions();
//only now enable/disable //only now enable/disable
boxScan->setEnabled((mode0||mode1)&&(!positionsExist)); boxScan->setEnabled((mode0||mode1)&&(!positionsExist));
@ -603,6 +603,7 @@ void qTabPlot::SetScanArgument(){
} }
Select1DPlot(isOrginallyOneD); Select1DPlot(isOrginallyOneD);
int ang;
//if scans(1D or 2D) //if scans(1D or 2D)
if(boxScan->isEnabled()){ if(boxScan->isEnabled()){
//setting the title according to the scans //setting the title according to the scans
@ -613,7 +614,8 @@ void qTabPlot::SetScanArgument(){
Select1DPlot(isOrginallyOneD); Select1DPlot(isOrginallyOneD);
}//angles (1D) }//angles (1D)
else if(myDet->getPositions()){ else if(myDet->getAngularConversion(ang)){
//else if(myDet->getPositions()){
//if scan, change title //if scan, change title
if((myDet->getScanMode(0))||(myDet->getScanMode(1))){ if((myDet->getScanMode(0))||(myDet->getScanMode(1))){
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] + QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
@ -674,6 +676,9 @@ void qTabPlot::SetScanArgument(){
void qTabPlot::Refresh(){ void qTabPlot::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating Plot Tab" << endl;
#endif
if(!myPlot->isRunning()){ if(!myPlot->isRunning()){
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
SetFrequency(); SetFrequency();
@ -682,6 +687,9 @@ void qTabPlot::Refresh(){
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
boxScan->setEnabled(false); boxScan->setEnabled(false);
} }
#ifdef VERBOSE
cout << "**Updated Plot Tab" << endl << endl;
#endif
} }

View File

@ -56,6 +56,7 @@ void qTabSettings::SetupWidgetWindow(){
// Dynamic Range // Dynamic Range
switch(myDet->setDynamicRange(-1)){ switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break; case 32: comboDynamicRange->setCurrentIndex(0); break;
case 24: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break; case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break; case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break; case 4: comboDynamicRange->setCurrentIndex(3); break;
@ -214,10 +215,11 @@ void qTabSettings::SetDynamicRange(int index){
case 3: dr=4; break; case 3: dr=4; break;
default: dr=32; break; default: dr=32; break;
} }
ret=myDet->setDynamicRange(dr);
if((ret==24)&&(dr==32)) dr = ret;
#ifdef VERBOSE #ifdef VERBOSE
cout << "Setting dynamic range to "<< dr << endl; cout << "Setting dynamic range to "<< dr << endl;
#endif #endif
ret=myDet->setDynamicRange(dr);
if(ret!=dr){ if(ret!=dr){
qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings");
#ifdef VERBOSE #ifdef VERBOSE
@ -225,6 +227,7 @@ void qTabSettings::SetDynamicRange(int index){
#endif #endif
switch(ret){ switch(ret){
case 32: comboDynamicRange->setCurrentIndex(0); break; case 32: comboDynamicRange->setCurrentIndex(0); break;
case 24: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break; case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break; case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break; case 4: comboDynamicRange->setCurrentIndex(3); break;
@ -246,11 +249,10 @@ void qTabSettings::SetEnergy(){
int ret = (int)myDet->getThresholdEnergy(); int ret = (int)myDet->getThresholdEnergy();
if((ret-index)>200){ if((ret-index)>200){
qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings"); qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings");
}
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
spinThreshold->setValue(ret); spinThreshold->setValue(ret);
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
}
} }
@ -258,19 +260,34 @@ void qTabSettings::SetEnergy(){
void qTabSettings::Refresh(){ void qTabSettings::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating Settings Tab" << endl;
#endif
// Settings // Settings
#ifdef VERBOSE
cout << "Getting settings" << endl;
#endif
SetupDetectorSettings(); SetupDetectorSettings();
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
comboSettings->setCurrentIndex(myDet->getSettings()); comboSettings->setCurrentIndex(myDet->getSettings());
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
// Number of Modules // Number of Modules
#ifdef VERBOSE
cout << "Getting number of modules" << endl;
#endif
spinNumModules->setValue(myDet->setNumberOfModules()); spinNumModules->setValue(myDet->setNumberOfModules());
// Dynamic Range // Dynamic Range
#ifdef VERBOSE
cout << "Getting dynamic range" << endl;
#endif
switch(myDet->setDynamicRange(-1)){ switch(myDet->setDynamicRange(-1)){
case 32: comboDynamicRange->setCurrentIndex(0); break; case 32: comboDynamicRange->setCurrentIndex(0); break;
case 24: comboDynamicRange->setCurrentIndex(0); break;
case 16: comboDynamicRange->setCurrentIndex(1); break; case 16: comboDynamicRange->setCurrentIndex(1); break;
case 8: comboDynamicRange->setCurrentIndex(2); break; case 8: comboDynamicRange->setCurrentIndex(2); break;
case 4: comboDynamicRange->setCurrentIndex(3); break; case 4: comboDynamicRange->setCurrentIndex(3); break;
@ -287,11 +304,16 @@ void qTabSettings::Refresh(){
}else{ }else{
lblThreshold->setEnabled(true); lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true); spinThreshold->setEnabled(true);
#ifdef VERBOSE
cout << "Getting threshold energy" << endl;
#endif
SetEnergy(); SetEnergy();
} }
} }
#ifdef VERBOSE
cout << "**Updated Settings Tab" << endl << endl;
#endif
} }