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

TGo4ConditionInfo.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 enum PropertyIndex {
00018    CONTITLE,
00019    CONCLASS,
00020    CONDIM,
00021    CONX,
00022    CONY,
00023    CONCOUNTS,
00024    CONRESULT,
00025    CONMODE,
00026    CONSIZE,
00027    CONTIME
00028 };
00029 
00030 void TGo4ConditionInfo::init()
00031 {
00032    setCaption("Condition Info:");
00033 }
00034 
00035 
00036 bool TGo4ConditionInfo::IsAcceptDrag(const char* itemname, TClass* cl, int kind)
00037 {
00038    return cl==0 ? false : cl->InheritsFrom(TGo4Condition::Class());
00039 }
00040 
00041 void TGo4ConditionInfo::DropItem(const char* itemname, TClass* cl, int kind)
00042 {
00043    if (cl==0) return;
00044    if (cl->InheritsFrom(TGo4Condition::Class()))
00045       WorkWithCondition(itemname);
00046 }
00047 
00048 void TGo4ConditionInfo::linkedObjectUpdated(const char* linkname, TObject* obj)
00049 {
00050    if (strcmp(linkname,"Condition")==0)
00051      RefreshWidget(dynamic_cast<TGo4Condition*>(obj));
00052 }
00053 
00054 
00055 void TGo4ConditionInfo::ConInfoButton_clicked()
00056 {
00057    WorkWithCondition(CondnameLbl->text());
00058 }
00059 
00060 void TGo4ConditionInfo::ConPrintButton_clicked()
00061 {
00062    ServiceCall("PrintAnalysisConditions");
00063 }
00064 
00065 void TGo4ConditionInfo::ConEditButton_clicked()
00066 {
00067    EditItem(CondnameLbl->text());
00068 }
00069 
00070 void TGo4ConditionInfo::PrintLog_clicked()
00071 {
00072     QString textbuffer;
00073     textbuffer="Condition ";
00074     textbuffer+=CondnameLbl->text();
00075     textbuffer+=" Status: \n ";
00076     textbuffer+="Title: ";
00077     textbuffer+=PropertyBox->item(CONTITLE)->text();
00078     textbuffer+=" Class: ";
00079     textbuffer+=PropertyBox->item(CONCLASS)->text();
00080     textbuffer+=" ";
00081     textbuffer+=PropertyBox->item(CONDIM)->text();
00082     textbuffer+=" ";
00083     textbuffer+=PropertyBox->item(CONMODE)->text();
00084     textbuffer+="\n ";
00085     textbuffer+=PropertyBox->item(CONX)->text();
00086     textbuffer+=" ";
00087     textbuffer+=PropertyBox->item(CONY)->text();
00088     textbuffer+="\n ";
00089     textbuffer+=PropertyBox->item(CONCOUNTS)->text();
00090     textbuffer+=" ";
00091     textbuffer+=PropertyBox->item(CONRESULT)->text();
00092     textbuffer+="\n ";
00093     textbuffer+=PropertyBox->item(CONSIZE)->text();
00094     textbuffer+=" Status received at: ";
00095     textbuffer+=PropertyBox->item(CONTIME)->text();
00096 
00097     TGo4Log::Message(1, textbuffer.latin1());
00098 }
00099 
00100 void TGo4ConditionInfo::WorkWithCondition(const char* itemname)
00101 {
00102    ResetWidget();
00103 
00104    CondnameLbl->setText(itemname);
00105 
00106    AddLink(itemname, "Condition");
00107 
00108    TObject* obj = GetLinked("Condition", 2);
00109 
00110    RefreshWidget(dynamic_cast<TGo4Condition*>(obj));
00111 
00112    setFocus();
00113 }
00114 
00115 void TGo4ConditionInfo::ResetWidget()
00116 {
00117    QGo4Widget::ResetWidget();
00118    PropertyBox->changeItem("Title",CONTITLE);
00119    PropertyBox->changeItem("Class:",CONCLASS);
00120    PropertyBox->changeItem("X Testrange",CONX);
00121    PropertyBox->changeItem("Y Testrange",CONY);
00122    PropertyBox->changeItem("Dimension",CONDIM);
00123    PropertyBox->changeItem("Counts",CONCOUNTS);
00124    PropertyBox->changeItem("Result",CONRESULT);
00125    PropertyBox->changeItem("Test mode",CONMODE);
00126    PropertyBox->changeItem("Size",CONSIZE);
00127    TDatime now;
00128    PropertyBox->changeItem(now.AsSQLString(),CONTIME);
00129    polish();
00130    update();
00131    show();
00132    raise();
00133 }
00134 
00135 void TGo4ConditionInfo::RefreshWidget(TGo4Condition* cond)
00136 {
00137    if(cond==0) return;
00138 
00139    TString str;
00140    PropertyBox->changeItem(cond->GetTitle(), CONTITLE);
00141    PropertyBox->changeItem(cond->ClassName(), CONCLASS);
00142    int dimension = 0;
00143    if(cond->InheritsFrom(TGo4WinCond::Class())) {
00144        TGo4WinCond* wcon = (TGo4WinCond*) cond;
00145        double xmin, xmax, ymin, ymax;
00146        wcon->GetValues(dimension, xmin, xmax, ymin, ymax);
00147        str.Form("X: [%.1f,%.1f]",xmin, xmax);
00148        PropertyBox->changeItem(str.Data(), CONX);
00149        str.Form("Y: [%.1f,%.1f]",ymin, ymax);
00150        PropertyBox->changeItem(str.Data(), CONY);
00151    } else {
00152        PropertyBox->changeItem("X:-", CONX);
00153        PropertyBox->changeItem("Y:-",CONY);
00154        dimension = 2;
00155    }
00156 
00157    str.Form("Dim:%d", dimension);
00158    PropertyBox->changeItem(str.Data(), CONDIM);
00159    str.Form("Counts:%d", cond->Counts());
00160    PropertyBox->changeItem(str.Data(), CONCOUNTS);
00161    str.Form("True:%d",cond->TrueCounts());
00162    PropertyBox->changeItem(str.Data(), CONRESULT);
00163 
00164    if(cond->IsEnabled()) str = "test enabled"; else
00165      if(cond->FixedResult()) str = "always true";
00166                         else  str = "always false";
00167    if(cond->IsTrue()) str += " - regular";
00168                  else str += " - inverse";
00169    PropertyBox->changeItem(str.Data(), CONMODE);
00170 
00171    str.Form("size:%d b",cond->GetMemorySize());
00172    PropertyBox->changeItem(str.Data(),CONSIZE);
00173 
00174    TDatime now;
00175    PropertyBox->changeItem(now.AsSQLString(), CONTIME);
00176    polish();
00177    update();
00178    show();
00179    raise();
00180    if(TGo4Log::IsAutoEnabled()) PrintLog_clicked();
00181 }
00182 
00183 //----------------------------END OF GO4 SOURCE FILE ---------------------

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