00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "TGo4AnalysisConfigurationSlots.h" 00017 00018 #include <iostream.h> 00019 00020 #include "qlineedit.h" 00021 #include "qstatusbar.h" 00022 #include "qapplication.h" 00023 00024 #include "Go4LockGuard/TGo4LockGuard.h" 00025 #include "Go4Analysis/TGo4AnalysisStatus.h" 00026 #include "Go4CommandsAnalysis/TGo4ComSetAnalysisStatus.h" 00027 #include "Go4CommandsAnalysis/TGo4ComLoadAnalysisStatus.h" 00028 #include "Go4CommandsAnalysis/TGo4ComSaveAnalysisStatus.h" 00029 #include "Go4CommandsAnalysis/TGo4ComAutosave.h" 00030 #include "Go4GUIRegistry/TGo4GUIRegistry.h" 00031 #include "TGo4AnalysisConfigurationStatus.h" 00032 #include "TGo4AnalysisConfiguration.h" 00033 #include "TGo4MainWindow.h" 00034 00035 TGo4AnalysisConfigurationSlots::TGo4AnalysisConfigurationSlots(const char* Name, const char* Title, TGo4AnalysisConfiguration * p) 00036 :TGo4SlotsBaseClass(Name , Title), fxTGo4AnalysisConfiguration(p) , fbFirstStart(kTRUE) 00037 { 00038 TGo4LockGuard Global; 00039 fxTGo4GUIRegistry = TGo4GUIRegistry::Instance(); 00040 fxTGo4AnalysisConfigurationStatus= new TGo4AnalysisConfigurationStatus("TGo4AnalysisConfigurationStatus", "Configuration Status"); 00041 fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4AnalysisConfigurationStatus, p); 00042 NoOfAnalysisSteps=0; 00043 fxTGo4GUIRegistry->SetDisplayAnalysisConfig(this); 00044 } 00045 00046 TGo4AnalysisConfigurationSlots::~TGo4AnalysisConfigurationSlots(){} 00047 00048 00049 00050 TGo4Status * TGo4AnalysisConfigurationSlots::GetStatus() 00051 { 00052 return fxTGo4AnalysisConfigurationStatus; 00053 } 00054 void TGo4AnalysisConfigurationSlots::SetGUI(TGo4AnalysisConfiguration *GUI ) 00055 { 00056 fxTGo4AnalysisConfiguration=GUI; 00057 fxTGo4GUIRegistry->GuiIsChanged(this, GUI); 00058 } 00059 int TGo4AnalysisConfigurationSlots::GetNoOfSteps() 00060 { 00061 return NoOfAnalysisSteps; 00062 } 00063 00064 void TGo4AnalysisConfigurationSlots::StatusChanged(TGo4Status *status) 00065 { 00066 TGo4LockGuard Global; 00067 if(status!=0) { 00068 TGo4AnalysisStatus *fxTGo4AnalysisStatus; 00069 fxTGo4AnalysisStatus=dynamic_cast<TGo4AnalysisStatus *> (status->Clone()); 00070 if(fxTGo4AnalysisStatus!=0) { 00071 fxTGo4AnalysisConfigurationStatus->SetAnaylsisStatus(fxTGo4AnalysisStatus); 00072 fxTGo4AnalysisStatus->ResetStepIterator(); 00073 while(fxTGo4AnalysisStatus->NextStepStatus()!=0){ 00074 NoOfAnalysisSteps+=1; 00075 } 00076 00077 if (fxTGo4AnalysisConfiguration!=0) 00078 delete fxTGo4AnalysisConfiguration; 00079 00080 TGo4MainWindow *MW = (TGo4MainWindow *)fxTGo4GUIRegistry->GetMainWindow(); 00081 //MW->AnalysisConfigSlot(); 00082 MW->AnalysisConfigAppearance(2); 00083 QApplication::restoreOverrideCursor(); 00084 if(fbFirstStart) 00085 MW->statusBar()->message("Editing Analysis configuration.... after editing press SUBMIT to send the configuration to the analysis"); 00086 fbFirstStart=kFALSE; 00087 00088 // TGo4RemoteBrowserSlots *fxRemote= (TGo4RemoteBrowserSlots *)fxTGo4GUIRegistry->GetSlotClass("TGo4RemoteBrowserSlots"); 00089 // if (fxRemote) fxRemote->Refresh(kTRUE); 00090 } 00091 } 00092 } 00093 00094 void TGo4AnalysisConfigurationSlots::ClearAll() 00095 { 00096 00097 } 00098 00099 void TGo4AnalysisConfigurationSlots::SaveConfiguration() 00100 { 00101 // TGo4LockGuard Global; 00102 SaveConfFile((const char *)fxTGo4AnalysisConfiguration->ConfigFileName->text()); 00103 } 00104 00105 void TGo4AnalysisConfigurationSlots::LoadConfiguration() 00106 { 00107 // TGo4LockGuard Global; 00108 LoadConfFile((const char *)fxTGo4AnalysisConfiguration->ConfigFileName->text()); 00109 00110 } 00111 00112 void TGo4AnalysisConfigurationSlots::SubmitConfiguration() 00113 { 00114 TGo4LockGuard Global; 00115 fxTGo4GUIRegistry->SetAnaSettingsReady(kFALSE); 00116 TGo4ComSetAnalysisStatus *com = new TGo4ComSetAnalysisStatus(fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus()); 00117 fxTGo4GUIRegistry->SubmitCommand(com); 00118 fxTGo4GUIRegistry->SubmitCommand("ANInit"); 00119 QApplication::restoreOverrideCursor(); 00120 QMainWindow *MW= (QMainWindow *)fxTGo4GUIRegistry->GetMainWindow(); 00121 MW->statusBar()->message("Press Ctrl+S or choose Analysis->Start from the Menu to start the analysis"); 00122 00123 } 00124 void TGo4AnalysisConfigurationSlots::LoadConfFile(const char *fileName) 00125 { 00126 TGo4LockGuard Global; 00127 if(fileName==0){ 00128 fxTGo4GUIRegistry->SubmitCommand("ANLoad"); 00129 }else{ 00130 TGo4ComLoadAnalysisStatus *com = new TGo4ComLoadAnalysisStatus(fileName); 00131 fxTGo4GUIRegistry->SubmitCommand(com); 00132 } 00133 GetActiveConf(); 00134 } 00135 00136 void TGo4AnalysisConfigurationSlots::SaveConfFile(const char * fileName) 00137 { 00138 TGo4LockGuard Global; 00139 if(fileName==0){ 00140 fxTGo4GUIRegistry->SubmitCommand("ANSave"); 00141 }else{ 00142 TGo4ComSaveAnalysisStatus *com = new TGo4ComSaveAnalysisStatus(fileName); 00143 fxTGo4GUIRegistry->SubmitCommand(com); 00144 } 00145 } 00146 void TGo4AnalysisConfigurationSlots::AutoSaveFile(const char * fileName) 00147 { 00148 // TGo4LockGuard Global; 00149 TGo4AnalysisStatus *fxTGo4AnalysisStatus; 00150 fxTGo4AnalysisStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00151 fxTGo4AnalysisStatus->SetAutoFileName(fileName); 00152 } 00153 void TGo4AnalysisConfigurationSlots::SetCompressionLevel(int t) 00154 { 00155 // TGo4LockGuard Global; 00156 TGo4AnalysisStatus *fxTGo4AnalysisStatus; 00157 fxTGo4AnalysisStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00158 fxTGo4AnalysisStatus->SetAutoSaveCompression(t); 00159 } 00160 void TGo4AnalysisConfigurationSlots::GetActiveConf() 00161 { 00162 // TGo4LockGuard Global; 00163 fxTGo4GUIRegistry->SubmitCommand("ANGetStatus"); 00164 } 00165 00166 void TGo4AnalysisConfigurationSlots::SetAutoSaveInterval(int t) 00167 { 00168 TGo4AnalysisStatus *fxTGo4AnalysisStatus; 00169 fxTGo4AnalysisStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00170 fxTGo4AnalysisStatus->SetAutoSaveInterval(t); 00171 } 00172 00173 void TGo4AnalysisConfigurationSlots::SetAutoSaveOverwrite(bool Overwrite) 00174 { 00175 // TGo4LockGuard Global; 00176 TGo4AnalysisStatus *fxTGo4AnalysisStatus; 00177 fxTGo4AnalysisStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00178 if(Overwrite)fxTGo4AnalysisStatus->SetAutoSaveOverwrite(kTRUE); 00179 else fxTGo4AnalysisStatus->SetAutoSaveOverwrite(kFALSE); 00180 // cout << "TGo4AnalysisConfigurationSlots " << fxTGo4AnalysisStatus->IsAutoSaveOverwrite() << endl; 00181 00182 } 00183 00184 void TGo4AnalysisConfigurationSlots::SetAutoSaveOn(bool on) 00185 { 00186 TGo4AnalysisStatus * analysisStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00187 analysisStatus->SetAutoSaveOn(on); 00188 00189 //cout << "TGo4AnalysisConfigurationSlots " << analysisStatus->IsAutoSaveOn() << endl; 00190 00191 } 00192 00193 00194 void TGo4AnalysisConfigurationSlots::WriteAutoSave() 00195 { 00196 TGo4AnalysisStatus *fxStatus=fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus(); 00197 TGo4ComAutosave *com= new TGo4ComAutosave(); 00198 com->SetAutoFileName(fxStatus->GetAutoFileName()); 00199 com->SetAutoSaveCompression(fxStatus->GetAutoSaveCompression()); 00200 com->SetAutoSaveOverwrite(fxStatus->IsAutoSaveOverwrite()); 00201 fxTGo4GUIRegistry->SubmitCommand(com); 00202 } 00203 00204 00205 00206 00207 00208 00209 00210 00211 //----------------------------END OF GO4 SOURCE FILE ---------------------