File indexing completed on 2024-04-21 03:43:59

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Pavel Mraz
0003 
0004     SPDX-FileCopyrightText: 2017 Jasem Mutlaq
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef URLFILEDOWNLOAD_H
0010 #define URLFILEDOWNLOAD_H
0011 
0012 #include "hips.h"
0013 
0014 #include <QtNetwork>
0015 
0016 class UrlFileDownload : public QObject
0017 {
0018   Q_OBJECT
0019 public:
0020   explicit UrlFileDownload(QObject *parent, QNetworkDiskCache *cache);
0021   void begin(const QUrl &url, const pixCacheKey_t &key);
0022   void abortAll();
0023 
0024 signals:
0025   void sigDownloadDone(QNetworkReply::NetworkError error, QByteArray &data, pixCacheKey_t &key);
0026   void sigAbort();
0027 
0028 public slots:    
0029 
0030 private slots:
0031   void downloadFinished(QNetworkReply *reply);
0032 
0033 private:    
0034   QNetworkAccessManager m_manager;
0035 };
0036 
0037 #endif // URLFILEDOWNLOAD_H