18#define VP1HttpGetFile_cxx
20#undef VP1HttpGetFile_cxx
33 : QObject(parent),
m_d(new
Imp)
42 thread->blockSignals(
true);
46 emit
downloadFailed(
"VP1HttpGetFile object deleted before download finished", urltofile, localtargetfile,
data );
49 thread->deleteLater();
57 m_d->maxDownloads = n;
63 return m_d->maxDownloads;
69 return m_d->activeDownloadThreads.size();
74 const QString& localtargetfile,
75 const QString& md5sum,
78 if (
m_d->maxDownloads>0 &&
unsigned(
m_d->activeDownloadThreads.count()) >=
m_d->maxDownloads)
79 return "Too many simultaneous downloads requested";
82 return "Already downloading file to location: "+localtargetfile;
87 m_d->activeDownloadThreads << thread;
101 m_d->activeDownloadThreads.removeAll(thread);
102 const QString urltofile = thread->
urltofile();
104 const QString
data = thread->
data();
105 const bool errors = thread->
errors();
108 thread->deleteLater();
123 m_d->activeDownloadThreads.removeAll(thread);
124 const QString urltofile = thread->
urltofile();
126 const QString
data = thread->
data();
128 thread->deleteLater();
129 emit
downloadFailed(
"Download thread terminated", urltofile, localtargetfile,
data );
141 QTimer::singleShot(0, thread, SLOT(checkForStall()));
152 QTimer::singleShot(0, thread, SLOT(checkForStall()));
char data[hepevt_bytes_allocation_ATLAS]
QList< VP1HttpGetFile_DownloadThread * > activeDownloadThreads
QString errorString() const
const QString & urltofile() const
const QString & data() const
const QString & localtargetfile() const
void downloadSuccessful(const QString &urltofile, const QString &localtargetfile, const QString &data)
void setMaxNumberOfPendingDownloads(unsigned)
void downloadThreadTerminated()
void downloadThreadFinished()
VP1HttpGetFile(QObject *parent=0)
void downloadFailed(const QString &error, const QString &urltofile, const QString &localtargetfile, const QString &data)
unsigned maxNumberOfPendingDownloads() const
bool isDownloadingTo(const QString &localtargetfile) const
virtual ~VP1HttpGetFile()
unsigned numberOfPendingDownloads() const
QString startDownload(const QString &urltofile, const QString &localtargetfile, const QString &md5sum="", const QString &data="")
bool isDownloading(const QString &urltofile) const