mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-15 14:27:13 +02:00
change outdir for non receivers in gui
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@207 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -669,83 +669,81 @@ int qTabDataOutput::VerifyOutputDirectory(){
|
|||||||
cout << "Verifying output directory" << endl;
|
cout << "Verifying output directory" << endl;
|
||||||
#endif
|
#endif
|
||||||
bool error = false;
|
bool error = false;
|
||||||
QString path = "";
|
|
||||||
QString errTip = outDirTip;
|
QString errTip = outDirTip;
|
||||||
QString detName = "";
|
bool receiver = (!comboDetector->itemText(0).compare("All"));
|
||||||
|
string path = string(dispReadOutputDir->text().toAscii().constData());
|
||||||
|
string detName = "";
|
||||||
|
|
||||||
path = dispReadOutputDir->text();
|
//for each detector
|
||||||
|
for(int i=0;i<myDet->getNumberOfDetectors();i++){
|
||||||
//no receiver
|
slsDetector *det = myDet->getSlsDetector(i);
|
||||||
if(!comboDetector->itemText(0).compare("All")){
|
qDefs::checkErrorMessage(myDet);
|
||||||
if(myDet->setFilePath(string(path.toAscii().constData())).empty()){
|
if(receiver){
|
||||||
qDefs::Message(qDefs::WARNING,string("Enter a valid output directory"),"Data Output");
|
detName = string(" for ") + string(comboDetector->itemText(i).toAscii().constData()) + string(" readout");
|
||||||
error = true;
|
path = det->getFilePath();
|
||||||
dispReadOutputDir->setText(QString(myDet->getFilePath().c_str()));
|
|
||||||
boxOutDir->setTitle("Receiver Output Directory*");
|
|
||||||
}else if(!qDefs::checkErrorMessage(myDet).empty()){
|
|
||||||
error = true;
|
|
||||||
dispReadOutputDir->setText(QString(myDet->getFilePath().c_str()));
|
|
||||||
dispReadOutputDir->setPalette(*red1);
|
|
||||||
boxOutDir->setPalette(red);
|
|
||||||
boxOutDir->setTitle("Output Directory*");
|
|
||||||
errTip = outDirTip +
|
|
||||||
QString("<nobr><font color=\"red\">"
|
|
||||||
"Enter a valid path to change <b>Output Directory</b>.</font></nobr>");
|
|
||||||
boxOutDir->setToolTip(errTip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(det->setFilePath(path).empty()){
|
||||||
|
qDefs::Message(qDefs::WARNING,string("Enter a valid output directory ") + detName,"Data Output");
|
||||||
|
error = true;
|
||||||
|
}else if(!qDefs::checkErrorMessage(det).empty()){
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
myDet->setFilePath(det->getFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
//receiver
|
|
||||||
else{
|
//set the read output dir anyway
|
||||||
for(int i=0;i<myDet->getNumberOfDetectors();i++){
|
if(receiver)
|
||||||
detName = comboDetector->itemText(i);
|
path = myDet->getSlsDetector(comboDetector->currentIndex())->getFilePath();
|
||||||
slsDetector *det = myDet->getSlsDetector(i);
|
else
|
||||||
qDefs::checkErrorMessage(myDet);
|
path = myDet->getFilePath();
|
||||||
if(det->setFilePath(det->getFilePath()).empty()){
|
dispReadOutputDir->setText(QString(path.c_str()));
|
||||||
qDefs::Message(qDefs::WARNING,string("Enter a valid output directory for ") +
|
|
||||||
string(detName.toAscii().constData()) + string(" readout"),"Data Output");
|
|
||||||
error = true;
|
|
||||||
dispReadOutputDir->setText(QString(det->getFilePath().c_str()));
|
|
||||||
boxOutDir->setTitle("Receiver Output Directory*");
|
|
||||||
}else if(!qDefs::checkErrorMessage(det).empty()){
|
|
||||||
error = true;
|
|
||||||
dispReadOutputDir->setText(QString(det->getFilePath().c_str()));
|
|
||||||
boxOutDir->setTitle("Receiver Output Directory*");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if error, display in red
|
//if error, display in red
|
||||||
if(error){
|
if(error){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "The output path doesnt exist anymore" << endl;
|
cout << "The output path doesnt exist anymore" << endl;
|
||||||
#endif
|
#endif
|
||||||
dispReadOutputDir->setPalette(*red1);
|
dispReadOutputDir->setPalette(*red1);
|
||||||
boxOutDir->setPalette(red);
|
boxOutDir->setPalette(red);
|
||||||
errTip = errTip +
|
errTip = errTip +
|
||||||
QString("<br><nobr><font color=\"red\">"
|
QString("<br><nobr><font color=\"red\">"
|
||||||
"Enter a valid path for ") + detName +
|
"Enter a valid path for ") + QString(detName.c_str()) +
|
||||||
QString( " readout to change <b>Output Directory</b>.</font></nobr>");
|
QString( " readout to change <b>Output Directory</b>.</font></nobr>");
|
||||||
boxOutDir->setToolTip(errTip);
|
boxOutDir->setToolTip(errTip);
|
||||||
|
|
||||||
|
if(receiver)
|
||||||
|
boxOutDir->setTitle("Receiver Output Directory*");
|
||||||
|
else
|
||||||
|
boxOutDir->setTitle("Output Directory*");
|
||||||
|
|
||||||
return slsDetectorDefs::FAIL;
|
return slsDetectorDefs::FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//no error
|
//no error
|
||||||
else{
|
else{
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "The output path has been verified" << endl;
|
cout << "The output path has been verified" << endl;
|
||||||
#endif
|
#endif
|
||||||
dispReadOutputDir->setPalette(*black1);
|
dispReadOutputDir->setPalette(*black1);
|
||||||
boxOutDir->setPalette(black);
|
boxOutDir->setPalette(black);
|
||||||
if(!comboDetector->itemText(0).compare("All"))
|
|
||||||
boxOutDir->setTitle("Output Directory");
|
|
||||||
else
|
|
||||||
boxOutDir->setTitle("Receiver Output Directory");
|
|
||||||
boxOutDir->setToolTip(outDirTip);
|
boxOutDir->setToolTip(outDirTip);
|
||||||
|
|
||||||
|
if(receiver)
|
||||||
|
boxOutDir->setTitle("Receiver Output Directory");
|
||||||
|
else
|
||||||
|
boxOutDir->setTitle("Output Directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
return slsDetectorDefs::OK;
|
return slsDetectorDefs::OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -759,6 +757,7 @@ void qTabDataOutput::SetOutputDir(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
bool receiver = (!comboDetector->itemText(0).compare("All"));
|
||||||
QString path = dispOutputDir->text();
|
QString path = dispOutputDir->text();
|
||||||
|
|
||||||
if(path.isEmpty())
|
if(path.isEmpty())
|
||||||
@ -766,42 +765,64 @@ void qTabDataOutput::SetOutputDir(){
|
|||||||
|
|
||||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||||
|
|
||||||
|
|
||||||
//gets rid of the end '/'s
|
//gets rid of the end '/'s
|
||||||
while(path.endsWith('/')) path.chop(1);
|
while(path.endsWith('/')) path.chop(1);
|
||||||
dispOutputDir->setText(path);
|
dispOutputDir->setText(path);
|
||||||
|
|
||||||
if(!comboDetector->itemText(0).compare("All")){
|
|
||||||
myDet->setFilePath(string(dispOutputDir->text().toAscii().constData()));
|
if(receiver){
|
||||||
if(!qDefs::checkErrorMessage(myDet).empty()){
|
slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex());
|
||||||
|
qDefs::checkErrorMessage(myDet);
|
||||||
|
det->setFilePath(string(dispOutputDir->text().toAscii().constData()));
|
||||||
|
if(!qDefs::checkErrorMessage(det).empty()){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "The output path could not be set" << endl;
|
cout << "The output path could not be set" << endl;
|
||||||
#endif
|
#endif
|
||||||
myDet->setFilePath(string(dispReadOutputDir->text().toAscii().constData()));
|
det->setFilePath(string(dispReadOutputDir->text().toAscii().constData()));
|
||||||
error = true;
|
error = true;
|
||||||
dispOutputDir->setPalette(*red1);
|
dispOutputDir->setPalette(*red1);
|
||||||
}
|
}
|
||||||
|
myDet->setFilePath(det->getFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else{
|
else{
|
||||||
slsDetector *det = myDet->getSlsDetector(comboDetector->currentIndex());
|
//for each detector
|
||||||
|
for(int i=0;i<myDet->getNumberOfDetectors();i++){
|
||||||
|
slsDetector *det = myDet->getSlsDetector(i);
|
||||||
qDefs::checkErrorMessage(myDet);
|
qDefs::checkErrorMessage(myDet);
|
||||||
det->setFilePath(string(dispOutputDir->text().toAscii().constData()));
|
if(det->setFilePath(string(path.toAscii().constData())).empty()){
|
||||||
if(!qDefs::checkErrorMessage(det).empty()){
|
qDefs::Message(qDefs::WARNING,string("Enter a valid output directory "),"Data Output");
|
||||||
#ifdef VERBOSE
|
error = true;
|
||||||
cout << "The output path could not be set" << endl;
|
}else if(!qDefs::checkErrorMessage(det).empty()){
|
||||||
#endif
|
|
||||||
det->setFilePath(string(dispReadOutputDir->text().toAscii().constData()));
|
|
||||||
error = true;
|
error = true;
|
||||||
dispOutputDir->setPalette(*red1);
|
|
||||||
}
|
}
|
||||||
|
myDet->setFilePath(det->getFilePath());
|
||||||
|
}
|
||||||
|
|
||||||
cout<<"filepath:"<<det->getFilePath()<<endl;
|
|
||||||
|
if(error){
|
||||||
|
for(int i=0;i<myDet->getNumberOfDetectors();i++){
|
||||||
|
slsDetector *det = myDet->getSlsDetector(i);
|
||||||
|
qDefs::checkErrorMessage(myDet);
|
||||||
|
det->setFilePath(string(dispReadOutputDir->text().toAscii().constData()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispReadOutputDir->setText(QString(myDet->getFilePath().c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!error){
|
|
||||||
|
if(error){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "The output path has been modified" << endl;
|
cout << "The output path could not be set" << endl;
|
||||||
|
#endif
|
||||||
|
dispOutputDir->setPalette(*red1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "The output path has been modified" << endl;
|
||||||
#endif
|
#endif
|
||||||
dispOutputDir->setPalette(*black1);
|
dispOutputDir->setPalette(*black1);
|
||||||
dispReadOutputDir->setText(dispOutputDir->text());
|
dispReadOutputDir->setText(dispOutputDir->text());
|
||||||
@ -809,6 +830,7 @@ void qTabDataOutput::SetOutputDir(){
|
|||||||
VerifyOutputDirectory();
|
VerifyOutputDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user