From 68f360e3955427c6f8b795b7c46e9af8b1fd86c8 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 24 Jul 2013 09:38:55 +0000 Subject: [PATCH] change outdir for all receivers in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@208 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/include/qDefs.h | 6 +++-- slsDetectorGui/src/qTabDataOutput.cpp | 32 ++++++++++++++++++--------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h index 448fd11b6..e843d037c 100644 --- a/slsDetectorGui/include/qDefs.h +++ b/slsDetectorGui/include/qDefs.h @@ -218,9 +218,10 @@ static const int64_t GUI_VERSION=0x20121213; /**gets error mask and displays the message if it exists * @param myDet is the slsdetector object + * @param show to display the error message /returns error message else an empty string * */ - static string checkErrorMessage(slsDetector*& myDet){ + static string checkErrorMessage(slsDetector*& myDet,bool show = true){ int errorLevel= (int)WARNING; @@ -244,7 +245,8 @@ static const int64_t GUI_VERSION=0x20121213; retval.append(""); //display message - qDefs::Message((MessageIndex)errorLevel,retval,"Main"); + if(show) + qDefs::Message((MessageIndex)errorLevel,retval,"Main"); } myDet->clearErrorMask(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 6d6bbc3f0..d3fe18575 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -670,30 +670,33 @@ int qTabDataOutput::VerifyOutputDirectory(){ #endif bool error = false; QString errTip = outDirTip; - bool receiver = (!comboDetector->itemText(0).compare("All")); + bool receiver = (comboDetector->itemText(0).compare("All")); string path = string(dispReadOutputDir->text().toAscii().constData()); string detName = ""; + string mess = ""; //for each detector for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); if(receiver){ - detName = string(" for ") + string(comboDetector->itemText(i).toAscii().constData()) + string(" readout"); + detName = string("\n - ") + string(comboDetector->itemText(i).toAscii().constData()) ; path = det->getFilePath(); } if(det->setFilePath(path).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); + mess. append(detName); error = true; - }else if(!qDefs::checkErrorMessage(det).empty()){ + }else if(!qDefs::checkErrorMessage(det,false).empty()){ + mess. append(detName); error = true; } + /* //verify all paths are the same for no receiver if ((!receiver) && (path != det->getFilePath())){ error = true; - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output"); - } + qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output Verify"); + }*/ myDet->setFilePath(det->getFilePath()); } @@ -711,12 +714,19 @@ int qTabDataOutput::VerifyOutputDirectory(){ #ifdef VERBOSE cout << "The output path doesnt exist anymore" << endl; #endif + //replace all \n with
+ pos = 0; + while((pos = mess.find("\n", pos)) != string::npos){ + mess.replace(pos, 1, "
"); + pos += 1; + } + qDefs::Message(qDefs::WARNING,string("Invalid Output Directory ")+ mess,"Data Output"); dispReadOutputDir->setPalette(*red1); boxOutDir->setPalette(red); errTip = errTip + QString("
" - "Enter a valid path for ") + QString(detName.c_str()) + - QString( " readout to change Output Directory."); + "Invalid Output Directory") + QString(mess.c_str()) + + QString( "."); boxOutDir->setToolTip(errTip); if(receiver) @@ -757,7 +767,7 @@ void qTabDataOutput::SetOutputDir(){ #endif bool error = false; - bool receiver = (!comboDetector->itemText(0).compare("All")); + bool receiver = (comboDetector->itemText(0).compare("All")); QString path = dispOutputDir->text(); if(path.isEmpty()) @@ -793,9 +803,8 @@ void qTabDataOutput::SetOutputDir(){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet); if(det->setFilePath(string(path.toAscii().constData())).empty()){ - qDefs::Message(qDefs::WARNING,string("Enter a valid output directory "),"Data Output"); error = true; - }else if(!qDefs::checkErrorMessage(det).empty()){ + }else if(!qDefs::checkErrorMessage(det,false).empty()){ error = true; } myDet->setFilePath(det->getFilePath()); @@ -803,6 +812,7 @@ void qTabDataOutput::SetOutputDir(){ if(error){ + qDefs::Message(qDefs::WARNING,string("Invalid output directory "),"Data Output set"); for(int i=0;igetNumberOfDetectors();i++){ slsDetector *det = myDet->getSlsDetector(i); qDefs::checkErrorMessage(myDet);