aboutsummaryrefslogtreecommitdiff
path: root/staging/filterlist/test/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'staging/filterlist/test/main.cpp')
-rw-r--r--staging/filterlist/test/main.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/staging/filterlist/test/main.cpp b/staging/filterlist/test/main.cpp
deleted file mode 100644
index ccaae47..0000000
--- a/staging/filterlist/test/main.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "downloadmanager.h"
-#include <QtCore>
-
-int main(int argc, char **argv)
-{
- if(argc != 2) {
- qDebug("Usage: %s filters.txt", argv[0]);
- return 77;
- }
-
- QCoreApplication app(argc, argv);
-
- DownloadManager manager;
- QSettings listconf(argv[1], QSettings::IniFormat);
-
- QVector<QNetworkReply *> downloads;
-
- qDebug("Filters:");
- for(auto &g : listconf.childGroups()) {
- listconf.beginGroup(g);
- const auto url = listconf.value("Href").toUrl();
- qDebug("|%s |%s|", qUtf8Printable(g.leftJustified(16, ' ', true)), qUtf8Printable(listconf.value("Href").toString().leftJustified(100, ' ', true)));
- auto *reply = manager.download(url);
- downloads.append(reply);
-
- QObject::connect(reply, &QNetworkReply::finished, [&downloads, reply]() {
- if(reply->error() == QNetworkReply::NoError) {
- qDebug("downloaded %s", qUtf8Printable(reply->url().toString()));
- } else {
- qDebug("failed %s", qUtf8Printable(reply->url().toString()));
- qDebug("error [%i]: %s", reply->error(), qUtf8Printable(reply->errorString()));
- }
-
- downloads.removeAll(reply);
- if(downloads.isEmpty()) {
- QCoreApplication::instance()->quit();
- }
- });
- listconf.endGroup();
- }
- qDebug("---");
-
- return app.exec();
-}