mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 19:15:54 +01:00
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:
@@ -15,6 +15,7 @@
|
|||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QAbstractButton>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class qDefs:public QWidget{
|
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 int Message(MessageIndex index, string message,string source)
|
||||||
{
|
{
|
||||||
static QMessageBox* msgBox;
|
static QMessageBox* msgBox;
|
||||||
|
|
||||||
|
message.append(string("<p style=\"font-size:10px;color:grey;\">Source: ") + source + string("</p>"));
|
||||||
|
|
||||||
switch(index){
|
switch(index){
|
||||||
case WARNING:
|
case WARNING:
|
||||||
source.insert(0,"WARNING: #<b>");
|
msgBox= new QMessageBox(QMessageBox::Warning,"WARNING",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||||
msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
|
|
||||||
break;
|
break;
|
||||||
case CRITICAL:
|
case CRITICAL:
|
||||||
source.insert(0,"CRITICAL: #<b>");
|
msgBox= new QMessageBox(QMessageBox::Critical,"CRITICAL",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||||
msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
|
|
||||||
break;
|
break;
|
||||||
case INFORMATION:
|
case INFORMATION:
|
||||||
source.insert(0,"INFORMATION: #<b>");
|
msgBox= new QMessageBox(QMessageBox::Information,"INFORMATION",tr(message.c_str()),QMessageBox::Ok, msgBox);
|
||||||
msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
source.insert(0,"QUESTION: #<b>");
|
msgBox= new QMessageBox(QMessageBox::Question,"QUESTION",tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
|
||||||
msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
|
|
||||||
break;
|
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;
|
if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/** range of x and y axes
|
/** range of x and y axes
|
||||||
@@ -194,7 +194,6 @@ static const int64_t GUI_VERSION=0x20121213;
|
|||||||
retval = myDet->getErrorMessage(errorLevel);
|
retval = myDet->getErrorMessage(errorLevel);
|
||||||
|
|
||||||
if(!retval.empty()){
|
if(!retval.empty()){
|
||||||
|
|
||||||
//replace all \n with <br>
|
//replace all \n with <br>
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while((pos = retval.find("\n", pos)) != string::npos){
|
while((pos = retval.find("\n", pos)) != string::npos){
|
||||||
@@ -202,6 +201,10 @@ static const int64_t GUI_VERSION=0x20121213;
|
|||||||
pos += 1;
|
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.insert(0,"<font color=\"darkBlue\">");
|
||||||
retval.append("</font></nobr>");
|
retval.append("</font></nobr>");
|
||||||
|
|
||||||
@@ -233,7 +236,6 @@ static const int64_t GUI_VERSION=0x20121213;
|
|||||||
retval = myDet->getErrorMessage(emask);
|
retval = myDet->getErrorMessage(emask);
|
||||||
|
|
||||||
if(!retval.empty()){
|
if(!retval.empty()){
|
||||||
|
|
||||||
//replace all \n with <br>
|
//replace all \n with <br>
|
||||||
pos = 0;
|
pos = 0;
|
||||||
while((pos = retval.find("\n", pos)) != string::npos){
|
while((pos = retval.find("\n", pos)) != string::npos){
|
||||||
@@ -241,6 +243,10 @@ static const int64_t GUI_VERSION=0x20121213;
|
|||||||
pos += 1;
|
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.insert(0,"<font color=\"darkBlue\">");
|
||||||
retval.append("</font></nobr>");
|
retval.append("</font></nobr>");
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ void qDetectorMain::LoadConfigFile(const string fName){
|
|||||||
else{
|
else{
|
||||||
//could not load config file
|
//could not load config file
|
||||||
if(myDet->readConfigurationFile(fName)==slsDetectorDefs::FAIL)
|
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
|
//successful
|
||||||
else
|
else
|
||||||
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","qDetectorMain::LoadConfigFile");
|
qDefs::Message(qDefs::INFORMATION,"<nobr>The Configuration Parameters have been loaded successfully at start up.</nobr>","qDetectorMain::LoadConfigFile");
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ void qTabMessages::customEvent(QEvent *e) {
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qTabMessages::SaveLog() {
|
void qTabMessages::SaveLog() {
|
||||||
//cerr<<endl<<"ERRRORRRR"<<endl<<endl;
|
|
||||||
QString fName = QString(myMainTab->GetFilePath());
|
QString fName = QString(myMainTab->GetFilePath());
|
||||||
fName = fName+"/LogFile.txt";
|
fName = fName+"/LogFile.txt";
|
||||||
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),
|
||||||
|
|||||||
Reference in New Issue
Block a user