Implement "Sequential downloading" feature

Closes #6835.
This commit is contained in:
Vladimir Golovnev (Glassez)
2018-06-21 17:50:40 +03:00
committed by sledgehammer999
parent c893729d62
commit 409e73c074
5 changed files with 226 additions and 115 deletions

View File

@@ -1,6 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2015 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2015, 2018 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2006 Christophe Dumez <chris@qbittorrent.org>
*
* This program is free software; you can redistribute it and/or
@@ -33,7 +33,6 @@
#include <QObject>
#include "downloadmanager.h"
class QNetworkAccessManager;
class QNetworkReply;
class QUrl;
@@ -44,10 +43,14 @@ namespace Net
class DownloadHandler : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(DownloadHandler)
friend class DownloadManager;
DownloadHandler(QNetworkReply *reply, DownloadManager *manager, const DownloadRequest &downloadRequest);
public:
DownloadHandler(QNetworkReply *reply, DownloadManager *manager, const DownloadRequest &downloadRequest);
~DownloadHandler();
~DownloadHandler() override;
QString url() const;
@@ -62,7 +65,7 @@ namespace Net
void checkDownloadSize(qint64 bytesReceived, qint64 bytesTotal);
private:
void init();
void assignNetworkReply(QNetworkReply *reply);
bool saveToFile(const QByteArray &replyData, QString &filePath);
void handleRedirection(QUrl newUrl);