Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4AnalysisConfiguration.ui.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 /****************************************************************************
00017 ** ui.h extension file, included from the uic-generated form implementation.
00018 **
00019 ** If you wish to add, delete or rename slots use Qt Designer which will
00020 ** update this file, preserving your code. Create an init() slot in place of
00021 ** a constructor, and a destroy() slot in place of a destructor.
00022 *****************************************************************************/
00023 
00024 void TGo4AnalysisConfiguration::init()
00025 {
00026    fSourcePath = ".";
00027    fStorePath = ".";
00028    fConfigPath = ".";
00029    fAutoSavePath = ".";
00030    fbTypingMode = true;
00031    setCanDestroyWidget(false);
00032 }
00033 
00034 void TGo4AnalysisConfiguration::destroy()
00035 {
00036 }
00037 
00038 /*
00039 void TGo4AnalysisConfiguration::closeEvent( QCloseEvent *ce )
00040 {
00041 // TGo4LockGuard glob;
00042    hide();
00043 //      ce->accept();
00044 //      delete this;
00045 }
00046 */
00047 
00048 bool TGo4AnalysisConfiguration::IsAcceptDrag(const char* itemname, TClass* cl, int kind)
00049 {
00050    return false;
00051 //   if (cl==0) return false;
00052 //   return cl->InheritsFrom(TGo4AnalysisStatus::Class());
00053 }
00054 
00055 void TGo4AnalysisConfiguration::DropItem(const char* itemname, TClass* cl, int kind)
00056 {
00057 //   if (cl==0) return;
00058 
00059 //   if (cl->InheritsFrom(TGo4AnalysisStatus::Class()))
00060 //      WorkWithStatus(itemname);
00061 }
00062 
00063 void TGo4AnalysisConfiguration::linkedObjectUpdated(const char* linkname, TObject* obj)
00064 {
00065    if (strcmp(linkname,"Status")==0) {
00066      raise();
00067      show();
00068      if (isMinimized()) showNormal();
00069      RefreshWidget();
00070    }
00071 }
00072 
00073 void TGo4AnalysisConfiguration::linkedObjectRemoved(const char* linkname)
00074 {
00075    ShootCloseWidget();
00076 }
00077 
00078 void TGo4AnalysisConfiguration::WorkWithAnalysis(TGo4AnalysisProxy* anal)
00079 {
00080    ResetWidget();
00081    if (anal==0) {
00082       ShootCloseWidget();
00083       return;
00084    }
00085 
00086    AddLink(anal->ParentSlot(), "Analysis");
00087    AddLink(anal->SettingsSlot(), "Status");
00088    RefreshWidget();
00089 }
00090 
00091 void TGo4AnalysisConfiguration::ResetWidget()
00092 {
00093    QGo4Widget::ResetWidget();
00094 
00095    QWidget* w= 0;
00096    do {
00097      w = TabSteps->currentPage();
00098      if (w!=0) {
00099         TabSteps->removePage(w);
00100         delete w;
00101      }
00102    } while (w!=0);
00103 }
00104 
00105 void TGo4AnalysisConfiguration::RefreshWidget()
00106 {
00107    TGo4AnalysisStatus* status =
00108      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00109    if (status==0) return;
00110 
00111    fbTypingMode = false;
00112 
00113    QWidget* w= 0;
00114    do{
00115      w = TabSteps->currentPage();
00116      if (w!=0) {
00117         TabSteps->removePage(w);
00118         delete w;
00119      }
00120    } while (w!=0);
00121 
00122    for(int i=0; i<status->GetNumberOfSteps(); i++) {
00123       TGo4AnalysisStepStatus* stepstatus = status->GetStepStatus(i);
00124       if (stepstatus==0) continue;
00125       QString StepName = stepstatus->GetName();
00126       TGo4ConfigStep* NewStep = new TGo4ConfigStep(TabSteps, StepName);
00127       NewStep->SetStepStatus(this, stepstatus);
00128       TabSteps->insertTab(NewStep, StepName, i);
00129     }
00130 
00131     TabSteps->setCurrentPage(0);
00132     TabSteps->adjustSize();
00133 
00134         //Get Analysis    Parameters
00135     SetAutoSaveConfig(status->GetAutoFileName(),
00136                       status->GetAutoSaveInterval(),
00137                       status->GetAutoSaveCompression(),
00138                       status->IsAutoSaveOn(),
00139                       status->IsAutoSaveOverwrite());
00140 
00141     SetAnalysisConfigFile(status->GetConfigFileName());
00142     showNormal();
00143     adjustSize();
00144 
00145     fbTypingMode = true;
00146 }
00147 
00148 QString TGo4AnalysisConfiguration::GetSourcePath()
00149 {
00150    return fSourcePath;
00151 }
00152 
00153 QString TGo4AnalysisConfiguration::GetStorePath()
00154 {
00155    return fStorePath;
00156 }
00157 
00158 void TGo4AnalysisConfiguration::SetSourcePath(const QString & v)
00159 {
00160    fSourcePath = v;
00161 }
00162 
00163 void TGo4AnalysisConfiguration::SetStorePath(const QString & v)
00164 {
00165    fStorePath = v;
00166 }
00167 
00168 void TGo4AnalysisConfiguration::RequestAnalysisStatus()
00169 {
00170    TGo4AnalysisProxy* anal =
00171      dynamic_cast<TGo4AnalysisProxy*>(GetLinked("Analysis", 0));
00172    if (anal!=0)
00173       anal->RequestAnalysisSettings();
00174 }
00175 
00176 void TGo4AnalysisConfiguration::FileDialog_ConfFile()
00177 {
00178     QFileDialog fd( this, "Select configuration file ", TRUE );
00179     fd.setMode( QFileDialog::AnyFile);
00180     fd.setCaption( "Select a configuraton file");
00181     fd.setFilter( " Configuration file (*.root)" );
00182     fd.setDir(fConfigPath);
00183     if (fd.exec() != QDialog::Accepted) return;
00184     QString fileName = fd.selectedFile();
00185     fConfigPath = fd.dirPath();
00186     if(!fileName.endsWith(".root")) fileName.append(".root");
00187     ConfigFileName->setText(fileName);
00188 }
00189 
00190 void TGo4AnalysisConfiguration::FileDialog_AutoSave()
00191 {
00192     QFileDialog fd( this, "Autosave file name", TRUE );
00193     fd.setMode( QFileDialog::AnyFile);
00194     fd.setCaption("Select file name for autosaving");
00195     fd.setFilter( "Auto Save File (*.root)" );
00196     fd.setDir(fAutoSavePath);
00197     if (fd.exec() != QDialog::Accepted)  return;
00198     QString fileName = fd.selectedFile();
00199     fAutoSavePath = fd.dirPath();
00200     if(!fileName.endsWith(".root")) fileName.append(".root");
00201     AutoSaveFileName->setText(fileName);
00202     LineEdit_AutoSaveFile();
00203 }
00204 
00205 void TGo4AnalysisConfiguration::LineEdit_AutoSaveFile()
00206 {
00207    QString fname = AutoSaveFileName->text().stripWhiteSpace();
00208    TGo4AnalysisStatus* status =
00209      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00210    if ((status!=0) && fbTypingMode)
00211      status->SetAutoFileName(fname.latin1());
00212 }
00213 
00214 void TGo4AnalysisConfiguration::SetCompressionLevel( int t)
00215 {
00216    TGo4AnalysisStatus* status =
00217      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00218    if ((status!=0) && fbTypingMode)
00219      status->SetAutoSaveCompression(t);
00220 }
00221 
00222 void TGo4AnalysisConfiguration::LoadConfiguration()
00223 {
00224    QString fname = ConfigFileName->text().stripWhiteSpace();
00225    TGo4AnalysisProxy* anal =
00226      dynamic_cast<TGo4AnalysisProxy*>(GetLinked("Analysis", 0));
00227    if (anal!=0)
00228      anal->LoadConfigFile(fname.latin1());
00229    RequestAnalysisStatus();
00230 }
00231 
00232 void TGo4AnalysisConfiguration::SaveConfiguration()
00233 {
00234    QString fname = ConfigFileName->text().stripWhiteSpace();
00235    TGo4AnalysisProxy* anal =
00236      dynamic_cast<TGo4AnalysisProxy*>(GetLinked("Analysis", 0));
00237    if (anal!=0)
00238      anal->SaveConfigFile(fname.latin1());
00239 }
00240 
00241 void TGo4AnalysisConfiguration::SubmitConfiguration()
00242 {
00243    ServiceCall("SubmitAnalysisSettings");
00244 }
00245 
00246 void TGo4AnalysisConfiguration::SubmitAndStart()
00247 {
00248    ServiceCall("SubmitStartAnalysis");
00249    hide();
00250 }
00251 
00252 void TGo4AnalysisConfiguration::SetAutoSaveInterval(int t)
00253 {
00254    TGo4AnalysisStatus* status =
00255      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00256    if ((status!=0) && fbTypingMode)
00257      status->SetAutoSaveInterval(t);
00258 }
00259 
00260 void TGo4AnalysisConfiguration::SetAutoSaveOverwrite(bool overwrite)
00261 {
00262    TGo4AnalysisStatus* status =
00263      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00264    if ((status!=0) && fbTypingMode)
00265      status->SetAutoSaveOverwrite(overwrite);
00266 }
00267 
00268 void TGo4AnalysisConfiguration::WriteAutoSave()
00269 {
00270    TGo4AnalysisStatus* status =
00271       dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00272    TGo4AnalysisProxy* anal =
00273      dynamic_cast<TGo4AnalysisProxy*>(GetLinked("Analysis", 0));
00274 
00275    if ((anal!=0) && (status!=0))
00276      anal->WriteAutoSave(status->GetAutoFileName(),
00277                          status->GetAutoSaveCompression(),
00278                          status->IsAutoSaveOverwrite());
00279 }
00280 
00281 void TGo4AnalysisConfiguration::DisableAutoSave( bool disabled)
00282 {
00283    TGo4AnalysisStatus* status =
00284      dynamic_cast<TGo4AnalysisStatus*> (GetLinked("Status",0));
00285    if ((status!=0) && fbTypingMode)
00286       status->SetAutoSaveOn(!disabled);
00287     AutoSaveInterval->setEnabled(!disabled);
00288 }
00289 
00290 int TGo4AnalysisConfiguration::GetNumSteps()
00291 {
00292    return TabSteps->count();
00293 }
00294 
00295 TGo4ConfigStep* TGo4AnalysisConfiguration::GetStepConfig(int n)
00296 {
00297    if ((n<0) || (n>=TabSteps->count())) return 0;
00298    return dynamic_cast<TGo4ConfigStep*> (TabSteps->page(n));
00299 }
00300 
00301 TGo4ConfigStep* TGo4AnalysisConfiguration::FindStepConfig(QString name)
00302 {
00303    for (int n=0;n<GetNumSteps();n++) {
00304       TGo4ConfigStep* conf = GetStepConfig(n);
00305       if (conf!=0)
00306         if (conf->GetStepName()==name) return conf;
00307    }
00308    return 0;
00309 }
00310 
00311 void TGo4AnalysisConfiguration::SetAutoSaveConfig(QString filename,
00312                                                   int interval,
00313                                                   int compression,
00314                                                   bool enbaled,
00315                                                   bool overwrite)
00316 {
00317   AutoSaveFileName->setText(filename);
00318   AutoSaveInterval->setValue(interval);
00319   CompLevel->setValue(compression);
00320 
00321   AutoSaveOverwrite->setChecked(overwrite);
00322   AutoSaveDisable->setChecked(!enbaled);
00323 
00324   AutoSaveInterval->setEnabled(enbaled);
00325 }
00326 
00327 void TGo4AnalysisConfiguration::GetAutoSaveConfig(QString& filename,
00328                                                   int& interval,
00329                                                   int& compression,
00330                                                   bool& enbaled,
00331                                                   bool& overwrite)
00332 {
00333   filename = AutoSaveFileName->text();
00334   interval = AutoSaveInterval->value();
00335   compression = CompLevel->value();
00336 
00337   overwrite = AutoSaveOverwrite->isChecked();
00338   enbaled = !AutoSaveDisable->isChecked();
00339 }
00340 
00341 void TGo4AnalysisConfiguration::SetAnalysisConfigFile(QString filename)
00342 {
00343    ConfigFileName->setText(filename);
00344 }
00345 
00346 void TGo4AnalysisConfiguration::GetAnalysisConfigFile(QString& filename)
00347 {
00348    filename = ConfigFileName->text();
00349 }
00350 
00351 void TGo4AnalysisConfiguration::DisplayMbsMonitor(const QString& mbsname )
00352 {
00353    ServiceCall("DisplayMbsMonitor", (void*) mbsname.latin1());
00354 }
00355 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:20 2008 for Go4-v3.04-1 by  doxygen 1.4.2