#include <VP1HttpGetFile.h>
|
| void | downloadSuccessful (const QString &urltofile, const QString &localtargetfile, const QString &data) |
| void | downloadFailed (const QString &error, const QString &urltofile, const QString &localtargetfile, const QString &data) |
Definition at line 25 of file VP1HttpGetFile.h.
◆ VP1HttpGetFile()
| VP1HttpGetFile::VP1HttpGetFile |
( |
QObject * | parent = 0 | ) |
|
◆ ~VP1HttpGetFile()
| VP1HttpGetFile::~VP1HttpGetFile |
( |
| ) |
|
|
virtual |
Definition at line 38 of file VP1HttpGetFile.cxx.
39{
41 for( VP1HttpGetFile_DownloadThread * thread :
m_d->activeDownloadThreads) {
42 thread->blockSignals(true);
46 emit
downloadFailed(
"VP1HttpGetFile object deleted before download finished", urltofile, localtargetfile,
data );
47 thread->terminate();
48 thread->wait();
49 thread->deleteLater();
50 }
52}
char data[hepevt_bytes_allocation_ATLAS]
const QString & urltofile() const
const QString & data() const
const QString & localtargetfile() const
void downloadFailed(const QString &error, const QString &urltofile, const QString &localtargetfile, const QString &data)
◆ downloadFailed
| void VP1HttpGetFile::downloadFailed |
( |
const QString & | error, |
|
|
const QString & | urltofile, |
|
|
const QString & | localtargetfile, |
|
|
const QString & | data ) |
|
signal |
◆ downloadSuccessful
| void VP1HttpGetFile::downloadSuccessful |
( |
const QString & | urltofile, |
|
|
const QString & | localtargetfile, |
|
|
const QString & | data ) |
|
signal |
◆ downloadThreadFinished
| void VP1HttpGetFile::downloadThreadFinished |
( |
| ) |
|
|
privateslot |
Definition at line 94 of file VP1HttpGetFile.cxx.
95{
97 return;
98 VP1HttpGetFile_DownloadThread * thread = dynamic_cast<VP1HttpGetFile_DownloadThread *>(sender());
99 if (!thread)
100 return;
101 m_d->activeDownloadThreads.removeAll(thread);
102 const QString urltofile = thread->
urltofile();
104 const QString
data = thread->
data();
107 thread->wait();
108 thread->deleteLater();
109 if (errors)
111 else
113}
QString errorString() const
void downloadSuccessful(const QString &urltofile, const QString &localtargetfile, const QString &data)
◆ downloadThreadTerminated
| void VP1HttpGetFile::downloadThreadTerminated |
( |
| ) |
|
|
privateslot |
Definition at line 116 of file VP1HttpGetFile.cxx.
117{
119 return;
120 VP1HttpGetFile_DownloadThread * thread = dynamic_cast<VP1HttpGetFile_DownloadThread *>(sender());
121 if (!thread)
122 return;
123 m_d->activeDownloadThreads.removeAll(thread);
124 const QString urltofile = thread->
urltofile();
126 const QString
data = thread->
data();
127 thread->wait();
128 thread->deleteLater();
129 emit
downloadFailed(
"Download thread terminated", urltofile, localtargetfile,
data );
130
131
132
133
134}
◆ isDownloading()
| bool VP1HttpGetFile::isDownloading |
( |
const QString & | urltofile | ) |
const |
Definition at line 137 of file VP1HttpGetFile.cxx.
138{
139 for( VP1HttpGetFile_DownloadThread * thread :
m_d->activeDownloadThreads)
141 QTimer::singleShot(0, thread, SLOT(checkForStall()));
142 return true;
143 }
144 return false;
145}
◆ isDownloadingTo()
| bool VP1HttpGetFile::isDownloadingTo |
( |
const QString & | localtargetfile | ) |
const |
Definition at line 148 of file VP1HttpGetFile.cxx.
149{
150 for( VP1HttpGetFile_DownloadThread * thread :
m_d->activeDownloadThreads)
152 QTimer::singleShot(0, thread, SLOT(checkForStall()));
153 return true;
154 }
155 return false;
156}
◆ maxNumberOfPendingDownloads()
| unsigned VP1HttpGetFile::maxNumberOfPendingDownloads |
( |
| ) |
const |
◆ numberOfPendingDownloads()
| unsigned VP1HttpGetFile::numberOfPendingDownloads |
( |
| ) |
const |
◆ setMaxNumberOfPendingDownloads()
| void VP1HttpGetFile::setMaxNumberOfPendingDownloads |
( |
unsigned | n | ) |
|
◆ startDownload()
| QString VP1HttpGetFile::startDownload |
( |
const QString & | urltofile, |
|
|
const QString & | localtargetfile, |
|
|
const QString & | md5sum = "", |
|
|
const QString & | data = "" ) |
Definition at line 73 of file VP1HttpGetFile.cxx.
77{
78 if (
m_d->maxDownloads>0 &&
unsigned(
m_d->activeDownloadThreads.count()) >=
m_d->maxDownloads)
79 return "Too many simultaneous downloads requested";
80
82 return "Already downloading file to location: "+localtargetfile;
83
84 VP1HttpGetFile_DownloadThread * thread =
new VP1HttpGetFile_DownloadThread( urltofile, localtargetfile, md5sum,
data);
87 m_d->activeDownloadThreads << thread;
88 thread->start();
89
90 return "";
91}
void downloadThreadTerminated()
void downloadThreadFinished()
bool isDownloadingTo(const QString &localtargetfile) const
◆ m_d
The documentation for this class was generated from the following files: