Marble

HttpJob.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2008, 2009 Jens-Michael Hoffmann <jensmh@gmx.de>
6// SPDX-FileCopyrightText: 2008 Pino Toscano <pino@kde.org>
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
20class QString;
21class QByteArray;
22class QUrl;
23
24namespace Marble
25{
26class HttpJobPrivate;
27
28class 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
70private 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
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.