GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventInfo.cpp
Go to the documentation of this file.
1 // $Id: TGo4EventInfo.cpp 3123 2021-03-30 08:27:38Z 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 fuer 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 TGo4EventInfo::TGo4EventInfo(QWidget *parent, const char* name)
23  : QGo4Widget(parent, name)
24 {
25  setupUi(this);
26  QObject::connect(RefreshButton, SIGNAL(clicked()), this, SLOT(RefreshClicked()));
27  QObject::connect(PrintEventButton, SIGNAL(clicked()), this, SLOT(PrintEventClicked()));
28  QObject::connect(MbsButton, SIGNAL(clicked()), this, SLOT(MbsButton_clicked()));
29  setWindowTitle("Event info");
30  ResetWidget();
31 }
32 
33 bool TGo4EventInfo::IsAcceptDrag(const char* itemname, TClass* cl, int kind)
34 {
35  return (kind==TGo4Access::kndEventElement);
36 }
37 
38 void TGo4EventInfo::DropItem(const char* itemname, TClass* cl, int kind)
39 {
41  WorkWithEvent(itemname);
42 }
43 
44 void TGo4EventInfo::WorkWithEvent(const char* itemname)
45 {
46  EventLbl->setText(itemname);
47 
48  bool ismbs = QString(itemname).contains(defMbsEventName);
49 
50  MbsPrintBox->setEnabled(ismbs);
51  TString mbsitem = Browser()->FindItemInAnalysis(defMbsEventName);
52  MbsButton->setEnabled(!ismbs && (mbsitem.Length()>0));
53  setFocus();
54 }
55 
57 {
59  EventLbl->setText("");
60  MbsButton->setEnabled(true);
61 // if (Browser()!=0) {
62 // TString mbsitem = Browser()->FindItemInAnalysis(defMbsEventName);
63 // MbsButton->setEnabled(mbsitem.Length()>0);
64 // } else
65 // MbsButton->setEnabled(false);
66  MbsPrintBox->setEnabled(false);
67 }
68 
69 void TGo4EventInfo::linkedObjectUpdated(const char* linkname, TObject* obj)
70 {
71  TTree* tr = dynamic_cast<TTree*>(obj);
72  if (tr!=0) {
73  tr->Show(0);
74  return;
75  }
76 
77  if (obj!=0) {
78  obj->Print();
79  return;
80  }
81 }
82 
83 void TGo4EventInfo::linkedObjectRemoved(const char* linkname)
84 {
85 }
86 
87 
89 {
91 
92  if (EventLbl->text().length()==0) return;
93  QString evname = EventLbl->text();
94  bool isremote = RemoteButton->isChecked();
95  bool istree = TreeButton->isChecked();
96 
97  TGo4Slot* tgtslot = 0;
98  if (!isremote)
99  tgtslot = AddSlot("Event");
100 
101  TGo4BrowserProxy* br = Browser();
102  if (br==0) return;
103 
104  TString objname;
105  TGo4ServerProxy* an = br->DefineAnalysisObject(evname.toLatin1().constData(), objname);
106  if (an!=0) an->RequestEventStatus(objname.Data(), istree, tgtslot);
107 }
108 
110 {
111  if (EventLbl->text().length()==0) return;
112 
113  TString folder, name;
114  TGo4Slot::ProduceFolderAndName(EventLbl->text().toLatin1().constData(), folder, name);
115 
116  TGo4ServerProxy* anal = GetAnalysis(EventLbl->text().toLatin1().constData());
117 
118  if (anal!=0)
119  anal->RemotePrintEvent(name.Data(),
120  PrintEventNum->value(),
121  PrintEventSid->value(),
122  HexBox->isChecked(),
123  LongBox->isChecked());
124 }
125 
127 {
128  TString itemname = Browser()->FindItemInAnalysis(defMbsEventName);
129  if (itemname.Length()>0)
130  WorkWithEvent(itemname.Data());
131 }
virtual void ResetWidget()
Definition: QGo4Widget.cpp:52
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:224
bool IsAcceptDrag(const char *itemname, TClass *cl, int kind)
TGo4ServerProxy * GetAnalysis(const char *itemname=0)
Definition: QGo4Widget.cpp:393
void RemoveAllLinks(bool blockreset=true)
Definition: QGo4Widget.cpp:201
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:664
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:146
void linkedObjectRemoved(const char *linkname)