ATLAS Offline Software
Public Slots | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
VP1StreamMenuUpdater Class Reference

#include <VP1StreamMenuUpdater.h>

Inheritance diagram for VP1StreamMenuUpdater:
Collaboration diagram for VP1StreamMenuUpdater:

Public Slots

void updateInputDirectoriesStatus ()
 

Public Member Functions

 VP1StreamMenuUpdater (VP1DirStatuses &, QMutex *, QObject *parent=0)
 
 ~VP1StreamMenuUpdater ()
 

Protected Member Functions

void run ()
 

Private Attributes

VP1DirStatusesm_inputdiractions
 
QMutex * m_mutex
 
QTimer * m_timer
 

Detailed Description

Definition at line 14 of file VP1StreamMenuUpdater.h.

Constructor & Destructor Documentation

◆ VP1StreamMenuUpdater()

VP1StreamMenuUpdater::VP1StreamMenuUpdater ( VP1DirStatuses diractions,
QMutex *  mutex,
QObject *  parent = 0 
)

Definition at line 15 of file VP1StreamMenuUpdater.cxx.

18  : QThread(parent)
19  , m_inputdiractions(diractions)
20  , m_mutex(mutex)
21  , m_timer(0)
22 {
23 }

◆ ~VP1StreamMenuUpdater()

VP1StreamMenuUpdater::~VP1StreamMenuUpdater ( )

Definition at line 25 of file VP1StreamMenuUpdater.cxx.

26 {
27  delete m_timer;
28 }

Member Function Documentation

◆ run()

void VP1StreamMenuUpdater::run ( )
protected

Definition at line 30 of file VP1StreamMenuUpdater.cxx.

31 {
33  m_timer = new QTimer(0);
34  connect(m_timer, SIGNAL(timeout()), this, SLOT(updateInputDirectoriesStatus()),Qt::DirectConnection);
35  m_timer->start(5000);
36  exec();
37 }

◆ updateInputDirectoriesStatus

void VP1StreamMenuUpdater::updateInputDirectoriesStatus ( )
slot

Definition at line 39 of file VP1StreamMenuUpdater.cxx.

40 {
41  QMutexLocker locker(m_mutex);
42 
43  for (QAction* act : m_inputdiractions.keys()) {
44  VP1DirStatusData& dirstatus = m_inputdiractions[act];
45  dirstatus.enabled = true;
46  dirstatus.bold = false;
47  dirstatus.dirStatus = "unknown";
48 
49  // Check whether it exists and is really a directory
50  QFileInfo fi(dirstatus.inputDir);
51  if (!fi.exists()||!fi.isDir()) {
52  dirstatus.enabled = false;
53  dirstatus.dirStatus = "not found";
54  } else {
55  // Access the latest_vp1event file in order to get the name of the latest vp1 event file
56  // in the directory
57  QFile latestFileRef(dirstatus.inputDir + "/latest_vp1event");
58  if(latestFileRef.exists()
59  && latestFileRef.open(QIODevice::ReadOnly | QIODevice::Text)) {
60  QTextStream textStream(&latestFileRef);
61  QString latestFileName = textStream.readLine();
62  latestFileRef.close();
63 
64  QFileInfo latestFile(latestFileName);
65  if(latestFile.exists()) {
66  int secondswithoutupdate = latestFile.lastModified().secsTo(QDateTime::currentDateTime());
67  dirstatus.bold = (secondswithoutupdate<60);
68  if (secondswithoutupdate<120)
69  dirstatus.dirStatus = QString::number(secondswithoutupdate)+" seconds since update";
70  else if (secondswithoutupdate<7200)
71  dirstatus.dirStatus = QString::number(static_cast<int>(secondswithoutupdate/60.0+0.5))+" minutes since update";
72  else
73  dirstatus.dirStatus = QString::number(static_cast<int>(secondswithoutupdate/3600.0+0.5))+" hours since update";
74  }
75  }
76  }
77  }
78 }

Member Data Documentation

◆ m_inputdiractions

VP1DirStatuses& VP1StreamMenuUpdater::m_inputdiractions
private

Definition at line 32 of file VP1StreamMenuUpdater.h.

◆ m_mutex

QMutex* VP1StreamMenuUpdater::m_mutex
private

Definition at line 33 of file VP1StreamMenuUpdater.h.

◆ m_timer

QTimer* VP1StreamMenuUpdater::m_timer
private

Definition at line 34 of file VP1StreamMenuUpdater.h.


The documentation for this class was generated from the following files:
VP1DirStatusData
Definition: VP1MainWindow.h:54
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
VP1DirStatusData::bold
bool bold
Definition: VP1MainWindow.h:75
VP1StreamMenuUpdater::m_mutex
QMutex * m_mutex
Definition: VP1StreamMenuUpdater.h:33
VP1StreamMenuUpdater::m_inputdiractions
VP1DirStatuses & m_inputdiractions
Definition: VP1StreamMenuUpdater.h:32
VP1DirStatusData::inputDir
QString inputDir
Definition: VP1MainWindow.h:70
LArG4FSStartPointFilter.exec
exec
Definition: LArG4FSStartPointFilter.py:103
VP1DirStatusData::dirStatus
QString dirStatus
Definition: VP1MainWindow.h:73
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1StreamMenuUpdater::updateInputDirectoriesStatus
void updateInputDirectoriesStatus()
Definition: VP1StreamMenuUpdater.cxx:39
python.selection.number
number
Definition: selection.py:20
VP1DirStatusData::enabled
bool enabled
Definition: VP1MainWindow.h:74
checkFileSG.fi
fi
Definition: checkFileSG.py:65
python.TrigInDetArtSteps.timeout
timeout
Definition: TrigInDetArtSteps.py:35
VP1StreamMenuUpdater::m_timer
QTimer * m_timer
Definition: VP1StreamMenuUpdater.h:34