-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftpdownload.h
62 lines (52 loc) · 1.2 KB
/
ftpdownload.h
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
62
#ifndef FTPDOWNLOAD_H
#define FTPDOWNLOAD_H
#include <QObject>
#include <QMutex>
#include <QtFtp/QFtp>
#include <QFile>
#include <QTcpSocket>
#include <QEventLoop>
#include <QNetworkProxy>
#ifdef QT_DEBUG
#include <QDebug>
#endif
class FTPDownload : public QObject
{
Q_OBJECT
public:
FTPDownload(QStringList data);
~FTPDownload();
void abort();
bool _abort;
bool _working;
int _tableRow = -1;
QString _id;
QFtp *ftp;
public slots:
void process();
private slots:
void isDone(bool);
void updateProgress(qint64, qint64);
void finishedDownload();
signals:
void finished();
void error(QString err);
void statusUpdateFile(QString id, int tableRow, QString statusMsg, int status);
void doProgress(QString id, int tableRow, qint64 read, qint64 total, bool overwriteTime, bool firstUpdate);
private:
QStringList data;
QFile *file;
QEventLoop *ftpLoop;
QMutex mutex;
QString id;
QString host;
QString port;
QString user;
QString pass;
QString dir;
QString dlpath;
QString dlfile;
int tableRow;
QNetworkProxy proxy;
};
#endif // FTPDOWNLOAD_H