updated gui to work with receiver, start and stop receiver, show progress using callback

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@108 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-11-07 17:01:24 +00:00
parent 716b3530e8
commit ba923b55b7
6 changed files with 36 additions and 5 deletions

View File

@ -21,7 +21,7 @@ public:
qDefs(){};
//-------------------------------------------------------------------------------------------------------------------------------------------------
#define GUI_VERSION 0.13
#define GUI_VERSION 0.14
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -222,6 +222,10 @@ static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileI
* */
int MeasurementFinished(int currentMeasurementIndex, int fileIndex);
/** This is called by the detector class to send progress if receiver is online */
static int GetProgressCallBack(double currentProgress, void *this_pointer);
/** Saves all the plots. All sets saveError to true if not saved.*/
void SavePlotAutomatic();
/** Sets the style of the 1d plot */

View File

@ -37,6 +37,7 @@ INCLUDEPATH += \
forms/include\
../slsDetectorSoftware/commonFiles\
../slsDetectorSoftware/MySocketTCP\
../slsDetectorSoftware/slsReceiverInterface\
../slsDetectorSoftware/slsDetector\
../slsDetectorSoftware/slsDetectorAnalysis\
../slsDetectorSoftware/multiSlsDetector\

View File

@ -193,7 +193,7 @@ double g[]={0.00, 0.81, 1.00, 0.20, 0.00};
double b[] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
QColor c1,c2,c;
c1.setRgbF(r[0],g[0],b[0]);
c1.setRgbF(r[0],g[0],b[0],0);
c2.setRgbF(r[ns-1],g[ns-1],b[ns-1]);
QwtLinearColorMap* copyMap = new QwtLinearColorMap(Qt::lightGray, c2);

View File

@ -194,7 +194,8 @@ void qDrawPlot::SetupWidgetWindow(){
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
//Setting the callback function to alert when each measurement finished from detector class
myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this);
//Setting the callback function to get progress from detector class(using receivers)
myDet->registerProgressCallback(&(GetProgressCallBack),this);
}
@ -511,9 +512,20 @@ void qDrawPlot::SetupMeasurement(int currentIndex){
void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
cout << "before acquire ...." << endl;
bool receiver=(((qDrawPlot*)this_pointer)->myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG);
if(receiver){
if(((qDrawPlot*)this_pointer)->myDet->startReceiver()==slsDetectorDefs::OK)
usleep(2000000);
else{
qDefs::Message(qDefs::CRITICAL,"could not start receiver","Plot");
return this_pointer;
}
}
((qDrawPlot*)this_pointer)->myDet->acquire(1);
cout << "after acquire ...." << endl;
if(receiver){
usleep(0);
((qDrawPlot*)this_pointer)->myDet->stopReceiver();
}
return this_pointer;
}
@ -813,6 +825,15 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
//-------------------------------------------------------------------------------------------------------------------------------------------------
int qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer){
((qDrawPlot*)this_pointer)->progress= currentProgress;
return 0;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::ShowAcquisitionErrorMessage(QString status){
if(!alreadyDisplayed){
alreadyDisplayed = true;

View File

@ -318,6 +318,11 @@ void qTabMeasurement::startStopAcquisition(){
btnStartStop->setIcon(*iconStart);
btnStartStop->setChecked(false);
Enable(1);
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){
usleep(0);
myDet->stopReceiver();
}
}
}