From a4a0237711585e72309630fc5f252cb0d8974aa1 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Fri, 7 Sep 2012 08:17:16 +0000 Subject: [PATCH] trim tab works except for graph git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@51 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_advanced.ui | 110 +++++--- slsDetectorGui/forms/form_tab_debugging.ui | 164 ++++++++---- slsDetectorGui/include/qCloneWidget.h | 15 +- slsDetectorGui/include/qDefs.h | 69 +++-- slsDetectorGui/include/qDrawPlot.h | 7 +- slsDetectorGui/include/qTabAdvanced.h | 55 +++- slsDetectorGui/src/qActionsWidget.cpp | 10 +- slsDetectorGui/src/qCloneWidget.cpp | 36 ++- slsDetectorGui/src/qDetectorMain.cpp | 40 +-- slsDetectorGui/src/qDrawPlot.cpp | 178 +++++++------ slsDetectorGui/src/qScanWidget.cpp | 28 +- slsDetectorGui/src/qTabActions.cpp | 2 +- slsDetectorGui/src/qTabAdvanced.cpp | 288 ++++++++++++++++++++- slsDetectorGui/src/qTabDataOutput.cpp | 4 +- slsDetectorGui/src/qTabDebugging.cpp | 6 + slsDetectorGui/src/qTabDeveloper.cpp | 10 +- slsDetectorGui/src/qTabMeasurement.cpp | 20 +- slsDetectorGui/src/qTabMessages.cpp | 4 +- slsDetectorGui/src/qTabPlot.cpp | 20 +- slsDetectorGui/src/qTabSettings.cpp | 13 +- 20 files changed, 776 insertions(+), 303 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 306024a56..f629631ec 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -31,7 +31,7 @@ Form - + true @@ -55,6 +55,9 @@ true + + true + @@ -98,7 +101,7 @@ - + 0 @@ -140,6 +143,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + 5 @@ -248,29 +254,51 @@ - - - - 0 - 0 - - - - Output Directory: - - - - - - - - + 0 0 + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + Output Trim File: + + + + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + + + + + + + + 0 + 0 + + + + <nobr> +Trimfile to which the resulting trimbits will be written. +</nobr><br><nobr> +An extension given by the modules serial number will be attached. +</nobr> + Browse @@ -284,7 +312,7 @@ - + 0 @@ -297,12 +325,12 @@ - + true - + 0 0 @@ -326,14 +354,17 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + - 5 + 3 0.000000000000000 - 2000000000.000000000000000 + 10000.000000000000000 560.000000000000000 @@ -352,7 +383,7 @@ Sets the Threshold DAC - Threshold: + Threshold (DACu): @@ -379,7 +410,7 @@ - + 0 @@ -392,7 +423,7 @@ - + 0 @@ -412,6 +443,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + @@ -419,7 +453,7 @@ 1 - 2000000000 + 9 4 @@ -453,7 +487,7 @@ - + 0 @@ -466,7 +500,7 @@ - + 0 @@ -486,14 +520,17 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + false + - 1 + 0 - 2000000000 + 16000000 500 @@ -529,7 +566,7 @@ 34 - + 0 @@ -539,10 +576,13 @@ No Plot + + true + - + 0 @@ -555,7 +595,7 @@ - + 0 diff --git a/slsDetectorGui/forms/form_tab_debugging.ui b/slsDetectorGui/forms/form_tab_debugging.ui index 4e02206dc..bd8703d92 100644 --- a/slsDetectorGui/forms/form_tab_debugging.ui +++ b/slsDetectorGui/forms/form_tab_debugging.ui @@ -31,46 +31,6 @@ Form - - - - 30 - 50 - 321 - 36 - - - - - - - Module Number: - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - All Modules - - - - - - @@ -112,30 +72,23 @@ - 15 + 75 115 - 291 + 150 25 + + + 0 + 0 + + Run - - - - 425 - 55 - 316 - 25 - - - - Get Detector Information - - @@ -177,17 +130,114 @@ - 15 + 85 115 - 291 + 150 25 + + + 0 + 0 + + Run + + + + 45 + 30 + 291 + 36 + + + + + + + Detector Status: + + + + + + + Offline + + + + + + + + + 440 + 29 + 291 + 76 + + + + + + + Module Number: + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + All Modules + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 150 + 16777215 + + + + Get Information + + + + + diff --git a/slsDetectorGui/include/qCloneWidget.h b/slsDetectorGui/include/qCloneWidget.h index 57bc42084..507f06887 100644 --- a/slsDetectorGui/include/qCloneWidget.h +++ b/slsDetectorGui/include/qCloneWidget.h @@ -10,8 +10,8 @@ /** Qt Project Class Headers */ class SlsQtH1D; -class SlsQt1DPlot; -class SlsQt2DPlotLayout; +#include "SlsQt1DPlot.h" +#include "SlsQt2DPlotLayout.h" /** Qt Include Headers */ #include #include @@ -29,6 +29,7 @@ class SlsQt2DPlotLayout; #include /** C++ Include Headers */ #include +#include using namespace std; /** @@ -78,6 +79,16 @@ public: * */ void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers); + /**Set the range of the 1d plot + * @param IsXYRange array of x,y,min,max if these values are set + * @param XYRangeValues array of set values of x,y, min, max + */ + void SetRange(bool IsXYRange[], double XYRangeValues[]); + + /** Returns the 1d plot + */ + SlsQt1DPlot* Get1dPlot(){return cloneplot1D;}; + public slots: /** Save Plots automatically by save all clones * returns -1 if fail*/ diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 8390a562e..e66dc5757 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -26,6 +26,16 @@ public: OK, FAIL }; + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + enum MessageIndex{ + WARNING, + CRITICAL, + INFORMATION, + QUESTION + }; + //------------------------------------------------------------------------------------------------------------------------------------------------- /** unit of time */ @@ -112,46 +122,35 @@ public: //------------------------------------------------------------------------------------------------------------------------------------------------- - /**displays an warning message - * @param warningMessage the message to be displayed - * @param source is the tab or the source of the warning + /**displays an warning,error,info message + * @param message the message to be displayed + * @param source is the tab or the source of the message * */ - static void WarningMessage(string warningMessage,string source) - { - static QMessageBox* warningBox; - source.append(": WARNING"); - warningBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(warningMessage.c_str()),QMessageBox::Ok, warningBox); - warningBox->exec(); - } - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - /**displays an error message - * @param errorMessage the message to be displayed - * @param source is the tab or the source of the error - * */ - static void ErrorMessage(string errorMessage,string source) - { - static QMessageBox* errorBox; - source.append(": ERROR"); - errorBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(errorMessage.c_str()),QMessageBox::Ok, errorBox); - errorBox->exec(); - } - -//------------------------------------------------------------------------------------------------------------------------------------------------- - - /**displays an information message - * @param infoMessage the message to be displayed - * @param source is the tab or the source of the information - * */ - static void InfoMessage(string infoMessage,string source) + static int Message(MessageIndex index, string message,string source) { static QMessageBox* msgBox; - source.append(": INFORMATION"); - msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); - msgBox->exec(); + switch(index){ + case WARNING: + source.append(": WARNING"); + msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + case CRITICAL: + source.append(": CRITICAL"); + msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + case INFORMATION: + source.append(": INFORMATION"); + msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox); + break; + default: + source.append(": QUESTION"); + msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox); + break; + } + if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL; } + //------------------------------------------------------------------------------------------------------------------------------------------------- /** range of x and y axes diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index b603c8c46..f16c63eeb 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -15,8 +15,6 @@ class multiSlsDetector; #include "SlsQt1DPlot.h" #include "SlsQt2DPlotLayout.h" #include "qDefs.h" -class SlsQt1DPlot; -class SlsQt2DPlotLayout; class qCloneWidget; /** Qt Include Headers */ #include @@ -218,8 +216,8 @@ void UpdatePause(){data_pause_over=true;}; /** Shows the first save error message while automatic saving * @param fileName file name of the first file that it tried to save.*/ void ShowSaveErrorMessage(QString fileName); - - +/**Shows an error message when acquisition stopped unexpectedly*/ +void ShowAcquisitionErrorMessage(); private: @@ -405,6 +403,7 @@ void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); +void AcquisitionErrorSignal(); }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index 38f0185ca..6621efa37 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -12,6 +12,7 @@ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; +#include "sls_detector_defs.h" /** Qt Include Header */ #include @@ -37,6 +38,7 @@ public: void Refresh(); + private: /** Sets up the widget */ @@ -47,14 +49,59 @@ private: void Initialization(); + +private slots: + /** Enable/Disable Energy and Calibration Logs + */ + void SetLogs(); + + /** Set acquisition time + */ + void SetExposureTime(); + + /** Set the Threshold dac value + */ + void SetThreshold(); + + /** Set output directory for trimming + */ + void SetOutputFile(); + + /** Browse output directory for trimming + */ + void BrowseOutputFile(); + + /** Enables trimming method and calls SetTrimmingMethod if enabled + * @param enable to enable trimming + */ + void EnableTrimming(bool enable); + + /** Enabling resolution and Counts if this is enabled + * @param enable to enable + */ + void SetOptimize(bool enable); + + /** Sets the trimming method + * @param mode trimming method + */ + void SetTrimmingMethod(int mode); + + /** Ensures the right trimming mode and Executes Trimming + */ + void StartTrimming(); + +private: /** The sls detector object */ multiSlsDetector *myDet; + /** Tool Tip for the output dir */ + QString outputDirTip; + QString errOutputTip; + QPalette red; + + /** Trimming mode */ + slsDetectorDefs::trimMode trimmingMode; -private slots: -/** Enable/Disable Energy and Calibration Logs - */ -void SetLogs(); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index b15cd2351..7464227da 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -84,13 +84,13 @@ void qActionsWidget::SetMode(int mode){ if(!fName.isEmpty()){ //check if mode didnt get set if(mode!=myDet->getActionMode(id)){ - qDefs::WarningMessage("The mode could not be changed.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed.","ActionsWidget"); comboScript->setCurrentIndex(myDet->getActionMode(id)); }//if mode got set and its custom script else if(mode){ //when the file name did not get set correctly if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ - qDefs::WarningMessage("The file path could not be set.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The file path could not be set.","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); SetScriptFile(); } @@ -141,12 +141,12 @@ void qActionsWidget::SetScriptFile(){ if(QFile::exists(fName)) set = true; //if the file doesnt exist, set it to what it was before else{ - qDefs::WarningMessage("The script file entered does not exist","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } }//not a file, set it to what it was before else { - qDefs::WarningMessage("The script file path entered is not a file","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } @@ -158,7 +158,7 @@ void qActionsWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ActionsWidget"); dispScript->setText(QString(myDet->getActionScript(id).c_str())); } } diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 77e5e02c4..980e37a9f 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -8,16 +8,13 @@ /** Qt Project Class Headers */ #include "qCloneWidget.h" #include "qDefs.h" -#include "SlsQt1DPlot.h" -#include "SlsQt2DPlotLayout.h" /** Qt Include Headers */ #include #include #include #include "qwt_symbol.h" /** C++ Include Headers */ -#include -using namespace std; + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -99,7 +96,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot //------------------------------------------------------------------------------------------------------------------------------------------------- void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ - /** for each plot*/cout<<"qclone nhists:"<Attach(cloneplot1D); } //cloneplot1D->UnZoom(); -}//------------------------------------------------------------------------------------------------------------------------------------------------- +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){ + double XYCloneRangeValues[4]; + if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum(); + else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM]; + if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum(); + else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM]; + if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum(); + else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM]; + if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum(); + else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM]; + cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]); + cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + char* qCloneWidget::GetCurrentTimeStamp(){ char output[30]; @@ -198,9 +216,9 @@ void qCloneWidget::SavePlot(){ fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); if (!fName.isEmpty()) if((img.save(fName))) - qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot"); + qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","Snapshot"); else - qDefs::WarningMessage("Attempt to save snapshot failed.\n" + qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n" "Formats: .png, .jpg, .xpm.","Snapshot"); } diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 551085e1e..803d08b8e 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -184,11 +184,11 @@ void qDetectorMain::SetUpDetector(){ #endif char cIndex[10]; sprintf(cIndex,"%d",detID); - qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main"); + qDefs::Message(qDefs::CRITICAL,string("No Detector Connected at id : ")+string(cIndex),"Main"); exit(-1); }//if the detector is not even connected else if(s->setTCPSocket()==slsDetectorDefs::FAIL){ - qDefs::ErrorMessage(string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main"); + qDefs::Message(qDefs::CRITICAL,string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main"); cout << "The detector " << host << "is not connected. Exiting GUI." << endl; exit(-1); } @@ -204,7 +204,7 @@ void qDetectorMain::SetUpDetector(){ string detName = myDet->slsDetectorBase::getDetectorType(detType); string errorMess = host+string(" has unknown detector type \"")+ detName+string("\". Exiting GUI."); - qDefs::ErrorMessage(errorMess,"Main"); + qDefs::Message(qDefs::CRITICAL,errorMess,"Main"); exit(-1); } setWindowTitle("SLS Detector GUI : "+ @@ -326,8 +326,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Setup Parameters have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveSetup){ @@ -341,8 +341,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Setup Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionMeasurementWizard){ @@ -361,8 +361,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Configuration Parameters have been configured successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveConfiguration){ @@ -376,8 +376,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Configuration Parameters have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadTrimbits){ @@ -391,8 +391,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Trimbits have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionSaveTrimbits){ @@ -406,8 +406,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Trimbits have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); } } else if(action==actionLoadCalibration){ @@ -421,8 +421,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); - else qDefs::WarningMessage(string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); } } else if(action==actionSaveCalibration){ @@ -436,8 +436,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ // Gets called when cancelled as well if (!fName.isEmpty()){ if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) - qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); - else qDefs::WarningMessage(string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); + qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","Main"); + else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); } } @@ -455,7 +455,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){ cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; #endif //

