00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 void TGo4AnalysisConfiguration::init()
00025 {
00026 TGo4LockGuard glob;
00027 TGo4GUIRegistry *fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00028 fxTGo4AnalysisConfigurationSlots =
00029 dynamic_cast <TGo4AnalysisConfigurationSlots *>
00030 (fxTGo4GUIRegistry->GetSlotClass("TGo4AnalysisConfigurationSlots"));
00031
00032 if(fxTGo4AnalysisConfigurationSlots!=0)
00033 fxTGo4AnalysisConfigurationSlots->SetGUI(this);
00034 else
00035 fxTGo4AnalysisConfigurationSlots = new TGo4AnalysisConfigurationSlots ("TGo4AnalysisConfigurationSlots", "Slots Class for Qt GUI", this);
00036
00037 fxTGo4AnalysisConfigurationStatus =
00038 dynamic_cast<TGo4AnalysisConfigurationStatus*>
00039 (fxTGo4AnalysisConfigurationSlots->GetStatus());
00040 int NoOfSteps = fxTGo4AnalysisConfigurationSlots->GetNoOfSteps();
00041 TGo4AnalysisStatus* fxTGo4AnalysisStatus = fxTGo4AnalysisConfigurationStatus->GetAnaylsisStatus();
00042 TabSteps->removePage(tab);
00043 if (fxTGo4AnalysisStatus!=0) {
00044 fxTGo4AnalysisStatus->ResetStepIterator();
00045 for(int i=0; i<NoOfSteps; i++) {
00046 TGo4AnalysisStepStatus* fxTGo4AnalysisStepStatus = fxTGo4AnalysisStatus->NextStepStatus();
00047 if(fxTGo4AnalysisStepStatus==0) continue;
00048 QString StepName = fxTGo4AnalysisStepStatus->GetName();
00049 tab = new QWidget( TabSteps, StepName);
00050 tabLayout= new QGridLayout( tab, 1, 1, 0, -1, "tabLayout");
00051 TabSteps->insertTab( tab, trUtf8(StepName) );
00052 TGo4ConfigStep* NewStep = new TGo4ConfigStep(tab);
00053 fxStepConfigList.append(NewStep);
00054 NewStep->GetParameters(fxTGo4AnalysisStatus, fxTGo4AnalysisStepStatus, i);
00055 NewStep->SetConfigurationStatus(fxTGo4AnalysisConfigurationStatus);
00056
00057 tabLayout->addMultiCellWidget( NewStep, 0, 1, 0, 0 );
00058 }
00059 TabSteps->adjustSize();
00060
00061
00062 SetAutoSaveConfig(fxTGo4AnalysisStatus->GetAutoFileName(),
00063 fxTGo4AnalysisStatus->GetAutoSaveInterval(),
00064 fxTGo4AnalysisStatus->GetAutoSaveCompression(),
00065 fxTGo4AnalysisStatus->IsAutoSaveOn(),
00066 fxTGo4AnalysisStatus->IsAutoSaveOverwrite());
00067 SetAnalysisConfigFile(fxTGo4AnalysisStatus->GetConfigFileName());
00068 }
00069 showNormal();
00070 adjustSize();
00071 }
00072
00073 void TGo4AnalysisConfiguration::destroy()
00074 {
00075 fxTGo4AnalysisConfigurationSlots->SetGUI(0);
00076 }
00077
00078 void TGo4AnalysisConfiguration::closeEvent( QCloseEvent *ce )
00079 {
00080
00081 hide();
00082
00083
00084 }
00085
00086 void TGo4AnalysisConfiguration::GetActiveConf()
00087 {
00088 fxTGo4AnalysisConfigurationSlots->GetActiveConf();
00089 }
00090
00091 void TGo4AnalysisConfiguration::FileDialog_ConfFile()
00092 {
00093 QString fileName;
00094 QFileDialog* fd = new QFileDialog( this, "Select configuration file ", TRUE );
00095 fd->setMode( QFileDialog::AnyFile);
00096 fd->setCaption( "Select a configuraton file");
00097 fd->setFilter( " Configuration file (*.root)" );
00098 fd->setDir(fxTGo4AnalysisConfigurationStatus->GetConfigPath());
00099 if ( fd->exec() == QDialog::Accepted ) {
00100 fileName = fd->selectedFile();
00101 fxTGo4AnalysisConfigurationStatus->SetConfigPath(fd->dirPath());
00102
00103 if(!fileName.endsWith(".root")) fileName.append(".root");
00104 ConfigFileName->setText(fileName);
00105
00106 }
00107 delete fd;
00108 }
00109
00110 void TGo4AnalysisConfiguration::FileDialog_AutoSave()
00111 {
00112 QString fileName;
00113 QFileDialog* fd = new QFileDialog( this, "Autosave file name", TRUE );
00114 fd->setMode( QFileDialog::AnyFile);
00115 fd->setCaption("Select file name for autosaving");
00116 fd->setFilter( "Auto Save File (*.root)" );
00117 fd->setDir(fxTGo4AnalysisConfigurationStatus->GetAutoSavePath());
00118 if ( fd->exec() == QDialog::Accepted ) {
00119 fileName = fd->selectedFile();
00120 fxTGo4AnalysisConfigurationStatus->SetAutoSavePath(fd->dirPath());
00121 if(!fileName.endsWith(".root")) fileName.append(".root");
00122 AutoSaveFileName->setText(fileName);
00123 LineEdit_AutoSaveFile();
00124 }
00125 delete fd;
00126 }
00127
00128 void TGo4AnalysisConfiguration::LineEdit_LoadConfFile()
00129 {
00130 fxTGo4AnalysisConfigurationSlots->LoadConfFile(ConfigFileName->text().stripWhiteSpace().data());
00131 }
00132
00133 void TGo4AnalysisConfiguration::LineEdit_SaveConfFile()
00134 {
00135 fxTGo4AnalysisConfigurationSlots->SaveConfFile(ConfigFileName->text().stripWhiteSpace().data());
00136 }
00137
00138 void TGo4AnalysisConfiguration::LineEdit_AutoSaveFile()
00139 {
00140 fxTGo4AnalysisConfigurationSlots->AutoSaveFile(AutoSaveFileName->text().data());
00141
00142 }
00143
00144 void TGo4AnalysisConfiguration::SetCompressionLevel( int t)
00145 {
00146 fxTGo4AnalysisConfigurationSlots->SetCompressionLevel(t);
00147 }
00148
00149
00150 void TGo4AnalysisConfiguration::LoadConfiguration()
00151 {
00152 fxTGo4AnalysisConfigurationSlots->LoadConfiguration();
00153 }
00154
00155 void TGo4AnalysisConfiguration::SaveConfiguration()
00156 {
00157 fxTGo4AnalysisConfigurationSlots->SaveConfiguration();
00158 }
00159
00160 void TGo4AnalysisConfiguration::SubmitConfiguration()
00161 {
00162 fxTGo4AnalysisConfigurationSlots->SubmitConfiguration();
00163 }
00164
00165 void TGo4AnalysisConfiguration::ClearAll()
00166 {
00167 fxTGo4AnalysisConfigurationSlots->ClearAll();
00168 }
00169
00170 void TGo4AnalysisConfiguration::SetAutoSaveInterval(int t)
00171 {
00172 fxTGo4AnalysisConfigurationSlots->SetAutoSaveInterval(t);
00173 }
00174
00175 void TGo4AnalysisConfiguration::SetAutoSaveOverwrite(bool Overwrite)
00176 {
00177 fxTGo4AnalysisConfigurationSlots->SetAutoSaveOverwrite(Overwrite);
00178 }
00179
00180
00181 void TGo4AnalysisConfiguration::WriteAutoSave()
00182 {
00183 fxTGo4AnalysisConfigurationSlots->WriteAutoSave();
00184 }
00185
00186 void TGo4AnalysisConfiguration::DisableAutoSave( bool disabled)
00187 {
00188 fxTGo4AnalysisConfigurationSlots->SetAutoSaveOn(!disabled);
00189
00190 AutoSaveInterval->setEnabled(!disabled);
00191 }
00192
00193
00194
00195 int TGo4AnalysisConfiguration::GetNumSteps() {
00196 return fxStepConfigList.count();
00197 }
00198
00199 TGo4ConfigStep* TGo4AnalysisConfiguration::GetStepConfig(int n) {
00200 if ((n<0) || (n>=fxStepConfigList.count())) return 0;
00201 return fxStepConfigList.at(n);
00202 }
00203
00204 TGo4ConfigStep* TGo4AnalysisConfiguration::FindStepConfig(QString name) {
00205 for (unsigned int n=0;n<fxStepConfigList.count();n++) {
00206 TGo4ConfigStep* conf = fxStepConfigList.at(n);
00207 if (conf->GetStepName()==name) return conf;
00208 }
00209 return 0;
00210 }
00211
00212 void TGo4AnalysisConfiguration::SetAutoSaveConfig(QString filename,
00213 int interval,
00214 int compression,
00215 bool enbaled,
00216 bool overwrite) {
00217 AutoSaveFileName->setText(filename);
00218 AutoSaveInterval->setValue(interval);
00219 CompLevel->setValue(compression);
00220
00221 AutoSaveOverwrite->setChecked(overwrite);
00222 AutoSaveDisable->setChecked(!enbaled);
00223
00224 AutoSaveInterval->setEnabled(enbaled);
00225 }
00226
00227 void TGo4AnalysisConfiguration::GetAutoSaveConfig(QString& filename,
00228 int& interval,
00229 int& compression,
00230 bool& enbaled,
00231 bool& overwrite) {
00232 filename = AutoSaveFileName->text();
00233 interval = AutoSaveInterval->value();
00234 compression = CompLevel->value();
00235
00236 overwrite = AutoSaveOverwrite->isChecked();
00237 enbaled = !AutoSaveDisable->isChecked();
00238 }
00239
00240 void TGo4AnalysisConfiguration::SetAnalysisConfigFile(QString filename) {
00241 ConfigFileName->setText(filename);
00242 }
00243
00244 void TGo4AnalysisConfiguration::GetAnalysisConfigFile(QString& filename) {
00245 filename = ConfigFileName->text();
00246 }
00247
00248