Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4AnalysisStatusMonitor.h"
00015 #include <math.h>
00016
00017 #include "TGo4AnalysisClientStatus.h"
00018 #include "TGo4BrowserProxy.h"
00019 #include "TSystem.h"
00020
00021
00022 TGo4AnalysisStatusMonitor::TGo4AnalysisStatusMonitor(QWidget *parent, const char* name) :
00023 QGo4Widget(parent, name)
00024 {
00025 setupUi(this);
00026 setAcceptDrops(false);
00027 fxRunMovie = new QMovie(":/icons/go4logorun4.gif");
00028
00029 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
00030 LCDCurrentRate->setDigitCount(8);
00031 LCDAverageRate->setDigitCount(8);
00032 LCDTime->setDigitCount(8);
00033 LCDProcessedEvents->setDigitCount(9);
00034 #else
00035 LCDCurrentRate->setNumDigits(8);
00036 LCDAverageRate->setNumDigits(8);
00037 LCDTime->setNumDigits(8);
00038 LCDProcessedEvents->setNumDigits(9);
00039 #endif
00040 }
00041
00042 TGo4AnalysisStatusMonitor::~TGo4AnalysisStatusMonitor()
00043 {
00044 delete fxRunMovie;
00045 }
00046
00047 void TGo4AnalysisStatusMonitor::WorkWithRatemeter(TGo4Slot* slot)
00048 {
00049 AddLink(slot, "Ratemeter");
00050 }
00051
00052 void TGo4AnalysisStatusMonitor::linkedObjectUpdated( const char * linkname, TObject * obj )
00053 {
00054 TGo4AnalysisClientStatus* status = dynamic_cast<TGo4AnalysisClientStatus*> (obj);
00055 if (status==0) return;
00056 SourceLabel->setText(status->GetCurrentSource());
00057
00058 double Rate = status->GetRate();
00059 if(Rate>10) LCDCurrentRate->display(floor(Rate));
00060 else LCDCurrentRate->display(Rate);
00061
00062 const char* color = "QFrame { background-color:rgb(255,0,0) }";
00063
00064 if(!status->IsAnalysisRunning()) {
00065 Go4Pix->setWindowIcon( QIcon(":/icons/go4logo2.png"));
00066 fxRunMovie->stop();
00067 } else {
00068 color = "QFrame { background-color:rgb(0,255,0) }";
00069 Go4Pix->clear();
00070 Go4Pix->setMovie(fxRunMovie);
00071 fxRunMovie->start();
00072 }
00073
00074 LCDCurrentRate->setStyleSheet(color);
00075
00076 if(status->GetAvRate()>10)
00077 LCDAverageRate->display(floor(status->GetAvRate()));
00078 else
00079 LCDAverageRate->display(status->GetAvRate());
00080 int stime=(int)status->GetTime();
00081 LCDTime->display(stime);
00082 ulong hh = stime/3600;
00083 ulong mm = (stime-hh*3600)/60;
00084 ulong ss = (stime-hh*3600-mm*60);
00085 QString tooltip = QString("Time since last reset [sec] = %1:%2:%3 [hours:min:sec]").arg(hh).arg(mm).arg(ss);
00086 LCDTime->setToolTip(tooltip);
00087 QString scnt = QString("%1").arg(status->GetCurrentCount());
00088
00089 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
00090 if (scnt.length() > LCDProcessedEvents->digitCount())
00091 LCDProcessedEvents->setDigitCount(scnt.length());
00092 #else
00093 if (scnt.length() > LCDProcessedEvents->numDigits())
00094 LCDProcessedEvents->setNumDigits(scnt.length());
00095 #endif
00096
00097 LCDProcessedEvents->display(scnt);
00098
00099 DateLabel->setText(status->GetDateTime());
00100 }
00101
00102 void TGo4AnalysisStatusMonitor::linkedObjectRemoved(const char * linkname)
00103 {
00104
00105
00106 if (Browser())
00107 Browser()->ToggleMonitoring(0);
00108
00109 ShootCloseWidget();
00110 }