KNewStuff

httpworker.h
1 /*
2  SPDX-FileCopyrightText: 2016 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #ifndef HTTPWORKER_H
8 #define HTTPWORKER_H
9 
10 #include <QThread>
11 #include <QUrl>
12 
13 class QNetworkReply;
14 namespace KNSCore {
15 
16 class HTTPWorker : public QObject {
17  Q_OBJECT
18 public:
19  enum JobType {
20  GetJob,
21  DownloadJob // Much the same as a get... except with a filesystem destination, rather than outputting data
22  };
23  explicit HTTPWorker(const QUrl& url, JobType jobType = GetJob, QObject* parent = nullptr);
24  explicit HTTPWorker(const QUrl& source, const QUrl& destination, JobType jobType = DownloadJob, QObject* parent = nullptr);
25  virtual ~HTTPWorker();
26 
27  void startRequest();
28 
29  void setUrl(const QUrl& url);
30 
31  Q_SIGNAL void error(QString error);
32  Q_SIGNAL void progress(qlonglong current, qlonglong total);
33  Q_SIGNAL void completed();
34  Q_SIGNAL void data(const QByteArray& data);
35 
36  Q_SLOT void handleReadyRead();
37  Q_SLOT void handleFinished();
38  Q_SLOT void handleData(const QByteArray& data);
39 private:
40  class Private;
41  Private* d;
42 };
43 
44 }
45 
46 #endif//HTTPWORKER_H
47 
Contains the core functionality for handling interaction with NewStuff providers. ...
Q_OBJECTQ_OBJECT
Q_SLOTQ_SLOT
void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Q_SIGNALQ_SIGNAL
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:43:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.