00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4Display.h"
00017
00018 #include <iostream.h>
00019 #include <unistd.h>
00020
00021 #include "qwidget.h"
00022
00023 #include "Go4Log/TGo4Log.h"
00024 #include "Go4CommandsAnalysis/TGo4AnalysisCommandList.h"
00025 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00026 #include "Go4StatusBase/TGo4CanvasWrapper.h"
00027 #include "Go4TaskHandler/TGo4TaskManager.h"
00028 #include "TGo4DisplayDrawerTimer.h"
00029 #include "TGo4DisplayLoggerTimer.h"
00030
00031 const Long_t TGo4Display::fglDRAWTIMERPERIOD=100;
00032 const Long_t TGo4Display::fglLOGTIMERPERIOD=500;
00033
00034
00035
00036 TGo4Display::TGo4Display(UInt_t negotport, const char* hostname, Bool_t isserver)
00037 : TGo4Master("Display",
00038 isserver,
00039 hostname,
00040 negotport
00041 )
00042 {
00043
00044 fxDrawTimer= new TGo4DisplayDrawerTimer(this,fglDRAWTIMERPERIOD);
00045 fxLogTimer= new TGo4DisplayLoggerTimer(this,fglLOGTIMERPERIOD);
00046 fxDrawTimer->TurnOn();
00047 fxLogTimer->TurnOn();
00048
00049
00050 fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00051 fxTGo4GUIRegistry->SetDisplay(this);
00052 GetTask()->Launch();
00053
00054 }
00055
00056
00057 TGo4Display::~TGo4Display()
00058 {
00059 TRACE((15,"TGo4Display::~TGo4Display()", __LINE__, __FILE__));
00060
00061 if(GetTask())
00062 GetTask()->GetWorkHandler()->CancelAll();
00063 delete fxDrawTimer;
00064 delete fxLogTimer;
00065 TGo4Log::Debug(" Display Task -- deleting gui main window ");
00066 QWidget* mw=fxTGo4GUIRegistry->GetMainWindow();
00067 delete mw;
00068 TGo4Log::Debug(" Display Task -- deleting gui registry ");
00069 delete fxTGo4GUIRegistry;
00070 }
00071
00072 void TGo4Display::DisplayData(TObject* data)
00073 {
00074 TNamed* nam=dynamic_cast<TNamed*>(data);
00075 fxTGo4GUIRegistry->DisplayData(nam);
00076 }
00077
00078
00079 TGo4TaskHandlerCommandList* TGo4Display::CreateCommandList()
00080 {
00081 return ( new TGo4AnalysisCommandList());
00082
00083 }
00084
00085 void TGo4Display::DisplayLog(TGo4Status * Status)
00086 {
00087 fxTGo4GUIRegistry->DisplayLog(Status);
00088 }
00089
00090 void TGo4Display::SetSlave(const char*node, const char* shell, const char* command)
00091 {
00092 TGo4Master::SetSlave(node,shell,command);
00093 fxTGo4GUIRegistry->SetClientNode(node);
00094 fxTGo4GUIRegistry->SetClientShell(shell);
00095 fxTGo4GUIRegistry->SetClientProgram(command);
00096
00097
00098 }
00099 void TGo4Display::StartSlaveWindow(const char* command)
00100 {
00101 fxTGo4GUIRegistry->StartAnalysisWindow(command);
00102 }
00103
00104 Bool_t TGo4Display::DisconnectSlave(const char* name, Bool_t waitforslave)
00105 {
00106 fxTGo4GUIRegistry->StopMonitoring();
00107 Bool_t rev=TGo4Master::DisconnectSlave(name,waitforslave);
00108 if(rev) fxTGo4GUIRegistry->SetMasterMode(0);
00109 return rev;
00110 }
00111
00112 ClassImp(TGo4Display)
00113
00114