00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4StartClientSlots.h"
00017
00018 #include "qstatusbar.h"
00019 #include "qapplication.h"
00020 #include "qmessagebox.h"
00021
00022 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00023 #include "Go4Display/TGo4Display.h"
00024
00025 #include "Go4CommandsBase/TGo4Command.h"
00026 #include "Go4CommandsTaskHandler/TGo4ComConnectSlave.h"
00027 #include "TGo4StartClientStatus.h"
00028 #include "TGo4StartClient.h"
00029 #include "TGo4MainWindow.h"
00030
00031 TGo4StartClientSlots::TGo4StartClientSlots(const char * name, const char * title, TGo4StartClient * p)
00032 :TGo4SlotsBaseClass(name , title)
00033 {
00034
00035 fxTGo4StartClient = p;
00036 fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00037 fxTGo4StartClientStatus= new TGo4StartClientStatus("TGo4StartClientStatus", "Test Status 1");
00038 fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4StartClientStatus, p);
00039
00040 }
00041 TGo4Status * TGo4StartClientSlots::GetStatus()
00042 {
00043 return fxTGo4StartClientStatus;
00044 }
00045 void TGo4StartClientSlots::SetGUI(TGo4StartClient *GUI )
00046 {
00047 fxTGo4StartClient=GUI;
00048 fxTGo4GUIRegistry->GuiIsChanged(this, GUI);
00049 }
00050
00051 void TGo4StartClientSlots::StartClient(const char* Name,
00052 const char* Node,
00053 const char* Dir,
00054 const char* Executable,
00055 UInt_t port,
00056 Bool_t startserver)
00057 {
00058
00059 TGo4Display *fxDisplay=fxTGo4GUIRegistry->GetDisplay();
00060 if(!fxDisplay->IsConnected())
00061 {
00062 TGo4ComConnectSlave *com = new TGo4ComConnectSlave();
00063 com->SetSlaveName(Name);
00064 com->SetSlaveHost(Node);
00065 com->SetSlaveDir(Dir);
00066 com->SetSlaveExecutable(Executable);
00067 com->SetSlavePort(port);
00068 com->SetStartServer(startserver);
00069 com->SetLogin((Go4CommandMode_t) fxTGo4StartClientStatus->GetLoginMode());
00070 com->SetPassword(fxTGo4StartClientStatus->GetPasswd());
00071 Int_t Mode = fxTGo4StartClientStatus->GetSlaveMode();
00072 Int_t Shell = fxTGo4StartClientStatus->GetSlaveShell();
00073
00074 if(Mode==1 && Shell==1){
00075 com->SetSlaveMode(TGo4ServerTask::kGuiEmbed);
00076 }else if (Mode==1 && Shell ==2) {
00077 com->SetSlaveMode(0);
00078 }else if(Mode==2 && Shell==1){
00079 com->SetSlaveMode(TGo4ServerTask::kSecureShell+TGo4ServerTask::kGuiEmbed);
00080 }else if (Mode==2 && Shell ==2) {
00081 com->SetSlaveMode(TGo4ServerTask::kSecureShell);
00082 }
00083
00084
00085 fxTGo4GUIRegistry->SetAnalysisReady(kFALSE);
00086 fxTGo4GUIRegistry->SubmitCommand(com);
00087
00088 TGo4MainWindow *MW= (TGo4MainWindow *)fxTGo4GUIRegistry->GetMainWindow();
00089
00090 MW->statusBar()->message("Starting Analysis Slave.... Please wait");
00091
00092 MW->AnalysisConfigAppearance(1);
00093
00094
00095
00096 }
00097 else
00098 {
00099 QMessageBox::warning( fxTGo4StartClient, "Slave is already connected", "Slave is already connected" );
00100 }
00101 }
00102
00103 TGo4StartClientSlots::~TGo4StartClientSlots()
00104 {
00105 delete fxTGo4StartClientStatus;
00106 }
00107
00108