Marble

HttpJob.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 // SPDX-FileCopyrightText: 2008, 2009 Jens-Michael Hoffmann <[email protected]>
6 // SPDX-FileCopyrightText: 2008 Pino Toscano <[email protected]>
7 //
8 
9 #ifndef MARBLE_HTTPJOB_H
10 #define MARBLE_HTTPJOB_H
11 
12 #include <QObject>
13 #include <QNetworkReply>
14 
15 #include "MarbleGlobal.h"
16 
17 #include "marble_export.h"
18 
20 class QString;
21 class QByteArray;
22 class QUrl;
23 
24 namespace Marble
25 {
26 class HttpJobPrivate;
27 
28 class MARBLE_EXPORT HttpJob: public QObject
29 {
30  Q_OBJECT
31 
32  public:
33  HttpJob( const QUrl & sourceUrl, const QString & destFileName, const QString &id, QNetworkAccessManager *networkAccessManager );
34  ~HttpJob() override;
35 
36  QUrl sourceUrl() const;
37  void setSourceUrl( const QUrl & );
38 
39  QString initiatorId() const;
40  void setInitiatorId( const QString & );
41 
42  QString destinationFileName() const;
43  void setDestinationFileName( const QString & );
44 
45  bool tryAgain();
46 
47  DownloadUsage downloadUsage() const;
48  void setDownloadUsage( const DownloadUsage );
49 
50  void setUserAgentPluginId( const QString & pluginId ) const;
51 
52  QByteArray userAgent() const;
53 
54  Q_SIGNALS:
55  /**
56  * errorCode contains 0, if there was no error and 1 otherwise
57  */
58  void jobDone( HttpJob *, int errorCode );
59  void redirected( HttpJob * job, const QUrl& redirectionTarget );
60 
61  /**
62  * This signal is emitted if the data was successfully received and
63  * the argument data contains completely the downloaded content.
64  */
65  void dataReceived( HttpJob * job, const QByteArray& data );
66 
67  public Q_SLOTS:
68  void execute();
69 
70 private Q_SLOTS:
71  void downloadProgress( qint64 bytesReceived, qint64 bytesTotal );
73  void finished();
74 
75  private:
76  Q_DISABLE_COPY( HttpJob )
77  HttpJobPrivate *const d;
78  friend class HttpJobPrivate;
79 };
80 
81 }
82 
83 #endif
DownloadUsage
This enum is used to describe the type of download.
Definition: MarbleGlobal.h:153
Binds a QML item to a specific geodetic location in screen coordinates.
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.