GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventInfo.cpp
Go to the documentation of this file.
1 // $Id: TGo4EventInfo.cpp 1486 2015-06-03 16:25:10Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4EventInfo.h"
15 #include "TTree.h"
16 #include "TGo4ServerProxy.h"
17 #include "TGo4Slot.h"
18 #include "TGo4BrowserProxy.h"
19 
20 const char* defMbsEventName = "MbsEvent101";
21 
22 
23 TGo4EventInfo::TGo4EventInfo(QWidget *parent, const char* name)
24  : QGo4Widget(parent, name)
25 {
26  setupUi(this);
27  setWindowTitle("Event info");
28  ResetWidget();
29 }
30 
31 bool TGo4EventInfo::IsAcceptDrag(const char* itemname, TClass* cl, int kind)
32 {
33  return (kind==TGo4Access::kndEventElement);
34 }
35 
36 void TGo4EventInfo::DropItem(const char* itemname, TClass* cl, int kind)
37 {
39  WorkWithEvent(itemname);
40 }
41 
42 void TGo4EventInfo::WorkWithEvent(const char* itemname)
43 {
44  EventLbl->setText(itemname);
45 
46  bool ismbs = QString(itemname).contains(defMbsEventName);
47 
48  MbsPrintBox->setEnabled(ismbs);
49  TString mbsitem = Browser()->FindItemInAnalysis(defMbsEventName);
50  MbsButton->setEnabled(!ismbs && (mbsitem.Length()>0));
51  setFocus();
52 }
53 
55 {
57  EventLbl->setText("");
58  MbsButton->setEnabled(true);
59 // if (Browser()!=0) {
60 // TString mbsitem = Browser()->FindItemInAnalysis(defMbsEventName);
61 // MbsButton->setEnabled(mbsitem.Length()>0);
62 // } else
63 // MbsButton->setEnabled(false);
64  MbsPrintBox->setEnabled(false);
65 }
66 
67 void TGo4EventInfo::linkedObjectUpdated(const char* linkname, TObject* obj)
68 {
69  TTree* tr = dynamic_cast<TTree*>(obj);
70  if (tr!=0) {
71  tr->Show(0);
72  return;
73  }
74 
75  if (obj!=0) {
76  obj->Print();
77  return;
78  }
79 }
80 
81 void TGo4EventInfo::linkedObjectRemoved(const char* linkname)
82 {
83 }
84 
85 
87 {
89 
90  if (EventLbl->text().length()==0) return;
91  QString evname = EventLbl->text();
92  bool isremote = RemoteButton->isChecked();
93  bool istree = TreeButton->isChecked();
94 
95  TGo4Slot* tgtslot = 0;
96  if (!isremote)
97  tgtslot = AddSlot("Event");
98 
99  TGo4BrowserProxy* br = Browser();
100  if (br==0) return;
101 
102  TString objname;
103  TGo4ServerProxy* an = br->DefineAnalysisObject(evname.toLatin1().constData(), objname);
104  if (an!=0) an->RequestEventStatus(objname.Data(), istree, tgtslot);
105 }
106 
108 {
109  if (EventLbl->text().length()==0) return;
110 
111  TString folder, name;
112  TGo4Slot::ProduceFolderAndName(EventLbl->text().toLatin1().constData(), folder, name);
113 
114  TGo4ServerProxy* anal = GetAnalysis(EventLbl->text().toLatin1().constData());
115 
116  if (anal!=0)
117  anal->RemotePrintEvent(name.Data(),
118  PrintEventNum->value(),
119  PrintEventSid->value(),
120  HexBox->isChecked(),
121  LongBox->isChecked());
122 }
123 
125 {
126  TString itemname = Browser()->FindItemInAnalysis(defMbsEventName);
127  if (itemname.Length()>0)
128  WorkWithEvent(itemname.Data());
129 }
virtual void ResetWidget()
Definition: QGo4Widget.cpp:51
virtual void MbsButton_clicked()
void DropItem(const char *itemname, TClass *cl, int kind)
void linkedObjectUpdated(const char *linkname, TObject *obj)
TGo4BrowserProxy * Browser()
Definition: QGo4Widget.cpp:223
bool IsAcceptDrag(const char *itemname, TClass *cl, int kind)
TGo4ServerProxy * GetAnalysis(const char *itemname=0)
Definition: QGo4Widget.cpp:390
void RemoveAllLinks(bool blockreset=true)
Definition: QGo4Widget.cpp:200
void WorkWithEvent(const char *itemname)
TString FindItemInAnalysis(const char *objname)
TGo4EventInfo(QWidget *parent=0, const char *name=0)
virtual void PrintEventClicked()
const char * defMbsEventName
virtual void RefreshClicked()
static void ProduceFolderAndName(const char *fullname, TString &foldername, TString &objectname)
Definition: TGo4Slot.cxx:668
virtual void RequestEventStatus(const char *evname, Bool_t astree, TGo4Slot *tgtslot)
TGo4ServerProxy * DefineAnalysisObject(const char *itemname, TString &analysisname)
virtual void RemotePrintEvent(const char *evname, Int_t evnumber, Int_t subid, Bool_t ishex, Bool_t islong)
TGo4Slot * AddSlot(const char *slotname)
Definition: QGo4Widget.cpp:145
void linkedObjectRemoved(const char *linkname)