merge conflict resolved from 3.0.1

This commit is contained in:
Dhanya Maliakal
2017-11-17 09:40:42 +01:00
13 changed files with 263 additions and 87 deletions

View File

@ -20,7 +20,7 @@
qCloneWidget::qCloneWidget(QWidget *parent,int id,QString title,QString xTitle, QString yTitle, QString zTitle,
int numDim,string FilePath,bool displayStats, QString min, QString max, QString sum):
QMainWindow(parent),id(id),cloneplot2D(0),cloneplot1D(0),filePath(FilePath)
QMainWindow(parent),id(id),filePath(FilePath),cloneplot1D(0),cloneplot2D(0)
{
// Window title
char winTitle[300],currTime[50];
@ -267,12 +267,13 @@ void qCloneWidget::SavePlot(){
cloneBox->render(&painter);
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 (!fName.isEmpty()) {
if((img.save(fName)))
qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","qCloneWidget::SavePlot");
else
qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n"
"Formats: .png, .jpg, .xpm.","qCloneWidget::SavePlot");
}
}

View File

@ -657,12 +657,12 @@ void qDetectorMain::ExecuteHelp(QAction *action){
cout << "About: Common GUI for Mythen, Eiger, Gotthard, Jungfrau, Moench and Propix detectors" << endl;
#endif
char version[200];
int64_t retval= SVNREV;
long long unsigned int retval= SVNREV;
retval= (retval <<32) | SVNDATE;
sprintf(version,"%llx",retval);
string thisGUIVersion = string(version);
sprintf(version,"%llx",myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
sprintf(version,"%llx",(long long unsigned int)myDet->getId(slsDetectorDefs::THIS_SOFTWARE_VERSION));
qDefs::checkErrorMessage(myDet,"qDetectorMain::ExecuteHelp");
string thisClientVersion = string(version);

View File

@ -297,7 +297,7 @@ void qDrawPlot::SetupWidgetWindow(){
nHists = 1;
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
for(unsigned int px=0;px<(int)nPixelsX;px++) {histXAxis[px] = px;histYAxis[0][px] = 0;}
for(unsigned int px=0;px<nPixelsX;px++) {histXAxis[px] = px;histYAxis[0][px] = 0;}
Clear1DPlot();
plot1D->SetXTitle("X Axis");
plot1D->SetYTitle("Y Axis");
@ -349,8 +349,7 @@ void qDrawPlot::SetupWidgetWindow(){
//callbacks
// callbacks
// 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
@ -360,6 +359,13 @@ void qDrawPlot::SetupWidgetWindow(){
//Setting the callback function to get progress from detector class(using receivers)
myDet->registerProgressCallback(&(GetProgressCallBack),this);
// if receiver, enable data streaming from receiver and client
if(myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) {
myDet->enableDataStreamingFromReceiver(1);
myDet->enableDataStreamingToClient(1);
}
qDefs::checkErrorMessage(myDet,"qDrawPlot::SetupWidgetWindow");
}
@ -561,7 +567,7 @@ void qDrawPlot::SetScanArgument(int scanArg){
//get #scansets for level 0 and level 1
int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0);
int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1);
int numPos=myDet->getPositions();
//int numPos=myDet->getPositions();
number_of_exposures = number_of_frames * numScan0 * numScan1;
if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos;
@ -615,9 +621,10 @@ void qDrawPlot::SetScanArgument(int scanArg){
if(gainImageArray) delete [] gainImageArray; gainImageArray = new double[nPixelsY*nPixelsX];
//initializing 1d x axis
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;/*+10;*/
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;/*+10;*/
//initializing 2d array
memset(lastImageArray,0,nPixelsY *nPixelsX * sizeof(double));
memset(gainImageArray,0,nPixelsY *nPixelsX * sizeof(double));
/*for(int py=0;py<(int)nPixelsY;py++)
@ -767,17 +774,15 @@ void qDrawPlot::SetupMeasurement(){
void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
//stream data from receiver to the gui
if(((qDrawPlot*)this_pointer)->myDet->setReceiverOnline(slsDetectorDefs::GET_ONLINE_FLAG) == slsDetectorDefs::ONLINE_FLAG) {
//if it was not on
if ( (((qDrawPlot*)this_pointer)->myDet->getStreamingSocketsCreatedInClient() != 1)
|| (((qDrawPlot*)this_pointer)->myDet->enableDataStreamingFromReceiver(-1)!= 1) ){
//switch it on, if error
// stream data from receiver to the gui
if(((qDrawPlot*)this_pointer)->myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) {
// if receiver data up streaming not on, switch it on
if (((qDrawPlot*)this_pointer)->myDet->enableDataStreamingFromReceiver() != 1)
if (((qDrawPlot*)this_pointer)->myDet->enableDataStreamingFromReceiver(1) != 1) {
qDefs::checkErrorMessage(((qDrawPlot*)this_pointer)->myDet,"qDrawPlot::DataStartAcquireThread");
return this_pointer;
}
}
}
((qDrawPlot*)this_pointer)->myDet->acquire(1);
@ -834,7 +839,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
sprintf(temp_title,"#%d %d",fIndex,subIndex);
}else{
if(fileSaveEnable) strcpy(temp_title,"#%d");
else sprintf(temp_title,"",currentFrame);
else sprintf(temp_title,"#%d",currentFrame);
}
if(subIndex != -1)
sprintf(temp_title,"#%d %d",fIndex,subIndex);
@ -1713,12 +1718,13 @@ void qDrawPlot::SavePlot(){
fName = QFileDialog::getSaveFileName(0,tr("Save Image"),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty())
if (!fName.isEmpty()) {
if(savedImage.save(fName))
qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","qDrawPlot::SavePlot");
else
qDefs::Message(qDefs::WARNING,"Attempt to save image failed.\n"
"Formats: .png, .jpg, .xpm.","qDrawPlot::SavePlot");
}
}
@ -1816,7 +1822,7 @@ void qDrawPlot::DisableZoom(bool disable){
int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
int ret,i,actualPixelsX;
int ret,actualPixelsX;
double min=0,max=0,sum=0;
#ifdef VERBOSE
if(fromDetector) cout << "Geting Trimbits from Detector" << endl;
@ -1864,8 +1870,8 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
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;px<(int)nPixelsX;px++) histXAxis[px] = px;
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;
for(unsigned int i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
//data
memcpy(histYAxis[0],histTrimbits,nPixelsX*sizeof(double));
@ -1896,14 +1902,14 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
//create intervals
histogramSamples.resize(TRIM_HISTOGRAM_XMAX+1);
for(i=0; i<TRIM_HISTOGRAM_XMAX+1; i++){
for(unsigned int i=0; i<TRIM_HISTOGRAM_XMAX+1; i++){
histogramSamples[i].interval.setInterval(i,i+1);
histogramSamples[i].value = 0;
}
//fill histogram values
int value = 0;
for(i=0;i<actualPixelsX;i++){
for(int i=0;i<actualPixelsX;i++){
if( (histTrimbits[i] <= TRIM_HISTOGRAM_XMAX) && (histTrimbits[i] >= 0)){//if(histogramSamples[j].interval.contains(data->values[i]))
value = (int) histTrimbits[i];
histogramSamples[value].value += 1;

View File

@ -77,6 +77,8 @@ void qTabAdvanced::SetupWidgetWindow(){
case slsDetectorDefs::MYTHEN:
isEnergy = true;
isAngular = true;
spinZmqPort->setEnabled(false);
spinZmqPort2->setEnabled(false);
break;
case slsDetectorDefs::EIGER:
isEnergy = true;
@ -154,6 +156,8 @@ void qTabAdvanced::SetupWidgetWindow(){
spinStopPort->setValue(det->getStopPort());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort().c_str()));
spinZmqPort->setValue(atoi(det->getClientStreamingPort().c_str()));
spinZmqPort2->setValue(atoi(det->getReceiverStreamingPort().c_str()));
cout << "Getting network information" << endl;
dispIP->setText(det->getDetectorIP().c_str());
@ -260,12 +264,14 @@ void qTabAdvanced::Initialization(){
if((detType==slsDetectorDefs::GOTTHARD) ||
(detType==slsDetectorDefs::MOENCH) ||
(detType==slsDetectorDefs::PROPIX) ||
(detType==slsDetectorDefs::PROPIX) ||
(detType==slsDetectorDefs::JUNGFRAU)){
(detType==slsDetectorDefs::JUNGFRAU) ||
(detType==slsDetectorDefs::EIGER)){
//network
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
connect(spinZmqPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZmqPort(int)));
connect(spinZmqPort2, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZmqPort(int)));
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
@ -721,6 +727,38 @@ void qTabAdvanced::SetRxrUDPPort(int port){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetCltZmqPort(int port){
#ifdef VERBOSE
cout << "Setting Receiver UDP Port:" << port << endl;
#endif
ostringstream ss; ss << port; string sport = ss.str();
disconnect(spinZmqPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZmqPort(int)));
spinZmqPort->setValue(atoi(det->setClientStreamingPort(sport).c_str()));
qDefs::checkErrorMessage(det,"qTabAdvanced::SetCltZmqPort");
connect(spinZmqPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZmqPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetRxrZmqPort(int port){
#ifdef VERBOSE
cout << "Setting Receiver UDP Port:" << port << endl;
#endif
ostringstream ss; ss << port; string sport = ss.str();
disconnect(spinZmqPort2, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZmqPort(int)));
spinZmqPort2->setValue(atoi(det->setReceiverStreamingPort(sport).c_str()));
qDefs::checkErrorMessage(det,"qTabAdvanced::SetRxrZmqPort");
connect(spinZmqPort2, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZmqPort(int)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetReceiverOnline(int index){
#ifdef VERBOSE
cout << "Setting Reciever Online to :" << index << endl;
@ -1061,6 +1099,8 @@ void qTabAdvanced::SetDetector(int index){
spinStopPort->setValue(det->getStopPort());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort().c_str()));
spinZmqPort->setValue(atoi(det->getClientStreamingPort().c_str()));
spinZmqPort2->setValue(atoi(det->getReceiverStreamingPort().c_str()));
dispIP->setText(det->getDetectorIP().c_str());
dispMAC->setText(det->getDetectorMAC().c_str());
@ -1248,6 +1288,8 @@ void qTabAdvanced::Refresh(){
//disconnect
disconnect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
disconnect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
disconnect(spinZmqPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZmqPort(int)));
disconnect(spinZmqPort2, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZmqPort(int)));
disconnect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
disconnect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
disconnect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
@ -1266,6 +1308,8 @@ void qTabAdvanced::Refresh(){
dispRxrHostname->setText(det->getReceiver().c_str());
spinTCPPort->setValue(det->getReceiverPort());
spinUDPPort->setValue(atoi(det->getReceiverUDPPort().c_str()));
spinZmqPort->setValue(atoi(det->getClientStreamingPort().c_str()));
spinZmqPort2->setValue(atoi(det->getReceiverStreamingPort().c_str()));
dispUDPIP->setText(det->getReceiverUDPIP().c_str());
dispUDPMAC->setText(det->getReceiverUDPMAC().c_str());
@ -1273,6 +1317,8 @@ void qTabAdvanced::Refresh(){
//connect
connect(spinTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int)));
connect(spinUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int)));
connect(spinZmqPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZmqPort(int)));
connect(spinZmqPort2, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZmqPort(int)));
connect(comboRxrOnline, SIGNAL(currentIndexChanged(int)), this, SLOT(SetReceiverOnline(int)));
connect(dispIP, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));
connect(dispMAC, SIGNAL(editingFinished()), this, SLOT(SetNetworkParameters()));

View File

@ -404,11 +404,11 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){
det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
@ -425,17 +425,17 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){
det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
lblModuleId->setText(QString("%1").arg(im));
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::MODULE_SERIAL_NUMBER,im));
lblModuleSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::MODULE_FIRMWARE_VERSION,im));
lblModuleFirmware->setText(QString(value));
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
@ -457,11 +457,11 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){
det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");
@ -481,11 +481,11 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item){
det = myDet->getSlsDetector(i);
qDefs::checkErrorMessage(myDet,"qTabDebugging::SetParameters");
lblDetectorId->setText(comboDetector->itemText(i));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SERIAL_NUMBER));
lblDetectorSerial->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION));
lblDetectorFirmware ->setText(QString(value));
sprintf(value,"%llx",det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
sprintf(value,"%llx",(long long unsigned int)det->getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION));
lblDetectorSoftware->setText(QString(value));
qDefs::checkErrorMessage(det,"qTabDebugging::SetParameters");

View File

@ -734,7 +734,6 @@ void qTabMeasurement::SetTimingMode(int mode){
//Frame Period between exposures
qDefs::timeUnit unit;
if(lblPeriod->isEnabled())
CheckAcqPeriodGreaterThanExp();
else{

View File

@ -69,11 +69,12 @@ void qTabSettings::GetDynamicRange(int setvalue){
cout << "Getting dynamic range" << endl;
#endif
int ret = myDet->setDynamicRange(-1);
if(detType == slsDetectorDefs::MYTHEN)
if(detType == slsDetectorDefs::MYTHEN) {
if(ret==24)
ret=32;
else if(ret==24)
cout<<"ret:"<<ret<<endl;
}
//check if the set value is equal to return value
if((setvalue!=-1) && (setvalue!=ret)){
qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","qTabSettings::SetDynamicRange");