messages capture config output, still to find a way to capture all cerr output

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@95 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d
2012-10-16 08:29:44 +00:00
parent 863662a5eb
commit e104b1d529
6 changed files with 45 additions and 17 deletions

View File

@ -64,8 +64,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app, QWidget *
}
setupUi(this);
SetUpDetector(configFName);
SetUpWidgetWindow();
SetUpWidgetWindow(configFName);
Initialization();
}
@ -84,21 +83,29 @@ qDetectorMain::~qDetectorMain(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDetectorMain::SetUpWidgetWindow(){
void qDetectorMain::SetUpWidgetWindow(const string fName){
// Layout
layoutTabs= new QGridLayout;
centralwidget->setLayout(layoutTabs);
// plot setup
myPlot = new qDrawPlot(dockWidgetPlot,myDet);cout<<"DockPlot ready"<<endl;
dockWidgetPlot->setWidget(myPlot);
//tabs setup
tabs = new MyTabWidget(this);
layoutTabs->addWidget(tabs);
// creating all the tab widgets
tab_messages = new qTabMessages (this, myDet); cout<<"Messages ready"<<endl;
// creating the messages tab before the plots and detector to catch config stdout
tab_messages = new qTabMessages (this); cout<<"Messages ready"<<endl;
// settings up detector
SetUpDetector(fName);
// plot setup
myPlot = new qDrawPlot(dockWidgetPlot,myDet);cout<<"DockPlot ready"<<endl;
dockWidgetPlot->setWidget(myPlot);
//settings messages to have the det reference
tab_messages->SetDetectorReference(myDet);
// creating all the other tab widgets
tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<<endl;
tab_dataoutput = new qTabDataOutput (this, myDet); cout<<"DataOutput ready"<<endl;
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
@ -132,6 +139,7 @@ void qDetectorMain::SetUpWidgetWindow(){
tabs->insertTab(Developer, scroll[Developer], "Developer");
// Prefer this to expand and not have scroll buttons
tabs->insertTab(Messages, tab_messages, "Messages");
// Default tab color
defaultTabColor = tabs->tabBar()->tabTextColor(DataOutput);
//Set the current tab(measurement) to blue as it is the current one
@ -267,7 +275,7 @@ void qDetectorMain::Initialization(){
void qDetectorMain::LoadConfigFile(const string fName){
#ifdef VERBOSe
#ifdef VERBOSE
cout << "Loading config file at start up:" << fName << endl;
#endif
QString file = QString(fName.c_str());//.section('/',-1);

View File

@ -16,6 +16,8 @@
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
/** C++ Include Headers */
#include <iostream>
#include <string>
@ -23,7 +25,7 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
qTabMessages::qTabMessages(QWidget *parent):QWidget(parent),myDet(0){
SetupWidgetWindow();
Initialization();
}
@ -33,6 +35,7 @@ qTabMessages::qTabMessages(QWidget *parent,multiSlsDetector*& detector):QWidget(
qTabMessages::~qTabMessages(){
delete myDet;
delete dispLog;
delete qout;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -62,7 +65,11 @@ void qTabMessages::SetupWidgetWindow(){
gridLayout->addItem(new QSpacerItem(15,10,QSizePolicy::Fixed,QSizePolicy::Fixed),2,0);
gridLayout->addWidget(dispLog,3,0,1,5);
qout=new qDebugStream(std::cout,this);
qout=new qDebugStream(cout,cerr, this);cout<<"working!"<<endl;
//qerr=new qDebugStream(cerr,this);
//qerr=NULL;
//qerr=new qDebugStream(std::cerr,this);cout<<"worked!"<<endl;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
@ -82,6 +89,7 @@ void qTabMessages::customEvent(QEvent *e) {
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabMessages::SaveLog() {
//cerr<<endl<<"ERRRORRRR"<<endl<<endl;
QString fName = QString(myDet->getFilePath().c_str());
fName = fName+"/LogFile.txt";
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),