TQRootApplication.cxx

Go to the documentation of this file.
00001 // @(#)root/qtgsi:$Id: TQRootApplication.cxx 33896 2010-06-15 08:02:13Z bellenot $
00002 // Author: Denis Bertini, M. Al-Turany  01/11/2000
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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();         // dump core on purpose
00037          break;
00038       case QtCriticalMsg:
00039          fprintf( stderr, "QtRoot-Fatal: \n %s\n", msg );
00040          abort();         // dump core on purpose
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    // Connect ROOT via Timer call back.
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    // install a msg-handler
00060    fgWarning = fgDebug = kFALSE;
00061    qInstallMsgHandler( qMessageOutput );
00062 }
00063 
00064 //______________________________________________________________________________
00065 TQRootApplication::~TQRootApplication()
00066 {
00067    // dtor
00068 }
00069 
00070 //______________________________________________________________________________
00071 void TQRootApplication::Execute()
00072 {
00073    // Call the inner loop of ROOT.
00074 
00075    gSystem->InnerLoop();
00076 }
00077 
00078 //______________________________________________________________________________
00079 void TQRootApplication::Quit()
00080 {
00081    // Set a Qt-Specific error handler.
00082 
00083    gSystem->Exit( 0 );
00084 }

Generated on Tue Jul 5 14:22:20 2011 for ROOT_528-00b_version by  doxygen 1.5.1