diff --git a/slsDetectorGui/forms/form_tab_advanced.ui b/slsDetectorGui/forms/form_tab_advanced.ui index 60e3ed53a..1478fff63 100644 --- a/slsDetectorGui/forms/form_tab_advanced.ui +++ b/slsDetectorGui/forms/form_tab_advanced.ui @@ -60,7 +60,7 @@ true - true + false @@ -120,7 +120,7 @@ - true + false @@ -167,7 +167,7 @@ - true + false @@ -339,7 +339,7 @@ An extension given by the modules serial number will be attached. - true + false @@ -402,7 +402,7 @@ An extension given by the modules serial number will be attached. - true + false @@ -567,6 +567,9 @@ An extension given by the modules serial number will be attached. true + + false + diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h index 5872fed19..307978cd4 100644 --- a/slsDetectorGui/include/qDrawPlot.h +++ b/slsDetectorGui/include/qDrawPlot.h @@ -101,6 +101,12 @@ public: * @param enable enable */ void setTriggerEnabled(bool enable){isTriggerEnabled = enable;}; + /** Updates the trimbit plot + * @param fromDetector is true if the trimbits should be loaded from detector + * @param Histogram true if histogram, else data graph + * returns ok/fail + * */ + int UpdateTrimbitPlot(bool fromDetector,bool Histogram); @@ -110,7 +116,7 @@ public slots: @param i is 1 for 1D, else 2D plot */ void SelectPlot(int i=2); /** To select 1D plot */ -void Select1DPlot() {SelectPlot(1);} +void Select1DPlot() {Clear1DPlot();SelectPlot(1);} /** To select 2D plot */ void Select2DPlot() {SelectPlot(2);} /** To clear plot */ @@ -124,7 +130,7 @@ void SaveClones(); /** To Save plot */ void SavePlot(); /** Save all plots **/ -void SaveAll(bool enable); +void SaveAll(bool enable){saveAll = enable;}; /** Sets persistency from plot tab */ void SetPersistency(int val); /** sets style of plot to lines*/ @@ -132,7 +138,7 @@ void SetLines(bool enable){lines = enable;}; /** sets markers */ void SetMarkers(bool enable){markers = enable;}; /** sets the scan argument to prepare the plot*/ -void SetScanArgument(int scanArg){scanArgument = scanArg;}; +void SetScanArgument(int scanArg); /** sets stop_signal to true */ void StopAcquisition(){ stop_signal = true; }; @@ -140,6 +146,7 @@ void StopAcquisition(){ stop_signal = true; }; + private: /** Initializes all its members and the thread */ void Initialization(); @@ -163,29 +170,53 @@ int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;} /** Stops the acquisition */ int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;} + /** Starts/stops Acquisition Thread */ bool StartOrStopThread(bool start); -/** Sets up measurement each time */ -void SetupMeasurement(); + +/** Sets up measurement each time + * @param currentIndex file index given by detector class + * */ +void SetupMeasurement(int currentIndex); + /** Resets the acquisition parameter like lastimagenumber */ int ResetDaqForGui(); + /** The function which is called when start acquisition thread is created */ static void* DataStartAcquireThread(void *this_pointer); + /** This is called by the detector class to copy the data it jus acquired */ static int GetDataCallBack(detectorData *data, void *this_pointer); + /** This is called by the GetDataCallBack function to copy the data */ int GetData(detectorData *data); + /** This is called by detector class when acquisition is finished * @param currentProgress current progress of measurement * @param detectorStatus current status of the detector * @param this_pointer is the pointer pointing to this object * */ static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer); -/** This is called by detector class when acquisition is finished + +/** This is called by static function when acquisition is finished * @param currentProgress current progress of measurement * @param detectorStatus current status of the detector * */ int AcquisitionFinished(double currentProgress,int detectorStatus); + +/** This is called by detector class when a measurement is finished + * @param currentMeasurementIndex current measurement index + * @param fileIndex current file index + * @param this_pointer is the pointer pointing to this object + * */ +static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer); + +/** This is called by the static function when meausrement is finished + * @param currentMeasurementIndex current measurement index + * @param fileIndex current file index + * */ +int MeasurementFinished(int currentMeasurementIndex, int fileIndex); + /** Saves all the plots. All sets saveError to true if not saved.*/ void SavePlotAutomatic(); /** Sets the style of the 1d plot */ @@ -199,24 +230,32 @@ void SetStyle(SlsQtH1D* h){ private slots: -/** To update plot */ +/** To update plot + * */ void UpdatePlot(); -/** To stop updating plot */ +/** To stop updating plot + * */ void StopUpdatePlot(); /** To start or stop acquisition - * @param start is 1 to start and 0 to stop acquisition */ + * @param start is 1 to start and 0 to stop acquisition + * */ void StartDaq(bool start); /** To set the reference to zero after closing a clone - * @param id is the id of the clone */ + * @param id is the id of the clone + * */ void CloneCloseEvent(int id); /**After a pause, the gui is allowed to collect the data - * this is called when it is over */ + * this is called when it is over + * */ 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.*/ + * @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(); +/**Shows an error message when acquisition stopped unexpectedly + * @param status is the status of the detector + * */ +void ShowAcquisitionErrorMessage(QString status); private: @@ -330,10 +369,6 @@ double* histXAngleAxis; double* histYAngleAxis; /** Current Image Values in 2D */ double* lastImageArray; -/** temporary Y Axis value in 1D */ -double* yvalues[MAX_1DPLOTS]; -/** temporary Image Values in 2D */ -double* image_data; /**persistency to be reached*/ int persistency; @@ -391,6 +426,13 @@ bool anglePlot; /** prevents err msg displaying twice when detector stopped, "transmitting" */ bool alreadyDisplayed; +/**saves the file path and file name, not to access shared memory while running*/ +QString filePath; +QString fileName; + +/** Max Number of Clone Windows */ +static const int TRIM_HISTOGRAM_XMAX = 600; + signals: @@ -402,7 +444,7 @@ void SetZRangeSignal(double,double); void EnableZRangeSignal(bool); void SetCurrentMeasurementSignal(int); void saveErrorSignal(QString); -void AcquisitionErrorSignal(); +void AcquisitionErrorSignal(QString); }; diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h index ec1afa5e7..0f5dd3bab 100644 --- a/slsDetectorGui/include/qTabAdvanced.h +++ b/slsDetectorGui/include/qTabAdvanced.h @@ -13,6 +13,8 @@ /** Project Class Headers */ class multiSlsDetector; #include "sls_detector_defs.h" +/** Qt Project Class Headers */ +class qDrawPlot; /** Qt Include Header */ #include @@ -26,8 +28,9 @@ public: /** \short The constructor * @param parent is the parent tab widget * @param detector is the detector returned from the detector tab + * @param plot plot object reference */ - qTabAdvanced(QWidget *parent,multiSlsDetector*& detector); + qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot); /** Destructor */ @@ -90,13 +93,17 @@ private slots: */ void StartTrimming(); - /**Updates plot from shared memory + /** Updates the plot with trimbits from detector/shared memory */ - void UpdatePlot(); + void UpdateTrimbitPlot(int id); private: /** The sls detector object */ multiSlsDetector *myDet; + /** The Plot widget */ + qDrawPlot *myPlot; + + QButtonGroup *btnGroup; /** Tool Tip for the output dir */ QString outputDirTip; diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index a0bee6f67..0f5a9d680 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -61,9 +61,8 @@ private: private slots: /** Sets the output directory - * @param path output path to be set */ -void setOutputDir(const QString& path); +void setOutputDir(); /** Open dialog to choose the output directory */ void browseOutputDir(); diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h index 2187a6a99..1be27aed2 100644 --- a/slsDetectorGui/include/qTabPlot.h +++ b/slsDetectorGui/include/qTabPlot.h @@ -38,9 +38,7 @@ public: */ ~qTabPlot(); - /** To refresh and update widgets - */ - void Refresh(); + private: @@ -111,6 +109,11 @@ void EnableNthFrame(bool enable){enableNFrame = enable;}; */ void SetScanArgument(); +/** To refresh and update widgets + */ +void Refresh(); + + private slots: /** Selects the plot to display, enables/disables widgets diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h index e65c3e74a..822052404 100644 --- a/slsDetectorGui/include/qTabSettings.h +++ b/slsDetectorGui/include/qTabSettings.h @@ -37,6 +37,13 @@ public: */ void Refresh(); + /** To enable expert mode + * @param enable to enable if true + */ + void SetExpertMode(bool enable){expertMode = enable;}; + + + private: /** The sls detector object */ @@ -45,7 +52,8 @@ private: /** detector type */ slsDetectorDefs::detectorType detType; - + /** expert mode */ + bool expertMode; enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings}; @@ -89,6 +97,11 @@ void SetDynamicRange(int index); /** Set threshold energy */ void SetEnergy(); + + +signals: +/**Update Trimbits after Set Settings */ +void UpdateTrimbitSignal(int); }; diff --git a/slsDetectorGui/src/qActionsWidget.cpp b/slsDetectorGui/src/qActionsWidget.cpp index 75a6d3b62..0e595c670 100644 --- a/slsDetectorGui/src/qActionsWidget.cpp +++ b/slsDetectorGui/src/qActionsWidget.cpp @@ -204,7 +204,7 @@ void qActionsWidget::Refresh(){ cout << "Updated\taction:" << id << "\t" "mode:"<setVisible(enable); actionSaveCalibration->setVisible(enable); - if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN) + if(digitalDetector){ tab_measurement->SetExpertMode(enable); + tab_settings->SetExpertMode(enable); + } #ifdef VERBOSE @@ -476,7 +481,14 @@ void qDetectorMain::Refresh(int index){ tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); else{ switch(tabs->currentIndex()){ - case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break; + case Measurement: + if(!myPlot->isRunning()) { + tab_measurement->Refresh(); + //to recover from a trimbit plot mode + tab_plot->Refresh(); + } + break; + case Settings: tab_settings->Refresh(); break; case DataOutput: tab_dataoutput->Refresh(); break; case Plot: tab_plot->Refresh(); break; @@ -558,6 +570,17 @@ void qDetectorMain::EnableTabs(){ tabs->setTabEnabled(Settings,enable); tabs->setTabEnabled(Messages,enable); + //actions check + actionOpenSetup->setEnabled(enable); + actionSaveSetup->setEnabled(enable); + actionOpenConfiguration->setEnabled(enable); + actionSaveConfiguration->setEnabled(enable); + actionMeasurementWizard->setEnabled(enable); + actionDebug->setEnabled(enable); + actionBeamline->setEnabled(enable); + actionExpert->setEnabled(enable); + + // special tabs if(enable==false){ tabs->setTabEnabled(Debugging,enable); @@ -589,6 +612,7 @@ void qDetectorMain::EnableTabs(){ if(isDeveloper) tabs->setTabEnabled(Developer,enable); } + } diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index c468f506b..e0278443e 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -8,6 +8,7 @@ #include "qDrawPlot.h" #include "qCloneWidget.h" #include "slsDetector.h" +#include"fileIOStatic.h" // Project Class Headers #include "slsDetector.h" @@ -76,7 +77,6 @@ void qDrawPlot::SetupWidgetWindow(){ minPixelsY = 0; //2d lastImageArray = 0; - image_data = 0; //1d nHists = 0; histNBins = 0; @@ -103,7 +103,9 @@ void qDrawPlot::SetupWidgetWindow(){ alreadyDisplayed = false; // This is so that it initially stop and plots running = 1; - for(int i=0;igetFilePath().c_str()); + fileName = QString(myDet->getFileName().c_str()); } @@ -186,7 +190,7 @@ void qDrawPlot::Initialization(){ connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); - connect(this, SIGNAL(AcquisitionErrorSignal()), this, SLOT(ShowAcquisitionErrorMessage())); + connect(this, SIGNAL(AcquisitionErrorSignal(QString)), this, SLOT(ShowAcquisitionErrorMessage(QString))); } @@ -205,8 +209,6 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ running=!running; }else if(!stop_if_running){ //then start - //number of measurements - int numMeasurements = (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1); // Reset Current Measurement currentMeasurement = 0; emit SetCurrentMeasurementSignal(currentMeasurement); @@ -235,7 +237,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ if(anglePlot) number_of_exposures = numScan0 * numScan1; - cout << "\tNumber of Exposures:" << number_of_exposures << endl; + cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl; // ExposureTime exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9); @@ -244,6 +246,8 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9); cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl; + cout << "\tFile Index:" << myDet->getFileIndex() << endl; + //to take the first data if frameFactor numFactor = 0; @@ -252,6 +256,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){ lastSavedFrame = -1; lastSavedMeasurement = -1; + //update file path and file name + filePath = QString(myDet->getFilePath().c_str()); + fileName = QString(myDet->getFileName().c_str()); + StartDaq(true); running=!running; @@ -312,13 +320,15 @@ bool qDrawPlot::StartOrStopThread(bool start){ if(start){ progress = 0; //sets up the measurement parameters - SetupMeasurement(); + SetupMeasurement(myDet->getFileIndex()); cout << "Starting new acquisition threadddd ...." << endl; // Setting the callback function to get data from detector class myDet->registerDataCallback(&(GetDataCallBack),this); //Setting the callback function to alert when acquisition finished from detector class myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this); + //Setting the callback function to alert when each measurement finished from detector class + myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); // Start acquiring data from server if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); @@ -337,69 +347,37 @@ bool qDrawPlot::StartOrStopThread(bool start){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::SetupMeasurement(){ - if(myDet->getRunStatus()==slsDetectorDefs::IDLE) - cout<getRunStatus()<getFileIndex(); - currentScanValue = 0; - currentScanDivLevel = 0; + LockLastImageArray(); + nPixelsX = myDet->getTotalNumberOfChannels(); + nPixelsY = 100;//if number of exposures, this should be checked before acquisition - if(scanArgument!=None){ - if(scanArgument==AllFrames){ - maxPixelsY = currentIndex + number_of_exposures - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_exposures; - }else if(scanArgument==FileIndex){ - maxPixelsY = currentIndex + number_of_frames - 1; - minPixelsY = currentIndex; - nPixelsY = number_of_frames; - }else if(scanArgument==Level0){ - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(0); - double *values = new double[numSteps]; - myDet->getScanSteps(0,values); + //cannot do this in between measurements , so update instantly + if(scanArgument==Level0){ + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(0); + double *values = new double[numSteps]; + myDet->getScanSteps(0,values); - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - else { - //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab - int numSteps = myDet->getScanSteps(1); - double *values = new double[numSteps]; - myDet->getScanSteps(1,values); + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; + }else if(scanArgument==Level1) { + //no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab + int numSteps = myDet->getScanSteps(1); + double *values = new double[numSteps]; + myDet->getScanSteps(1,values); - maxPixelsY = values[numSteps-1]; - minPixelsY = values[0]; - nPixelsY = numSteps; - currentScanValue = values[0]; - } - pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1); - startPixel = minPixelsY -(pixelWidth/2); - endPixel = maxPixelsY + (pixelWidth/2); - }else{//no scan - nPixelsY = 100;//number_of_exposures; - maxPixelsY = 100; - minPixelsY = 0; - startPixel = -0.5; - endPixel = nPixelsY-0.5; + maxPixelsY = values[numSteps-1]; + minPixelsY = values[0]; + nPixelsY = numSteps; } - cout<<"nPixelsY:"<progressIndex<fileName).section('/',-1)); //set progress progress=(int)data->progressIndex; - - +#ifdef VERBOSE + cout << "progress:" << progress << endl; +#endif //Plot Disabled if(!plotEnable) return 0; @@ -522,7 +567,7 @@ int qDrawPlot::GetData(detectorData *data){ lastImageNumber= currentFrame+1; //title char temp_title[2000]; - sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); imageTitle = temp_title; //copy data memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); @@ -536,7 +581,7 @@ int qDrawPlot::GetData(detectorData *data){ if(scanArgument==FileIndex){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //variables - int currentIndex = myDet->getFileIndexFromFileName(string(data->fileName)); + int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName)); if(currentIndex == minPixelsY) currentScanDivLevel = 0; lastImageNumber= currentFrame+1; //title @@ -556,8 +601,10 @@ int qDrawPlot::GetData(detectorData *data){ if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ //get scanvariable0 int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0; - myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); int currentScanVariable0 = (int)cs0; + cout<<"currentScanValue:"<getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); + fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1); int currentScanVariable1 = (int)cs1; //variables if(currentScanVariable1!=currentScanValue) currentScanDivLevel++; @@ -618,14 +665,13 @@ int qDrawPlot::GetData(detectorData *data){ //2d else{ // Titles - sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName))); + sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName))); imageTitle = temp_title; // manufacture data for now for(unsigned int px=0;pxvalues,nPixelsX*nPixelsY*sizeof(double)); } pthread_mutex_unlock(&(last_image_complete_mutex)); @@ -653,38 +699,30 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ + QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str()); #ifdef VERBOSE - cout << "Entering Acquisition Finished with status " << - slsDetectorBase::runStatusType((slsDetectorDefs::runStatus(detectorStatus))) << " and progress " << currentProgress << endl; + cout << "\nEntering Acquisition Finished with status " << status.toAscii().constData() << " and progress " << currentProgress << endl; #endif //error or stopped if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){ #ifdef VERBOSE - cout << "Error in Acquisition" << endl; + cout << "Error in Acquisition" << endl << endl; #endif - //just to be sure - stop_signal = 1; - StartStopDaqToggle(true); - emit AcquisitionErrorSignal(); + //stop_signal = 1;//just to be sure + emit AcquisitionErrorSignal(status); } - else{ - //all measurements are over - if(currentProgress==100){ + + //all measurements are over + else if(currentProgress==100){ #ifdef VERBOSE - cout << "Acquisition Finished" << endl; + cout << "Acquisition Finished" << endl << endl; #endif - StartStopDaqToggle(true); - emit UpdatingPlotFinished(); - } - else{//next measurement - currentMeasurement++; -#ifdef VERBOSE - cout << "currentMeasurement:" << currentMeasurement << endl; -#endif - emit SetCurrentMeasurementSignal(currentMeasurement); - SetupMeasurement(); - } } + + StartStopDaqToggle(true); + //this lets the measurement tab know its over, and to enable tabs + emit UpdatingPlotFinished(); + return 0; } @@ -692,12 +730,12 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qDrawPlot::ShowAcquisitionErrorMessage(){ +void qDrawPlot::ShowAcquisitionErrorMessage(QString status){ if(!alreadyDisplayed){ alreadyDisplayed = true; - int detStatus = (int)myDet->getRunStatus(); - string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus)); - qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. Current Detector Status: ")+status+string("."),"Dock"); + qDefs::Message(qDefs::WARNING,string("The acquisiton has ended abruptly. " + "Current Detector Status: ")+status.toAscii().constData()+ + string("."),"Dock"); } } @@ -705,8 +743,38 @@ void qDrawPlot::ShowAcquisitionErrorMessage(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer){ + ((qDrawPlot*)this_pointer)->MeasurementFinished(currentMeasurementIndex, fileIndex); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){ +#ifdef VERBOSE + cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; +#endif + //to make sure it plots the last frame before setting lastimagearray all to 0 + if(plot_in_scope==2) usleep(500000); + + currentMeasurement = currentMeasurementIndex + 1; +#ifdef VERBOSE + cout << "currentMeasurement:" << currentMeasurement << endl; +#endif + emit SetCurrentMeasurementSignal(currentMeasurement); + SetupMeasurement(fileIndex); + return 0; +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D if(i==1){ + Clear1DPlot(); plot1D->SetXTitle(histXAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->show(); @@ -724,13 +792,16 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D } } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::Clear1DPlot(){ for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot } + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -813,6 +884,7 @@ void qDrawPlot::UpdatePlot(){ if(plotEnable) UnlockLastImageArray(); + //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer if(!stop_signal){ if(!frameFactor) @@ -823,8 +895,10 @@ void qDrawPlot::UpdatePlot(){ } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::StopUpdatePlot(){ #ifdef VERYVERBOSE cout << "Entering StopUpdatePlot()" << endl; @@ -832,8 +906,10 @@ void qDrawPlot::StopUpdatePlot(){ plot_update_timer->stop(); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::ClonePlot(){ int i=0; bool found = false; @@ -850,8 +926,16 @@ void qDrawPlot::ClonePlot(){ // save height to keep maintain same height of plot int preheight = height(); + string sFilePath; + if(running) sFilePath = filePath.toAscii().constData(); + else sFilePath = myDet->getFilePath(); + + + + LockLastImageArray(); + // create clone - winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath()); + winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath); if(plot_in_scope==1){ plot1D = new SlsQt1DPlot(boxPlot); plot1D->setFont(QFont("Sans Serif",9,QFont::Normal)); @@ -885,6 +969,10 @@ void qDrawPlot::ClonePlot(){ plot2D->SetZTitle(imageZAxisTitle); plotLayout->addWidget(plot2D,1,1,1,1); } + + UnlockLastImageArray(); + + setMinimumHeight(preheight); resize(width(),preheight); @@ -899,8 +987,10 @@ void qDrawPlot::ClonePlot(){ connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int))); } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::SaveClones(){ char errID[200]; string errMessage= "The Snapshots with ID's: "; @@ -922,6 +1012,7 @@ void qDrawPlot::SaveClones(){ //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::CloseClones(){ for(int i=0;igetFilePath().c_str()); + QString fName; + if(running) fName = filePath; + else fName = QString(myDet->getFilePath().c_str()); + if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); @@ -965,6 +1063,7 @@ void qDrawPlot::SavePlot(){ //------------------------------------------------------------------------------------------------------------------------------------------------- +/* void qDrawPlot::SaveAll(bool enable){ string msg = string("The Files will be saved as:\n")+ @@ -973,19 +1072,27 @@ void qDrawPlot::SaveAll(bool enable){ qDefs::Message(qDefs::INFORMATION,msg,"Dock"); saveAll = enable; } +*/ //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::SavePlotAutomatic(){ //no need to save the same plot many times if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){ + + QString qFilePath; + if(running) qFilePath = filePath; + else qFilePath = QString(myDet->getFilePath().c_str()); + + lastSavedFrame = currentFrame; lastSavedMeasurement = currentMeasurement; char cID[10]; sprintf(cID,"%d",lastSavedFrame); //title - QString fName = QString(myDet->getFilePath().c_str()); + QString fName = qFilePath; if(boxPlot->title().contains('.')){ fName.append(QString('/')+boxPlot->title()); fName.replace(".dat",".png"); @@ -1007,6 +1114,7 @@ void qDrawPlot::SavePlotAutomatic(){ } } + //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1021,15 +1129,15 @@ void qDrawPlot::ShowSaveErrorMessage(QString fileName){ void qDrawPlot::SetPersistency(int val){ - for(int i=0;i<=val;i++){ - if(!yvalues[i]) yvalues[i] = new double [nPixelsX]; + for(int i=0;i<=val;i++) if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX]; - } persistency = val; } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::EnablePlot(bool enable){ #ifdef VERBOSE cout << "Plotting set to:" << enable << endl; @@ -1041,8 +1149,10 @@ void qDrawPlot::EnablePlot(bool enable){ } + //------------------------------------------------------------------------------------------------------------------------------------------------- + void qDrawPlot::DisableZoom(bool disable){ if(plot_in_scope==1) plot1D->DisableZoom(disable); @@ -1050,4 +1160,133 @@ void qDrawPlot::DisableZoom(bool disable){ plot2D->GetPlot()->DisableZoom(disable); } + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){ + int ret,i,actualPixelsX; + double *temp; +#ifdef VERBOSE + if(fromDetector) cout << "Geting Trimbits from Detector: "; + else cout << "Getting Trimbits from Shared Memory: "; + if(Histogram) cout << "Histogram" << endl; + else cout << "Data Graph" << endl; +#endif + + + switch(myDet->getDetectorsType()){ + + + case slsDetectorDefs::MYTHEN: + //get trimbits + actualPixelsX = myDet->getTotalNumberOfChannels(); + temp = new double[actualPixelsX]; + ret = myDet->getChanRegs(temp,fromDetector); + if(!ret){ + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + return qDefs::FAIL; + } + + //defining axes + if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX; + else nPixelsX = actualPixelsX; + if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX]; + if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX]; + //initializing + for(unsigned int px=0;pxSetXTitle("Channel Number"); + plot1D->SetYTitle("Trimbits"); + //set plot parameters + SlsQtH1D* h; + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + h->SetLineColor(1); + h->setTitle(GetHistTitle(0)); + //attach plot + h->Attach(plot1D); + }else{ + //data + for(i=0;i0)) + cout<<"HIsty["<SetXTitle("Trimbits"); + plot1D->SetYTitle("Frequency"); + //set plot parameters + SlsQtH1D* h; + plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0))); + h->SetLineColor(1); + h->setTitle(GetHistTitle(0)); + //attach plot + h->Attach(plot1D); + + } +#ifdef VERBOSE + cout << "Trimbits Plot updated" << endl; +#endif + break; + + + + + //2d + case slsDetectorDefs::EIGER: + //defining axes + nPixelsX = 100;/**??*/ + nPixelsY = 100; + if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX]; + //initializing 2d array + for(int py=0;py<(int)nPixelsY;py++) + for(int px=0;px<(int)nPixelsX;px++) + lastImageArray[py*nPixelsX+px] = 0; + //get trimbits + ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/ + if(!ret){ + qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock"); + return qDefs::FAIL; + } + //clear/select plot and set titles + Select2DPlot(); + plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray); + plot2D->setTitle("Image"); + plot2D->SetXTitle("Pixel"); + plot2D->SetYTitle("Pixel"); + plot2D->SetZTitle("Trimbits"); + plot2D->UpdateNKeepSetRangeIfSet(); +#ifdef VERBOSE + cout << "Trimbits Plot updated" << endl; +#endif + break; + + + + + + //shouldnt be here + default: + break; + } + return qDefs::OK; +} + + //------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/slsDetectorGui/src/qScanWidget.cpp b/slsDetectorGui/src/qScanWidget.cpp index 9f7c83ef5..50f4d50cb 100644 --- a/slsDetectorGui/src/qScanWidget.cpp +++ b/slsDetectorGui/src/qScanWidget.cpp @@ -1028,7 +1028,7 @@ void qScanWidget::Refresh(){ "numSteps:" << actualNumSteps << "\t" //"values:" << arrSteps << "\t" "parameter:" << parameter << "\t" - "precision:" << precision << endl << endl; + "precision:" << precision << "\t***" << endl; #endif } diff --git a/slsDetectorGui/src/qTabActions.cpp b/slsDetectorGui/src/qTabActions.cpp index e16dc3eef..46d9d5bb6 100644 --- a/slsDetectorGui/src/qTabActions.cpp +++ b/slsDetectorGui/src/qTabActions.cpp @@ -354,19 +354,24 @@ void qTabActions::DeletePosition(){ void qTabActions::EnablePositions(bool enable){ #ifdef VERBOSE - cout << "\nEnable Positions: " << enable << endl; + cout << "Enable Positions: " << enable << endl; #endif if(enable){ lblName[NumPositions]->setEnabled(true); btnExpand[NumPositions]->setEnabled(true); }else{ - //to collapse if it was expanded - if(btnExpand[NumPositions]->text()=="-") - Expand(group->button(NumPositions)); + //deletes all positions for(int i=0;icount();i++) comboPos->removeItem(i); cout<<"Number of Positions set to :"<getPositions()<setPalette(lblName[NumPositions-1]->palette()); + //to collapse if it was expanded + if(btnExpand[NumPositions]->isChecked()){ + disconnect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); + btnExpand[NumPositions]->setChecked(false); + connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*))); + Expand(group->button(NumPositions)); + } lblName[NumPositions]->setEnabled(false); btnExpand[NumPositions]->setEnabled(false); } @@ -378,7 +383,7 @@ void qTabActions::EnablePositions(bool enable){ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "\nUpdating all action widgets " << endl; + cout << "\nUpdating all action widgets: " << endl; #endif if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){ //positions is enabled only if angular conversion is enabled @@ -415,7 +420,7 @@ void qTabActions::Refresh(){ #ifdef VERBOSE - cout << "Updated position widget\tnum:" << numPos << endl << endl; + cout << "Updated position widget\tnum:" << numPos << "\t***" << endl; #endif } } @@ -423,7 +428,7 @@ void qTabActions::Refresh(){ scanWidget[i]->Refresh(); for(int i=0;iRefresh(); - + cout << endl; UpdateCollapseColors(); } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 9bc2c7081..b7109ad7f 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -6,6 +6,7 @@ */ #include "qTabAdvanced.h" #include "qDefs.h" +#include "qDrawPlot.h" /** Project Class Headers */ #include "slsDetector.h" #include "multiSlsDetector.h" @@ -19,7 +20,8 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- -qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){ +qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot): + QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){ setupUi(this); SetupWidgetWindow(); Initialization(); @@ -52,7 +54,12 @@ void qTabAdvanced::SetupWidgetWindow(){ boxTrimming->setChecked(false); SetOptimize(false); + + btnGroup = new QButtonGroup(this); + btnGroup->addButton(btnRefresh,0); + btnGroup->addButton(btnGetTrimbits,1); } + } @@ -88,7 +95,8 @@ void qTabAdvanced::Initialization(){ connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming())); //refresh - connect(btnRefresh, SIGNAL(clicked()), this, SLOT(UpdatePlot())); + connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int))); + } @@ -331,7 +339,7 @@ void qTabAdvanced::StartTrimming(){ 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"); //updates plots - UpdatePlot(); + myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked()); } else qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced"); @@ -341,36 +349,17 @@ void qTabAdvanced::StartTrimming(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabAdvanced::UpdatePlot(){ -#ifdef VERBOSE - cout << "Updating Plot" << endl; -#endif - - int nPixelsX = myDet->getTotalNumberOfChannels(); - - int *histXAxis = new int[nPixelsX]; - int *histYAxis = new int[100]; - for(int i=0;igetNumberOfDetectors();det++){ - slsDetector *s = myDet->getSlsDetector(det); - channelsPerDetector=s->getTotalNumberOfChannels(); - if(s->chanregs){ - for(int i=0;ichanregs,channelsPerDetector*sizeof(int)); - } - } - } -*/ - cout<<"histyaxis[500]:"<UpdateTrimbitPlot(false,radioHistogram->isChecked()); + //from detector + else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked()); } //------------------------------------------------------------------------------------------------------------------------------------------------- + void qTabAdvanced::Refresh(){ //disconnect disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 032452bf2..18b68a98e 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -46,7 +46,7 @@ qTabDataOutput::~qTabDataOutput(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<getDetectorsType(); @@ -74,7 +74,7 @@ void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<text(); + + //gets rid of the end '/'s + disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + while(path.endsWith('/')) path.chop(1); + dispOutputDir->setText(path); + connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir())); + myDet->setFilePath(string(path.toAscii().constData())); #ifdef VERBOSE cout << "Output Directory changed to :"<getFilePath() << endl; #endif + } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index c1a129a4b..4032474ec 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -306,6 +306,7 @@ void qTabMeasurement::startStopAcquisition(){ progressTimer->start(100); emit StartSignal(); + myPlot->StartStopDaqToggle(); }else{ #ifdef VERBOSE @@ -326,14 +327,16 @@ void qTabMeasurement::startStopAcquisition(){ void qTabMeasurement::UpdateFinished(){ - disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - btnStartStop->setText("Start"); - btnStartStop->setIcon(*iconStart); - btnStartStop->setChecked(false); - Enable(1); - connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); - UpdateProgress(); - progressTimer->stop(); + if(btnStartStop->isChecked()){ + disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + btnStartStop->setText("Start"); + btnStartStop->setIcon(*iconStart); + btnStartStop->setChecked(false); + Enable(1); + connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition())); + UpdateProgress(); + progressTimer->stop(); + } } @@ -723,20 +726,22 @@ void qTabMeasurement::EnableFileWrite(bool enable){ void qTabMeasurement::Refresh(){ - //Number of measurements - spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); - //File Name - dispFileName->setText(QString(myDet->getFileName().c_str())); - //File Index - spinIndex->setValue(myDet->getFileIndex()); - //progress label index - lblProgressIndex->setText(QString::number(myDet->getFileIndex())); - //Timing mode* - SetupTimingMode(); + if(!myPlot->isRunning()){ + //Number of measurements + spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1)); + //File Name + dispFileName->setText(QString(myDet->getFileName().c_str())); + //File Index + spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<getFileIndex()<setText(QString::number(myDet->getFileIndex())); + //Timing mode* + SetupTimingMode(); - // to let qdrawplot know that triggers or frames are used - myPlot->setFrameEnabled(lblNumFrames->isEnabled()); - myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + // to let qdrawplot know that triggers or frames are used + myPlot->setFrameEnabled(lblNumFrames->isEnabled()); + myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); + } } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index cb8bc9ea7..c56919add 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -504,7 +504,7 @@ void qTabPlot::EnableScanBox(){ int mode1 = myDet->getScanMode(1); //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())); //none of these scan plotting options make sense if positions>0 @@ -548,7 +548,8 @@ void qTabPlot::EnableScanBox(){ //positions if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); chkSuperimpose->setEnabled(!positionsExist); - boxFrequency->setEnabled(!positionsExist); + //box frequency should be enabled cuz its a normal 1d plot + boxFrequency->setEnabled(positionsExist); myPlot->EnableAnglePlot(positionsExist); @@ -673,8 +674,14 @@ void qTabPlot::SetScanArgument(){ void qTabPlot::Refresh(){ - SetFrequency(); - if(!myPlot->isRunning()) EnableScanBox(); + if(!myPlot->isRunning()){ + connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + SetFrequency(); + EnableScanBox(); + }else{ + disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox())); + boxScan->setEnabled(false); + } } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index eadf9cc17..1b3812ab3 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -18,7 +18,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------------------------------------------------- qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector): - QWidget(parent),myDet(detector){ + QWidget(parent),myDet(detector),expertMode(false){ setupUi(this); SetupWidgetWindow(); @@ -170,7 +170,7 @@ void qTabSettings::setSettings(int index){ if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){ lblThreshold->setEnabled(false); spinThreshold->setEnabled(false); - }else{ + }else{//mythen or eiger if((index==Undefined)||(index==Uninitialized)){ lblThreshold->setEnabled(false); @@ -179,8 +179,12 @@ void qTabSettings::setSettings(int index){ lblThreshold->setEnabled(true); spinThreshold->setEnabled(true); SetEnergy(); + //also update trimbits plot + if(expertMode) emit UpdateTrimbitSignal(0); } } + + } //------------------------------------------------------------------------------------------------------------------------------------------------- @@ -234,10 +238,10 @@ void qTabSettings::SetDynamicRange(int index){ void qTabSettings::SetEnergy(){ + int index = spinThreshold->value(); #ifdef VERBOSE cout << "Settings threshold energy to "<< index << endl; #endif - int index = spinThreshold->value(); myDet->setThresholdEnergy(index); int ret = (int)myDet->getThresholdEnergy(); if((ret-index)>200){ @@ -256,7 +260,11 @@ void qTabSettings::SetEnergy(){ void qTabSettings::Refresh(){ // Settings SetupDetectorSettings(); + //changin the combo settings also plots the trimbits for mythen and eiger, so disconnect + disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); comboSettings->setCurrentIndex(myDet->getSettings()); + connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int))); + // Number of Modules spinNumModules->setValue(myDet->setNumberOfModules());