diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 56142c7ac..306024a56 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -11,7 +11,7 @@ - + 0 0 @@ -31,58 +31,16 @@ Form - - - - 25 - 20 - 726 - 58 - - - - Calibration Logs - - - - - 35 - 20 - 626 - 31 - - - - - 15 - - - - - Energy Calibration - - - - - - - Angular Calibration - - - - - - true - 20 - 150 - 731 - 156 + 25 + 90 + 721 + 226 @@ -94,34 +52,24 @@ false - + + true + + 15 - 20 - 701 - 126 + 25 + 691 + 195 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 45 - 10 - - - - + + + 12 + - + 0 @@ -133,33 +81,8 @@ - - - - - 0 - 0 - - - - - None - - - - - Adjust to Fix Count Level - - - - - Equalize to Median - - - - - - + + Qt::Horizontal @@ -168,14 +91,213 @@ - 75 - 10 + 20 + 20 - - + + + + + 0 + 0 + + + + Exposure Time: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 5 + + + 0.000000000000000 + + + 2000000000.000000000000000 + + + 1.000000000000000 + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Qt::LeftToRight + + + 2 + + + + hr + + + + + min + + + + + s + + + + + ms + + + + + us + + + + + ns + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 50 + 20 + + + + + + + + + 0 + 0 + + + + Output Directory: + + + + + + + + + + + 0 + 0 + + + + Browse + + + + + + + 0 + + + + + + + + 0 + 0 + + + + Start Trimming + + + + + true @@ -185,11 +307,320 @@ 0 + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Exposure time of each frame. + #exptime# + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + 5 + + + 0.000000000000000 + + + 2000000000.000000000000000 + + + 560.000000000000000 + + + + + + + + 0 + 0 + + + + Sets the Threshold DAC + + + Threshold: + + + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + Optimize Settings + + + + + 0 + 0 + + + + Resolution (a.u.): + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 1 + + + 2000000000 + + + 4 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + Adjust to Fix Count Level + + + + + Equalize to Median + + + + + + + + + 0 + 0 + + + + Counts/ Channel: + + + + + + + + 0 + 0 + + + + Number of measurements (not in real time) that will be acquired. + #frames# + + + + + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 1 + + + 2000000000 + + + 500 + + + + + + + + + + 25 + 10 + 341 + 61 + + + + Trimbits Plot Mode + + + + + 15 + 20 + 311 + 31 + + + + + 34 + + + + + + 0 + 0 + + + + No Plot + + + + + + + + 0 + 0 + + + + Data Graph + + + + + + + + 0 + 0 + + + + Histogram + + + + + + + + + + 405 + 10 + 341 + 61 + + + + Calibration Logs + + + + + 15 + 20 + 311 + 31 + + + + + 42 + + + + + + 0 + 0 + + + + Energy Calibration + + + + + + + + 0 + 0 + + + + Angular Calibration + + + diff --git a/slsDetectorGui/forms/form_tab_settings.ui b/slsDetectorGui/forms/form_tab_settings.ui index 415b80f3a..c95ddb9b2 100644 --- a/slsDetectorGui/forms/form_tab_settings.ui +++ b/slsDetectorGui/forms/form_tab_settings.ui @@ -109,8 +109,11 @@ + + false + - eV + eV -100000 diff --git a/slsDetectorGui/include/qScanWidget.h b/slsDetectorGui/include/qScanWidget.h index 658e99370..1aa7d632a 100644 --- a/slsDetectorGui/include/qScanWidget.h +++ b/slsDetectorGui/include/qScanWidget.h @@ -86,7 +86,7 @@ private: /** Sets up the scan parameters * returns if it was set - */ + */ int SetScan(int mode); private slots: diff --git a/slsDetectorGui/include/qTabActions.h b/slsDetectorGui/include/qTabActions.h index aaa16951c..77ad9be44 100644 --- a/slsDetectorGui/include/qTabActions.h +++ b/slsDetectorGui/include/qTabActions.h @@ -56,6 +56,28 @@ void EnablePositions(bool enable); private: + /** Sets up the widget */ + void SetupWidgetWindow(); + + /** Sets up all the slots and signals */ + void Initialization(); + + /** creates the Num Positions object */ + void CreatePositionsWidget(); + + /** Returns the index in each of the classes + * of actionwidget and scanwidget + * @param index the index in the list of all widgets + * returns actual index of the class + */ + int GetActualIndex(int index); + + /** Updates to green color if collapsed and mode not none + */ + void UpdateCollapseColors(); + + + /** The sls detector object */ multiSlsDetector *myDet; @@ -88,23 +110,6 @@ private: double *positions; QPalette normal; - - /** Sets up the widget */ - void SetupWidgetWindow(); - - /** Sets up all the slots and signals */ - void Initialization(); - - /** creates the Num Positions object */ - void CreatePositionsWidget(); - - /** Returns the index in each of the classes - * of actionwidget and scanwidget - * @param index the index in the list of all widgets - * returns actual index of the class - */ - int GetActualIndex(int index); - private slots: /** To Expand the Action Widget * */ diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index e6fff7459..38f0185ca 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -12,6 +12,8 @@ #include "ui_form_tab_advanced.h" /** Project Class Headers */ class multiSlsDetector; +/** Qt Include Header */ +#include /** *@short sets up the advanced parameters @@ -36,9 +38,6 @@ public: private: - /** The sls detector object */ - multiSlsDetector *myDet; - /** Sets up the widget */ void SetupWidgetWindow(); @@ -48,9 +47,14 @@ private: void Initialization(); + /** The sls detector object */ + multiSlsDetector *myDet; + private slots: - +/** Enable/Disable Energy and Calibration Logs + */ +void SetLogs(); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index e92850ad5..b15cd2351 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -80,6 +80,7 @@ void qActionsWidget::SetMode(int mode){ if(mode) myDet->setActionScript(id,fName.toAscii().constData()); else myDet->setActionScript(id,""); //mode is not set when fname is blank + if(!fName.isEmpty()){ //check if mode didnt get set if(mode!=myDet->getActionMode(id)){ @@ -95,6 +96,7 @@ void qActionsWidget::SetMode(int mode){ } } } + } @@ -189,9 +191,10 @@ void qActionsWidget::Refresh(){ string script = myDet->getActionScript(id); string parameter = myDet->getActionParameter(id); + //settings values and checking for none dispScript->setText(QString(script.c_str())); - SetScriptFile(); + if(mode)SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); //set mode which also checks everything diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 223fd8211..dc48642ba 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -398,7 +398,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ else if(action==actionSaveTrimbits){ #ifdef VERBOSE cout << "Saving Trimbits" << endl; -#endif +#endif//different output directory so as not to overwrite QString fName = QString(myDet->getSettingsDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Trimbits"),fName, @@ -428,8 +428,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ else if(action==actionSaveCalibration){ #ifdef VERBOSE cout << "Saving Calibration Data" << endl; -#endif - QString fName = QString(myDet->getCalDir())+QString("/newTrims"); +#endif//different output directory so as not to overwrite + QString fName = QString(myDet->getCalDir()); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, tr("Calibration files (*.cal *.sn*) ")); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index 9e67308c5..72a543aa4 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -214,11 +214,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ number_of_exposures = number_of_frames * numScan0 * numScan1; - if(anglePlot) { - int numPos = myDet->getPositions(); //numPos = ((numPos==0) ?1:numPos); - number_of_exposures = numScan0 * numScan1;/*number_of_exposures * numPos;*/ + if(anglePlot) number_of_exposures = numScan0 * numScan1; + - } cout << "\tNumber of Exposures:" << number_of_exposures << endl; // ExposureTime diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 9bcb344ca..c30b33c8b 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -231,7 +231,7 @@ void qScanWidget::EnableSizeWidgets(){ #ifdef VERBOSE cout << "Constant Range Values" << endl; #endif - spinSteps->setMinimum(2); + radioCustom->setText("Specific Values"); radioCustom->setPalette(normal); radioCustom->setToolTip(customTip); @@ -245,7 +245,11 @@ void qScanWidget::EnableSizeWidgets(){ stackedLayout->setCurrentIndex(RangeValues); - SetRangeSteps(); + int oldNumSteps = spinSteps->value(); + //if the steps change, it calls SetRangeSteps on its own. + RangeCalculateNumSteps(); + if(oldNumSteps==spinSteps->value()) SetRangeSteps(); + spinSteps->setMinimum(2); } //custom values else if(radioCustom->isChecked()){ @@ -887,6 +891,15 @@ void qScanWidget::SetFileSteps(){ } } } + //ERROR IN WRITING FILENAME OR READING FILE + else{ + actualNumSteps=0; + positions.resize(0); + SetScan(comboScript->currentIndex()); + disconnect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + spinSteps->setValue(actualNumSteps); + connect(spinSteps, SIGNAL(valueChanged(int)), this, SLOT(SetNSteps())); + } } @@ -997,7 +1010,7 @@ void qScanWidget::Refresh(){ //settings values and checking for none dispScript->setText(QString(script.c_str())); - SetScriptFile(); + if(mode) SetScriptFile(); dispParameter->setText(QString(parameter.c_str())); SetParameter(); spinPrecision->setValue(precision); diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index 44790291c..a08aaae71 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -211,14 +211,26 @@ void qTabActions::Expand(QAbstractButton *button ){ if(index==NumPositions) { positionWidget->hide(); setFixedHeight(height()-30);//-80 if the checkboxes are included + if(myDet->getPositions()) { + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } else if((index==Scan0)||(index==Scan1)) { scanWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-130); + if(myDet->getScanMode(GetActualIndex(index))){ + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } else { actionWidget[GetActualIndex(index)]->hide(); setFixedHeight(height()-30); + if(myDet->getActionMode(GetActualIndex(index))){ + palette->setColor(QPalette::WindowText,Qt::darkGreen); + lblName[index]->setPalette(*palette); + } } }else{ // Expand @@ -349,7 +361,7 @@ void qTabActions::Refresh(){ //delete existing positions if (positions) delete [] positions; //get number of positions - int numPos=myDet->getPositions();cout<<"numPOs:"<getPositions(); comboPos->setMaxCount(numPos); //set the number of positions in the gui @@ -383,6 +395,8 @@ void qTabActions::Refresh(){ scanWidget[i]->Refresh(); for(int i=0;iRefresh(); + + UpdateCollapseColors(); } @@ -405,3 +419,35 @@ int qTabActions::GetActualIndex(int index){ //------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabActions::UpdateCollapseColors(){ +#ifdef VERYVERBOSE + cout << "Updating Collapse Colors" << endl; +#endif + for(int i=0;iisEnabled()){ + if(myDet->getPositions()) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + } + //scans + else if((i==Scan0)||(i==Scan1)){ + if(myDet->getScanMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + //actions + else{ + if(myDet->getActionMode(GetActualIndex(i))) palette->setColor(QPalette::WindowText,Qt::darkGreen); + else palette->setColor(QPalette::WindowText,Qt::black); + lblName[i]->setPalette(*palette); + } + } + +} +//------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 6825b7307..ee803ddc9 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -14,6 +14,7 @@ using namespace std; +//------------------------------------------------------------------------------------------------------------------------------------------------- qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ @@ -23,6 +24,8 @@ qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget( } +//------------------------------------------------------------------------------------------------------------------------------------------------- + qTabAdvanced::~qTabAdvanced(){ @@ -30,6 +33,7 @@ qTabAdvanced::~qTabAdvanced(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- void qTabAdvanced::SetupWidgetWindow(){ @@ -37,8 +41,41 @@ void qTabAdvanced::SetupWidgetWindow(){ } +//------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabAdvanced::Initialization(){ + //energy/angular logs + connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); + + +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabAdvanced::SetLogs(){ + QCheckBox *checkedBox = qobject_cast(sender()); + int index = ((!checkedBox->text().compare("Energy Calibration"))?slsDetectorDefs::enCalLog:slsDetectorDefs::angCalLog); + bool enable = checkedBox->isChecked(); +#ifdef VERBOSE + if(index==slsDetectorDefs::enCalLog) + cout << "Setting Energy Calibration Logs to " << enable << endl; + else + cout << "Setting Angular Calibration Logs to " << enable << endl; +#endif + //set/unset the log + myDet->setAction(index,(enable?"set":"none")); + //verify + if(myDet->getActionMode(index)!=(enable)){ +#ifdef VERBOSE + cout << "Could not set/reset Log." << endl; +#endif + qDefs::WarningMessage("Could not set/reset Log.","Advanced"); + checkedBox->setChecked(!enable); + } } @@ -47,6 +84,14 @@ void qTabAdvanced::Initialization(){ void qTabAdvanced::Refresh(){ + //energy/angular logs + chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); + chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); +#ifdef VERBOSE + cout << "Energy Calibration Log set to " << chkEnergyLog->isChecked() << endl; + cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; +#endif + }