Kgapi

staticmaptilefetchjob.h
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#pragma once
10
11#include "job.h"
12#include "kgapimaps_export.h"
13
14#include <QPixmap>
15
16/**
17 * @brief A job to fetch a single map tile described by a StaticMapUrl
18 *
19 * @author Daniel Vrátil <dvratil@redhat.com>
20 * @since 2.0
21 */
22namespace KGAPI2
23{
24
25class StaticMapUrl;
26
27class KGAPIMAPS_EXPORT StaticMapTileFetchJob : public KGAPI2::Job
28{
29 Q_OBJECT
30
31public:
32 /**
33 * @brief Constructs a job that will fetch a map tile described by given
34 * @p url.
35 *
36 * @param url
37 * @param parent
38 */
39 explicit StaticMapTileFetchJob(const StaticMapUrl &url, QObject *parent = nullptr);
40
41 /**
42 * @overload StaticMapTileFetchJob(StaticMapUrl,QObject*)
43 *
44 * @param url
45 * @param parent
46 */
47 explicit StaticMapTileFetchJob(const QUrl &url, QObject *parent = nullptr);
48
49 /**
50 * @brief Destructor
51 */
52 ~StaticMapTileFetchJob() override;
53
54 /**
55 * @brief Pixmap with the fetched map tile.
56 *
57 * This method can only be called after the job has emitted Job::finished.
58 */
59 [[nodiscard]] QPixmap tilePixmap() const;
60
61protected:
62 /**
63 * @brief KGAPI2::Job::start implementation
64 */
65 void start() override;
66
67 /**
68 * @brief KGAPI2::Job::dispatchRequest implementation
69 *
70 * @param accessManager
71 * @param request
72 * @param data
73 * @param contentType
74 */
75 void dispatchRequest(QNetworkAccessManager *accessManager, const QNetworkRequest &request, const QByteArray &data, const QString &contentType) override;
76
77 /**
78 * @brief KGAPI2::Job::handleReply
79 *
80 * @param reply
81 * @param rawData
82 */
83 void handleReply(const QNetworkReply *reply, const QByteArray &rawData) override;
84
85private:
86 class Private;
87 Private *const d;
88 friend class Private;
89};
90
91} // namespace KGAPI2
Abstract base class for all jobs in LibKGAPI.
Definition job.h:41
Q_SCRIPTABLE Q_NOREPLY void start()
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.