GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ConditionInfo.cpp
Go to the documentation of this file.
1// $Id$
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 "TGo4ConditionInfo.h"
15
16#include "TClass.h"
17#include "TDatime.h"
18
19#include "TGo4Log.h"
20#include "TGo4WinCond.h"
21
22TGo4ConditionInfo::TGo4ConditionInfo(QWidget *parent, const char *name)
23 : QGo4Widget(parent, name)
24{
25 setupUi(this);
26
27 QObject::connect(ConInfoButton, &QPushButton::clicked, this, &TGo4ConditionInfo::ConInfoButton_clicked);
28 QObject::connect(ConPrintButton, &QPushButton::clicked, this, &TGo4ConditionInfo::ConPrintButton_clicked);
29 QObject::connect(ConEditButton, &QPushButton::clicked, this, &TGo4ConditionInfo::ConEditButton_clicked);
30 QObject::connect(PrintLog, &QPushButton::clicked, this, &TGo4ConditionInfo::PrintLog_clicked);
31
32 setWindowTitle("Condition Info:");
33}
34
35
36bool TGo4ConditionInfo::IsAcceptDrag(const char *itemname, TClass *cl, int kind)
37{
38 return !cl ? false : cl->InheritsFrom(TGo4Condition::Class());
39}
40
41void TGo4ConditionInfo::DropItem(const char *itemname, TClass *cl, int kind)
42{
43 if (!cl) return;
44 if (cl->InheritsFrom(TGo4Condition::Class()))
45 WorkWithCondition(itemname);
46}
47
48void TGo4ConditionInfo::linkedObjectUpdated(const char *linkname, TObject *obj)
49{
50 if (strcmp(linkname,"Condition") == 0)
51 RefreshWidget(dynamic_cast<TGo4Condition *>(obj));
52}
53
54
56{
57 WorkWithCondition(CondnameLbl->text().toLatin1().constData());
58}
59
61{
62 ServiceCall("PrintAnalysisConditions");
63}
64
66{
67 EditItem(CondnameLbl->text());
68}
69
71{
72 QString textbuffer;
73 textbuffer="Condition ";
74 textbuffer+=CondnameLbl->text();
75 textbuffer+=" Status: \n ";
76 textbuffer+="Title: ";
77 textbuffer+=PropertyBox->item(CONTITLE)->text();
78 textbuffer+=" Class: ";
79 textbuffer+=PropertyBox->item(CONCLASS)->text();
80 textbuffer+=" ";
81 textbuffer+=PropertyBox->item(CONDIM)->text();
82 textbuffer+=" ";
83 textbuffer+=PropertyBox->item(CONMODE)->text();
84 textbuffer+="\n ";
85 textbuffer+=PropertyBox->item(CONX)->text();
86 textbuffer+=" ";
87 textbuffer+=PropertyBox->item(CONY)->text();
88 textbuffer+="\n ";
89 textbuffer+=PropertyBox->item(CONCOUNTS)->text();
90 textbuffer+=" ";
91 textbuffer+=PropertyBox->item(CONRESULT)->text();
92 textbuffer+="\n ";
93 textbuffer+=PropertyBox->item(CONSIZE)->text();
94 textbuffer+=" Status received at: ";
95 textbuffer+=PropertyBox->item(CONTIME)->text();
96
97 TGo4Log::Message(1, "%s", textbuffer.toLatin1().constData());
98}
99
100void TGo4ConditionInfo::WorkWithCondition(const char *itemname)
101{
102 ResetWidget();
103
104 CondnameLbl->setText(itemname);
105
106 AddLink(itemname, "Condition");
107
108 auto cond = GetLinkedCast<TGo4Condition>("Condition", 2);
109
110 RefreshWidget(cond);
111
112 setFocus();
113}
114
116{
118 PropertyBox->item(CONTITLE)->setText("Title");
119 PropertyBox->item(CONCLASS)->setText("Class:");
120 PropertyBox->item(CONX)->setText("X Testrange");
121 PropertyBox->item(CONY)->setText("Y Testrange");
122 PropertyBox->item(CONDIM)->setText("Dimension");
123 PropertyBox->item(CONCOUNTS)->setText("Counts");
124 PropertyBox->item(CONRESULT)->setText("Result");
125 PropertyBox->item(CONMODE)->setText("Test mode");
126 PropertyBox->item(CONSIZE)->setText("Size");
127 TDatime now;
128 PropertyBox->item(CONTIME)->setText(now.AsSQLString());
129 ensurePolished();
130 update();
131 show();
132 raise();
133}
134
136{
137 if(!cond) return;
138
139 TString str;
140 PropertyBox->item(CONTITLE)->setText(cond->GetTitle());
141 PropertyBox->item(CONCLASS)->setText(cond->ClassName());
142 int dimension = 0;
143 if(cond->InheritsFrom(TGo4WinCond::Class())) {
144 TGo4WinCond *wcon = (TGo4WinCond*) cond;
145 double xmin, xmax, ymin, ymax;
146 wcon->GetValues(dimension, xmin, xmax, ymin, ymax);
147 str.Form("X: [%.1f,%.1f]",xmin, xmax);
148 PropertyBox->item(CONX)->setText(str.Data());
149 str.Form("Y: [%.1f,%.1f]",ymin, ymax);
150 PropertyBox->item(CONY)->setText(str.Data());
151 } else {
152 PropertyBox->item(CONX)->setText("X:-");
153 PropertyBox->item(CONY)->setText("Y:-");
154 dimension=cond->GetDimension();
155 }
156
157 str.Form("Dim:%d", dimension);
158 PropertyBox->item(CONDIM)->setText(str.Data());
159 str.Form("Counts:%d", cond->Counts());
160 PropertyBox->item(CONCOUNTS)->setText(str.Data());
161 str.Form("True:%d",cond->TrueCounts());
162 PropertyBox->item(CONRESULT)->setText(str.Data());
163
164 if(cond->IsEnabled())
165 str = "test enabled";
166 else if(cond->FixedResult())
167 str = "always true";
168 else
169 str = "always false";
170 if(cond->IsTrue()) str += " - regular";
171 else str += " - inverse";
172 PropertyBox->item(CONMODE)->setText(str.Data());
173
174 str.Form("size:%d b",cond->GetMemorySize());
175 PropertyBox->item(CONSIZE)->setText(str.Data());
176
177 TDatime now;
178 PropertyBox->item(CONTIME)->setText(now.AsSQLString());
179 ensurePolished();
180 update();
181 show();
182 raise();
184}
T * GetLinkedCast(const char *linkname, int updatelevel=0)
Definition QGo4Widget.h:157
virtual void ResetWidget()
QGo4Widget(QWidget *parent=nullptr, const char *name=nullptr, Qt::WindowFlags f=Qt::Widget)
void AddLink(const char *itemname, const char *linkname)
create link for item with name linkname
void ServiceCall(const char *name, void *par=nullptr)
void EditItem(const QString &itemname)
virtual void WorkWithCondition(const char *itemname)
virtual void ConEditButton_clicked()
virtual void ConPrintButton_clicked()
virtual void PrintLog_clicked()
TGo4ConditionInfo(QWidget *parent=nullptr, const char *name=nullptr)
void ResetWidget() override
void DropItem(const char *itemname, TClass *cl, int kind) override
virtual void RefreshWidget(TGo4Condition *cond)
bool IsAcceptDrag(const char *itemname, TClass *cl, int kind) override
void linkedObjectUpdated(const char *linkname, TObject *obj) override
virtual void ConInfoButton_clicked()
Go4 condition class.
virtual Int_t TrueCounts()
Return number of true results of the Test method call.
virtual Int_t GetMemorySize() const
Int_t GetDimension() const
virtual Int_t Counts()
Return number of calls of the Test method.
Bool_t FixedResult() const
Returns the value set by Disable(value).
Bool_t IsTrue() const
Use this as return, if test was true.
Bool_t IsEnabled() const
Returns true if condition is enabled.
static Bool_t IsAutoEnabled()
get current user boolean
Definition TGo4Log.cxx:378
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
Display a message.
Definition TGo4Log.cxx:206
Window condition.
Definition TGo4WinCond.h:26
void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2) override
Returns limits.