A heading

- qDefs::InfoMessage("

SLS Detector GUI version: 1.0

" + qDefs::Message(qDefs::INFORMATION,"

SLS Detector GUI version: 1.0

" "Common GUI to control the SLS Detectors: " "Mythen, Eiger, Gotthard and Agipd.

" "It can be operated in parallel with the command line interface:
" diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index af133260b..52e271f96 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -120,9 +120,10 @@ void qDrawPlot::SetupWidgetWindow(){ histXAxisTitle="Channel Number"; histYAxisTitle="Counts"; - char temp_title[2000]; + for(int i=0;igetRunStatus()==slsDetectorDefs::IDLE) cout<getRunStatus()<getRunStatus(); + string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); + qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); +} //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -684,87 +691,88 @@ void qDrawPlot::UpdatePlot(){ #ifdef VERYVERBOSE cout << "Entering UpdatePlot function" << endl; #endif - plot_update_timer->stop(); // only if no plot isnt enabled if(plotEnable){ LockLastImageArray(); //1-d plot stuff - if(lastImageNumber){ - if(histNBins){ - Clear1DPlot(); - plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); - plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); - for(int hist_num=0;hist_num<(int)nHists;hist_num++){ - SlsQtH1D* h; - if(hist_num+1>plot1D_hists.size()){ - if(anglePlot) - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); - else - plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); - h->SetLineColor(hist_num+1); - }else{ - h=plot1D_hists.at(hist_num); - if(anglePlot) - h->SetData(histNBins,histXAngleAxis,histYAngleAxis); - else - h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + if(plot_in_scope==1){ + if(lastImageNumber){ + if(histNBins){ + Clear1DPlot(); + plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); + plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); + for(int hist_num=0;hist_num<(int)nHists;hist_num++){ + SlsQtH1D* h; + if(hist_num+1>plot1D_hists.size()){ + if(anglePlot) + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis)); + else + plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num))); + h->SetLineColor(hist_num+1); + }else{ + h=plot1D_hists.at(hist_num); + if(anglePlot) + h->SetData(histNBins,histXAngleAxis,histYAngleAxis); + else + h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); + } + SetStyle(h); + h->setTitle(GetHistTitle(hist_num)); + h->Attach(plot1D); } - //h->setSymbol(*noSymbol); - //h->SetDotStyle(plotDotted); - SetStyle(h); - h->setTitle(GetHistTitle(hist_num)); - h->Attach(plot1D); + // update range if required + if(XYRangeChanged){ + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); + plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + XYRangeChanged = false; + } + if(saveAll) SavePlotAutomatic(); + } + } + }//2-d plot stuff + else{ + if(lastImageArray){ + if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot + nPixelsX>0&&nPixelsY>0){ + //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); + plot2D->setTitle(GetImageTitle()); + plot2D->SetXTitle(imageXAxisTitle); + plot2D->SetYTitle(imageYAxisTitle); + plot2D->SetZTitle(imageZAxisTitle); + plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); } // update range if required if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); + if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); + if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); + if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); + plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); + plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); XYRangeChanged = false; } if(saveAll) SavePlotAutomatic(); } } - //2-d plot stuff - //cout<<"npixelsx:"<0&&nPixelsY>0){ - //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); - plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); - plot2D->setTitle(GetImageTitle()); - plot2D->SetXTitle(imageXAxisTitle); - plot2D->SetYTitle(imageYAxisTitle); - plot2D->SetZTitle(imageZAxisTitle); - plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update(); - } - // update range if required - if(XYRangeChanged){ - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot2D->GetPlot()->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot2D->GetPlot()->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot2D->GetPlot()->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot2D->GetPlot()->GetYMaximum(); - plot2D->GetPlot()->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); - XYRangeChanged = false; - } - if(saveAll) SavePlotAutomatic(); - } } last_plot_number=lastImageNumber; if(plotEnable) UnlockLastImageArray(); - - if(!frameFactor) - plot_update_timer->start((int)timerValue); - else - plot_update_timer->start((int)PLOT_TIMER_MS); + //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer + if(!stop_signal){ + if(!frameFactor) + plot_update_timer->start((int)timerValue); + else + plot_update_timer->start((int)PLOT_TIMER_MS); + } } @@ -804,17 +812,21 @@ void qDrawPlot::ClonePlot(){ plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plotLayout->addWidget(plot1D,1,1,1,1); if(running){ - if(anglePlot) - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle); - else - winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle); // update range - if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); - if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); - if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); - if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); - plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); - plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); + bool found =false; + for(int index=0;index<4;index++) + if(IsXYRange[index]){ + found=true; + break; + } + if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues); + //copy data + LockLastImageArray(); + if(!anglePlot) + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers); + else + winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers); + UnlockLastImageArray(); } } else{ @@ -855,9 +867,9 @@ void qDrawPlot::SaveClones(){ } } if(success) - qDefs::InfoMessage("The Snapshots have all been saved successfully in .png.","Dock"); + qDefs::Message(qDefs::INFORMATION,"The Snapshots have all been saved successfully in .png.","Dock"); else - qDefs::WarningMessage(errMessage + string("were not saved."),"Dock"); + qDefs::Message(qDefs::WARNING,errMessage + string("were not saved."),"Dock"); } @@ -897,9 +909,9 @@ void qDrawPlot::SavePlot(){ if (!fName.isEmpty()) if(savedImage.save(fName)) - qDefs::InfoMessage("The Image has been successfully saved","Dock"); + qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","Dock"); else - qDefs::WarningMessage("Attempt to save image failed.\n" + qDefs::Message(qDefs::WARNING,"Attempt to save image failed.\n" "Formats: .png, .jpg, .xpm.","Dock"); } @@ -911,7 +923,7 @@ 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::InfoMessage(msg,"Dock"); + qDefs::Message(qDefs::INFORMATION,msg,"Dock"); saveAll = enable; } @@ -952,7 +964,7 @@ void qDrawPlot::SavePlotAutomatic(){ void qDrawPlot::ShowSaveErrorMessage(QString fileName){ - qDefs::WarningMessage(string("Automatic Saving: Could not save the first file:\n")+ + qDefs::Message(qDefs::WARNING,string("Automatic Saving: Could not save the first file:\n")+ string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock"); } diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index c30b33c8b..830f8ef21 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -277,7 +277,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERYVERBOSE char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cId[5];sprintf(cId,"%d",id); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Specific Values

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); #endif @@ -385,7 +385,7 @@ int qScanWidget::SetScan(int mode){ return qDefs::OK; }else{//mode NOT set if((mode!=actualMode)&&(actualNumSteps)){ - qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The mode could not be changed for an unknown reason.","ScanWidget"); comboScript->setCurrentIndex(actualMode); return qDefs::FAIL; } @@ -455,12 +455,12 @@ void qScanWidget::SetScriptFile(){ set = true; //if the file doesnt exist, set it to what it was before else{ - qDefs::WarningMessage("The script file entered does not exist","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } }//not a file, set it to what it was before else { - qDefs::WarningMessage("The script file path entered is not a file","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } } @@ -471,7 +471,7 @@ void qScanWidget::SetScriptFile(){ if(fName.compare(QString(myDet->getScanScript(id).c_str()))){ //did not get set, write what is was before if(!fName.isEmpty()) - qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ScanWidget"); dispScript->setText(QString(myDet->getScanScript(id).c_str())); } @@ -524,7 +524,7 @@ void qScanWidget::SetPrecision(int value){ #endif myDet->setScanPrecision(id,value); if(myDet->getScanPrecision(id)!=value) - qDefs::WarningMessage("The precision was not set for an unknown reason.","ScanWidget");; + qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","ScanWidget");; } @@ -633,13 +633,13 @@ void qScanWidget::SetRangeSteps(){ //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" "The positions list was not set for an unknown reason."),"ScanWidget"); /*LoadPositions(); @@ -648,7 +648,7 @@ void qScanWidget::SetRangeSteps(){ #ifdef VERYVERBOSE else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Constant Step Size

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } @@ -712,13 +712,13 @@ int qScanWidget::SetCustomSteps(){ QString script = dispScript->text(); //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); return qDefs::FAIL; }else{ if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); + qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","ScanWidget"); LoadPositions(); comboScript->setCurrentIndex(myDet->getScanMode(id)); return qDefs::FAIL; @@ -870,20 +870,20 @@ void qScanWidget::SetFileSteps(){ radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip); //positions wont be loaded if its custom script if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

" "Positions could not be loaded as the script file path is empty."),"ScanWidget"); }else{ //error loading positions if(myDet->getScanSteps(id)!=actualNumSteps){ - qDefs::WarningMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::WARNING,string("Scan Level ")+string(cId)+ string(": Values From File

" "The positions list was not set for an unknown reason."),"ScanWidget"); } #ifdef VERYVERBOSE else{//SUCCESS char cNum[200];sprintf(cNum,"%d",actualNumSteps); - qDefs::InfoMessage(string("Scan Level ")+string(cId)+ + qDefs::Message(qDefs::INFORMATION,string("Scan Level ")+string(cId)+ string(": Values From File

Number of positions added: ")+ string(cNum)+string(""),"ScanWidget"); } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index f7aa17d22..daf760546 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -295,7 +295,7 @@ void qTabActions::SetPosition(){ positions[i] = comboPos->itemText(i).toDouble(); //setting the list and catching error if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count()) - qDefs::WarningMessage("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(); diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index ee803ddc9..0b27e904b 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -9,6 +9,8 @@ /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" +/** Qt Include Headers */ +#include /** C++ Include Headers */ #include using namespace std; @@ -37,7 +39,20 @@ qTabAdvanced::~qTabAdvanced(){ void qTabAdvanced::SetupWidgetWindow(){ +//executed even for non digital, so make sure its necessary + slsDetectorDefs::detectorType detType = myDet->getDetectorsType(); + if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){ + outputDirTip = dispFile->toolTip(); + errOutputTip = QString("

" + "Output Trim File should contain both existing directory and a file name.
" + "The extensions are automatically added.

" + "Enter valid Output Trim File to enable Start Trimming button.
"); + red = QPalette(); + red.setColor(QPalette::Active,QPalette::WindowText,Qt::red); + boxTrimming->setChecked(false); + SetOptimize(false); + } } @@ -49,6 +64,28 @@ void qTabAdvanced::Initialization(){ connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + //exptime + connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); + connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + + //threshold dac + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + + //output directory + connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile())); + connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile())); + + //enable trimming method group box + connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool))); + + //trimming method combo + connect(comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTrimmingMethod(int))); + + //method options + connect(chkOptimize, SIGNAL(toggled(bool)), this, SLOT(SetOptimize(bool))); + + //start Trimming + connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); } @@ -73,7 +110,7 @@ void qTabAdvanced::SetLogs(){ #ifdef VERBOSE cout << "Could not set/reset Log." << endl; #endif - qDefs::WarningMessage("Could not set/reset Log.","Advanced"); + qDefs::Message(qDefs::WARNING,"Could not set/reset Log.","Advanced"); checkedBox->setChecked(!enable); } @@ -83,7 +120,233 @@ void qTabAdvanced::SetLogs(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetExposureTime(){ + //Get the value of timer in ns + double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value()); +#ifdef VERBOSE + cout << "Setting Exposure Time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl; +#endif + myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS); + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetThreshold(){ +#ifdef VERBOSE + cout << "Setting Threshold DACu:" << spinThreshold->value() << endl; +#endif + spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD)); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetOutputFile(){ +#ifdef VERBOSE + cout << "Setting Output File for Trimming" << endl; +#endif + QString dirPath = dispFile->text().section('/',0,-2,QString::SectionIncludeLeadingSep); + cout<<"directory:"<text().section('/',-1); + cout<<"file name:"<setToolTip(outputDirTip); + lblFile->setToolTip(outputDirTip); + lblFile->setPalette(lblExpTime->palette()); + lblFile->setText("Output Trim File: "); + btnStart->setEnabled(true); + + + //check if you're overwriting original trimsettings + QDir dir; + //gets the clean absolute path + dirPath = dir.absoluteFilePath(dirPath); + dirPath = dir.cleanPath(dirPath); + QString trimdir = QString(myDet->getSettingsFile()).section('/',0,-2,QString::SectionIncludeLeadingSep); + trimdir = dir.absoluteFilePath(trimdir); + trimdir = dir.cleanPath(trimdir); + if(!dirPath.compare(trimdir)){ + int ret = qDefs::Message(qDefs::QUESTION,string("This will possibly overwrite your original trimbits.
" + "Proposed file path:") + string(dirPath.toAscii().constData())+ + string("
Do you still want to continue?"),"Advanced"); + if(ret==qDefs::FAIL){ + dispFile->setText(""); + dispFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setPalette(red); + lblFile->setText("Output Trim File:*"); + btnStart->setEnabled(false); + } + } + + }//if the directory doesnt exist or if file name is empty + else{ + cout<<"Invalid Trimming output File"<setToolTip(outputDirTip + errOutputTip); + lblFile->setToolTip(outputDirTip + errOutputTip); + lblFile->setPalette(red); + lblFile->setText("Output Trim File:*"); + btnStart->setEnabled(false); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::BrowseOutputFile(){ +#ifdef VERBOSE + cout << "Browsing Output Dir for Trimming:" << endl; +#endif + QString fName = dispFile->text(); + //dialog + fName = QFileDialog::getSaveFileName(this, + tr("Choose file to write the trimbits to"),fName, + tr("Trimbit files (*.trim noise.sn*) ")); + //if empty, set the file name and it calls SetFileSteps, else ignore + if (!fName.isEmpty()){ + dispFile->setText(fName); + SetOutputFile(); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::EnableTrimming(bool enable){ +#ifdef VERBOSE + cout << "Enable Trimming set to:" << enable << endl; +#endif + if(enable){ + //show error label if invalid output dir + SetOutputFile(); + SetTrimmingMethod(comboMethod->currentIndex()); + }else{ + //error label shouldnt show when disabled + dispFile->setToolTip(outputDirTip); + lblFile->setToolTip(outputDirTip); + lblFile->setPalette(lblExpTime->palette()); + lblFile->setText("Output Trim File: "); + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- +void qTabAdvanced::SetOptimize(bool enable){ +#ifdef VERBOSE + cout << "Setting Optimize to:" << enable << endl; +#endif + //trimming method is adjust to count + if(!comboMethod->currentIndex()){ + lblCounts->setEnabled(true); + spinCounts->setEnabled(true); + lblResolution->setEnabled(enable); + spinResolution->setEnabled(enable); + }//trimming method is equalize to median + else{ + lblCounts->setEnabled(false); + spinCounts->setEnabled(false); + lblResolution->setEnabled(true); + spinResolution->setEnabled(true); + } +} + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetTrimmingMethod(int mode){ +#ifdef VERBOSE + cout << "Setting Trimming method to :" << mode << endl; +#endif + //make sure the right resolution/Counts is enabled + SetOptimize(chkOptimize->isChecked()); + + //set mode + switch(mode){ + case 0: trimmingMode = slsDetectorDefs::NOISE_TRIMMING; break; + case 1: trimmingMode = slsDetectorDefs::IMPROVE_TRIMMING; break; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::StartTrimming(){ + + int parameter1, parameter2; + //optimize + bool optimize = chkOptimize->isChecked(); + + //set the mode again and also set resolution, counts + switch(trimmingMode){ + + case slsDetectorDefs::NOISE_TRIMMING: + //define parameters + parameter1 = spinCounts->value(); + parameter2 = spinResolution->value(); + if(!optimize){ + parameter2 = -1; + trimmingMode = slsDetectorDefs::FIXEDSETTINGS_TRIMMING; +#ifdef VERBOSE + cout << "Trimming Mode: FIXEDSETTINGS_TRIMMING" << endl; +#endif + }else{ +#ifdef VERBOSE + cout << "Trimming Mode: NOISE_TRIMMING" << endl; +#endif + } + break; + + case slsDetectorDefs::IMPROVE_TRIMMING: +#ifdef VERBOSE + cout << "Trimming Mode: IMPROVE_TRIMMING" << endl; +#endif + //define parameters + parameter1 = spinResolution->value(); + parameter2 = 1; + if(!optimize) parameter2 = 0; + break; + default: + cout << "Should never come here. Start Trimming will have only 2 methods." << endl; + break; + } + +#ifdef VERBOSE + +#endif + //execute + int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){ + //save trim file + ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1); + if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)) + qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced"); + else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced"); + } + else + qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qTabAdvanced::Refresh(){ + //disconnect + 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(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); + //energy/angular logs chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); @@ -92,6 +355,29 @@ void qTabAdvanced::Refresh(){ cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; #endif + //exptime + qDefs::timeUnit unit; + double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9)))); +#ifdef VERBOSE + cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl; +#endif + spinExpTime->setValue(time); + comboExpUnit->setCurrentIndex((int)unit); + + + //threshold + double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD); +#ifdef VERBOSE + cout << "Getting Threshold DACu : " << threshold << endl; +#endif + spinThreshold->setValue(threshold); + + //connect + 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(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime())); + connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold())); } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index b162997da..fbe623c51 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -149,7 +149,7 @@ void qTabDataOutput::SetFlatField(){ if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){ string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData(); if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/} - qDefs::WarningMessage("Invalid Flat Field file: "+sDir+"/"+sFile+ + qDefs::Message(qDefs::WARNING,"Invalid Flat Field file: "+sDir+"/"+sFile+ ".\nUnsetting Flat Field.","Data Output"); //Unsetting flat field @@ -348,7 +348,7 @@ void qTabDataOutput::SetAngularCorrection(){ cout << "Setting angular conversion to default" << endl; #endif }else{ - qDefs::WarningMessage("Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); + qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); chkAngular->setChecked(false); } }else{ diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 3dc131bb6..e599fb4c5 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -40,12 +40,18 @@ void qTabDebugging::SetupWidgetWindow(){ // 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(); + /* for(int i=0;igetSlsDetector(i); if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 7324d94de..fdc2e43d5 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -85,7 +85,7 @@ void qTabDeveloper::SetupWidgetWindow(){ break; default: - qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); exit(-1); break; } @@ -228,7 +228,7 @@ void qTabDeveloper::SetHighVoltage(){ int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); //error if(ret != highvoltage){ - qDefs::ErrorMessage("High Voltage could not be set to this value.","Developer"); + qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","Developer"); lblHV->setPalette(red); lblHV->setText("High Voltage:*"); QString errTip = tipHV+QString("

High Voltage could not be set. The return value is ")+ @@ -258,7 +258,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 4: return slsDetectorDefs::CALIBRATION_PULSE; case 5: return slsDetectorDefs::PREAMP; default: - qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); Refresh(); break; } @@ -280,13 +280,13 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){ case 8: return slsDetectorDefs::TEMPERATURE_ADC; case 9:return slsDetectorDefs::TEMPERATURE_FPGA; default: - qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); + qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer"); Refresh(); break; } break; default: - qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); + qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); exit(-1); break; } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 1b7695fe0..ec5dce44a 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -127,7 +127,7 @@ void qTabMeasurement::SetupTimingMode(){ item[(int)Trigger_Window]->setEnabled(false); break; default: - qDefs::ErrorMessage("Unknown detector type.","Measurement"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Measurement"); exit(-1); break; } @@ -157,7 +157,7 @@ void qTabMeasurement::SetupTimingMode(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors else{ - qDefs::WarningMessage("Unknown Timing Mode detected from detector." + qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); comboTimingMode->setCurrentIndex((int)None); @@ -191,20 +191,20 @@ void qTabMeasurement::Initialization(int timingChange){ //Number of Frames connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); //Exposure Time - connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot + connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime())); connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); //Frame Period between exposures - connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot + connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod())); connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); //Number of Triggers - connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));// + connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int))); //Delay After Trigger - connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));// + connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay())); connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); //Number of Gates - connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));// + connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int))); //Number of Probes - connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));// + connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int))); } @@ -548,11 +548,11 @@ void qTabMeasurement::SetTimingMode(int mode){ break; default: //This should never happen - qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement"); + qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","Measurement"); exit(-1); } if(!success){ - qDefs::WarningMessage("The detector timing mode could not be set.\n" + qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n" "Please check the external flags." "\n\nSetting the following defaults:\nTiming Mode \t: None\n" "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index 94a7c5889..3b50e616c 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -91,10 +91,10 @@ void qTabMessages::SaveLog() { if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append QTextStream out(&outfile); out<toPlainText() << endl; - qDefs::InfoMessage(string("The Log has been successfully saved to " + qDefs::Message(qDefs::INFORMATION,string("The Log has been successfully saved to " "")+fName.toAscii().constData(),"Messages"); } - else qDefs::WarningMessage("Attempt to save log file failed.","Messages"); + else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages"); } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 939484f45..cb8bc9ea7 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -226,12 +226,12 @@ void qTabPlot::Initialization(){ connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); - connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); - connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); - connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); + connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange())); + connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange())); + connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange())); // Save connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool))); @@ -344,6 +344,10 @@ void qTabPlot::EnableRange(){ void qTabPlot::SetAxesRange(){ +#ifdef VERBOSE + cout << "Setting Range" << endl; +#endif + bool changed = false; // x min changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()); @@ -448,7 +452,7 @@ void qTabPlot::SetFrequency(){ // Get the time interval from gui in ms timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); if(timeMSsetValue(minPlotTimer); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); @@ -468,7 +472,7 @@ void qTabPlot::SetFrequency(){ // To make sure the period between plotting is not less than minimum plot timer in ms if(timeMSPlot Tab: Interval between Plots - The nth Image must be larger.

