00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "TQRootApplication.h"
00014 #include "TSystem.h"
00015 #include <stdlib.h>
00016
00017 bool TQRootApplication::fgDebug=kFALSE;
00018 bool TQRootApplication::fgWarning=kFALSE;
00019
00020 ClassImp(TQRootApplication)
00021
00022
00023 void qMessageOutput( QtMsgType type, const char *msg )
00024 {
00025 switch ( type ) {
00026 case QtDebugMsg:
00027 if(TQRootApplication::fgDebug)
00028 fprintf( stderr, "QtRoot-Debug: \n %s\n", msg );
00029 break;
00030 case QtWarningMsg:
00031 if(TQRootApplication::fgWarning)
00032 fprintf( stderr, "QtRoot-Warning: \n %s\n", msg );
00033 break;
00034 case QtFatalMsg:
00035 fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
00036 abort();
00037 break;
00038 case QtCriticalMsg:
00039 fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
00040 abort();
00041 break;
00042 }
00043 }
00044
00045
00046 TQRootApplication::TQRootApplication(int &argc, char **argv, int poll) :
00047 QApplication(argc,argv), fQTimer(0), fRTimer(0)
00048 {
00049
00050
00051 if (poll == 0) {
00052 fQTimer = new QTimer( this );
00053 QObject::connect( fQTimer, SIGNAL(timeout()),this, SLOT(Execute()) );
00054 fQTimer->start( 20, FALSE );
00055 fRTimer = new TTimer(20);
00056 fRTimer->Start(20, kFALSE);
00057 }
00058
00059
00060 fgWarning = fgDebug = kFALSE;
00061 qInstallMsgHandler( qMessageOutput );
00062 }
00063
00064
00065 TQRootApplication::~TQRootApplication()
00066 {
00067
00068 }
00069
00070
00071 void TQRootApplication::Execute()
00072 {
00073
00074
00075 gSystem->InnerLoop();
00076 }
00077
00078
00079 void TQRootApplication::Quit()
00080 {
00081
00082
00083 gSystem->Exit( 0 );
00084 }