#include "TQRootApplication.h"
#include "TSystem.h"
#include <stdlib.h>
bool TQRootApplication::fgDebug=kFALSE;
bool TQRootApplication::fgWarning=kFALSE;
ClassImp(TQRootApplication)
void qMessageOutput( QtMsgType type, const char *msg )
{
switch ( type ) {
case QtDebugMsg:
if(TQRootApplication::fgDebug)
fprintf( stderr, "QtRoot-Debug: \n %s\n", msg );
break;
case QtWarningMsg:
if(TQRootApplication::fgWarning)
fprintf( stderr, "QtRoot-Warning: \n %s\n", msg );
break;
case QtFatalMsg:
fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
abort();
break;
case QtCriticalMsg:
fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
abort();
break;
}
}
TQRootApplication::TQRootApplication(int &argc, char **argv, int poll) :
QApplication(argc,argv), fQTimer(0), fRTimer(0)
{
if (poll == 0) {
fQTimer = new QTimer( this );
QObject::connect( fQTimer, SIGNAL(timeout()),this, SLOT(Execute()) );
fQTimer->start( 20, FALSE );
fRTimer = new TTimer(20);
fRTimer->Start(20, kFALSE);
}
fgWarning = fgDebug = kFALSE;
qInstallMsgHandler( qMessageOutput );
}
TQRootApplication::~TQRootApplication()
{
}
void TQRootApplication::Execute()
{
gSystem->InnerLoop();
}
void TQRootApplication::Quit()
{
gSystem->Exit( 0 );
}