included the error message source to debug errors because of too many slots and signals

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@215 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2013-08-05 14:57:40 +00:00
parent 4f2f7639af
commit 2c8df98bf8
3 changed files with 18 additions and 13 deletions

View File

@ -15,6 +15,7 @@
#include <ostream>
#include <iostream>
#include <QMessageBox>
#include <QAbstractButton>
using namespace std;
class qDefs:public QWidget{
@ -144,28 +145,27 @@ static const int64_t GUI_VERSION=0x20121213;
static int Message(MessageIndex index, string message,string source)
{
static QMessageBox* msgBox;
message.append(string("<p style=\"font-size:10px;color:grey;\">Source:&nbsp;&nbsp; ") + source + string("</p>"));
switch(index){
case WARNING:
source.insert(0,"WARNING: #<b>");
msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
msgBox= new QMessageBox(QMessageBox::Warning,"WARNING",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case CRITICAL:
source.insert(0,"CRITICAL: #<b>");
msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
msgBox= new QMessageBox(QMessageBox::Critical,"CRITICAL",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case INFORMATION:
source.insert(0,"INFORMATION: #<b>");
msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
msgBox= new QMessageBox(QMessageBox::Information,"INFORMATION",tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
default:
source.insert(0,"QUESTION: #<b>");
msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
msgBox= new QMessageBox(QMessageBox::Question,"QUESTION",tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
break;
}
//msgBox->setDetailedText(QString(source.c_str())); //close button doesnt work with this static function and this
if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/** range of x and y axes
@ -194,7 +194,6 @@ static const int64_t GUI_VERSION=0x20121213;
retval = myDet->getErrorMessage(errorLevel);
if(!retval.empty()){
//replace all \n with <br>
pos = 0;
while((pos = retval.find("\n", pos)) != string::npos){
@ -202,6 +201,10 @@ static const int64_t GUI_VERSION=0x20121213;
pos += 1;
}
//get rid of the last \n
if(retval.find_last_of("<br>")==retval.length()-1)
retval.erase((int)retval.find_last_of("<br>")-3,4);
retval.insert(0,"<font color=\"darkBlue\">");
retval.append("</font></nobr>");
@ -233,7 +236,6 @@ static const int64_t GUI_VERSION=0x20121213;
retval = myDet->getErrorMessage(emask);
if(!retval.empty()){
//replace all \n with <br>
pos = 0;
while((pos = retval.find("\n", pos)) != string::npos){
@ -241,6 +243,10 @@ static const int64_t GUI_VERSION=0x20121213;
pos += 1;
}
//get rid of the last \n
if(retval.find_last_of("<br>")==retval.length()-1)
retval.erase((int)retval.find_last_of("<br>")-3,4);
retval.insert(0,"<font color=\"darkBlue\">");
retval.append("</font></nobr>");

View File

@ -318,7 +318,7 @@ void qDetectorMain::LoadConfigFile(const string fName){
else{
//could not load config file
if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL)
qDefs::Message(qDefs::WARNING,string("Could not load all the Configuration Parameters from file:\n")+fName,"qDetectorMain::LoadConfigFile");
qDefs::Message(qDefs::WARNING,string("<nobr>Could not load all the Configuration Parameters from file:<br>")+fName,"qDetectorMain::LoadConfigFile");
//successful
else
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","qDetectorMain::LoadConfigFile");

View File

@ -91,7 +91,6 @@ void qTabMessages::customEvent(QEvent *e) {
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::SaveLog() {
//cerr<<endl<<"ERRRORRRR"<<endl<<endl;
QString fName = QString(myMainTab->GetFilePath());
fName = fName+"/LogFile.txt";
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),