" + qDefs::Message(qDefs::WARNING,"Plot Tab: Interval between Plots - The nth Image must be larger.

" "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." "

Nth image adjusted to minimum, " "for the chosen Acquisition Period.","Plot"); diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index f76a5bad9..99475afa6 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -12,6 +12,7 @@ #include "multiSlsDetector.h" // C++ Include Headers #include +#include using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -115,7 +116,7 @@ void qTabSettings::SetupDetectorSettings(){ item[(int)VeryHighGain]->setEnabled(true); break; default: - qDefs::ErrorMessage("Unknown detector type.","Settings"); + qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Settings"); exit(-1); break; } @@ -123,7 +124,7 @@ void qTabSettings::SetupDetectorSettings(){ // This should not happen -only if the server and gui has a mismatch // on which all modes are allowed in detectors if(!(item[(int)sett]->isEnabled())){ - qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " + qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. " "Exiting GUI.","Settings"); #ifdef VERBOSE cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; @@ -190,7 +191,7 @@ void qTabSettings::SetNumberOfModules(int index){ #endif int i = myDet->setNumberOfModules(index); if(index!=i) - qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings"); #ifdef VERBOSE cout << "ERROR: Setting number of modules to "<< i << endl; #endif @@ -214,7 +215,7 @@ void qTabSettings::SetDynamicRange(int index){ #endif ret=myDet->setDynamicRange(dr); if(ret!=dr){ - qDefs::WarningMessage("Dynamic Range cannot be set to this value.","Settings"); + qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings"); #ifdef VERBOSE cout << "ERROR: Setting dynamic range to "<< ret << endl; #endif @@ -239,8 +240,8 @@ void qTabSettings::SetEnergy(){ int index = spinThreshold->value(); myDet->setThresholdEnergy(index); int ret = (int)myDet->getThresholdEnergy(); - if(ret!=index){ - qDefs::WarningMessage("Threshold energy could not be set.","Settings"); + if((ret-index)>200){ + 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())); spinThreshold->setValue(ret); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));