summaryrefslogtreecommitdiffstats
path: root/examples/network/downloadmanager/downloadmanager.h
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2023-02-27 15:16:34 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2023-03-02 12:08:09 +0100
commiteb61d49ab3a4f4d9dae3ccfdaf416190fb168c27 (patch)
treefbb6b1a95eacbc3ce11d359ce99420b7e56e7acb /examples/network/downloadmanager/downloadmanager.h
parent8dbceaa398d92c9c7492ffeb483f2bd6fab30c17 (diff)
Delete the Network Download (Manager)? examples
Their use of QtNetwork is already covered by the HTTP example. While showcasing that QNAM easily deals with multiple simultaneous requests, waiting until finished() is emitted to write anything is not exactly idiomatic. And managing your own queue to only have one request running at a time is a weird example for an asynchronous framework. In this regard, having an example for a complete download manager (with a GUI) would be interesting, but may ultimately be very time-consuming to make for limited gain. Task-number: QTBUG-110643 Pick-to: 6.5 Change-Id: I6b2c1546b85fa89ab7ce1ff5565b0293b5710b74 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Diffstat (limited to 'examples/network/downloadmanager/downloadmanager.h')
-rw-r--r--examples/network/downloadmanager/downloadmanager.h46
1 files changed, 0 insertions, 46 deletions
diff --git a/examples/network/downloadmanager/downloadmanager.h b/examples/network/downloadmanager/downloadmanager.h
deleted file mode 100644
index 4293bce26b..0000000000
--- a/examples/network/downloadmanager/downloadmanager.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef DOWNLOADMANAGER_H
-#define DOWNLOADMANAGER_H
-
-#include <QtNetwork>
-#include <QtCore>
-
-#include "textprogressbar.h"
-
-class DownloadManager: public QObject
-{
- Q_OBJECT
-public:
- explicit DownloadManager(QObject *parent = nullptr);
-
- void append(const QUrl &url);
- void append(const QStringList &urls);
- static QString saveFileName(const QUrl &url);
-
-signals:
- void finished();
-
-private slots:
- void startNextDownload();
- void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
- void downloadFinished();
- void downloadReadyRead();
-
-private:
- bool isHttpRedirect() const;
- void reportRedirect();
-
- QNetworkAccessManager manager;
- QQueue<QUrl> downloadQueue;
- QNetworkReply *currentDownload = nullptr;
- QFile output;
- QElapsedTimer downloadTimer;
- TextProgressBar progressBar;
-
- int downloadedCount = 0;
- int totalCount = 0;
-};
-
-#endif