ATLAS Offline Software
Loading...
Searching...
No Matches
VP1WebWatcher.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Header file for class VP1WebWatcher //
9// //
10// Description: Http analogy of QFileSystemWatcher, which //
11// uses http HEAD requests (in a subthread) at //
12// regular intervals to monitor for changes //
13// in files located on a webserver. //
14// //
15// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
16// Initial version: June 2008 //
17// //
19
20#ifndef VP1WEBWATCHER_H
21#define VP1WEBWATCHER_H
22
23#include <QObject>
24#include <QStringList>
25
26
27class QDateTime;
28
29class VP1WebWatcher : public QObject {
30
31 Q_OBJECT
32
33public:
34
35 VP1WebWatcher( int recheckInterval_ms = 30000, QObject * parent = 0 );
36 VP1WebWatcher( const QStringList& urls, int recheckInterval_ms = 30000, QObject * parent = 0 );
37 virtual ~VP1WebWatcher();
38
39 void addUrl(const QString&);
40 void addUrls(const QStringList&);
41
42 QStringList urls() const;
43 bool isWatchingUrl(const QString&) const;
44
45 void removeUrl(const QString&);
46 void removeUrls(const QStringList&);
47
48 //Get more information:
49 enum RESULT { UNKNOWN,//Might be because no http request was yet done.
51 CONNECTION_PROBLEMS,//Various problems (server not found, no net connection, etc.)
52 NOT_ON_SERVER,//Request returned 404 (file not found on server)
53 EXISTS };//File was found on server
54 RESULT lastResult(const QString& url);
55 QString lastResultToString(const QString& url);
56
57 QDateTime lastModTime(const QString& url);//Always invalid if lastResult(url)!=EXISTS (might be invalid for EXISTS as well).
58
59signals:
60 void urlChanged(const QString& url );
61
62private Q_SLOTS:
63 void httpRequestDone(bool);
64protected:
65 void timerEvent(QTimerEvent*);
66private:
67 class Imp;
69
70};
71
72#endif
void addUrls(const QStringList &)
QString lastResultToString(const QString &url)
virtual ~VP1WebWatcher()
bool isWatchingUrl(const QString &) const
RESULT lastResult(const QString &url)
void addUrl(const QString &)
void removeUrl(const QString &)
void removeUrls(const QStringList &)
QDateTime lastModTime(const QString &url)
void timerEvent(QTimerEvent *)
VP1WebWatcher(int recheckInterval_ms=30000, QObject *parent=0)
void httpRequestDone(bool)
QStringList urls() const
void urlChanged(const QString &url)