Menu

[c54480]: / download-agent.h  Maximize  Restore  History

Download this file

63 lines (50 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <QCoreApplication>
#include <QFile>
#include <QFileInfo>
#include <QList>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSslError>
#include <QStringList>
#include <QTemporaryFile>
#include <QTimer>
#include <QUrl>
#include <stdio.h>
QT_BEGIN_NAMESPACE
class QSslError;
QT_END_NAMESPACE
QT_USE_NAMESPACE
class VymModel;
class DownloadAgent: public QObject
{
Q_OBJECT
QNetworkAccessManager agent;
QList<QNetworkReply *> currentDownloads;
public:
DownloadAgent(const QUrl &u);
~DownloadAgent();
QString getDestination ();
void setFinishedAction (VymModel *m, const QString &script);
QString getFinishedScript();
uint getFinishedScriptModelID();
void setUserAgent(const QString &s);
bool isSuccess();
QString getResultMessage();
void doDownload(const QUrl &url);
bool saveToDisk(const QString &filename, const QByteArray &data);
public slots:
void execute();
void requestFinished(QNetworkReply *reply);
void sslErrors(const QList<QSslError> &errors);
signals:
void downloadFinished();
private:
QString tmpFilePath;
QByteArray userAgent;
QUrl url;
bool success;
QString resultMessage;
QString finishedScript;
uint finishedScriptModelID;
};
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.