Kstars

skyobjdescription.h
1/*
2 SPDX-FileCopyrightText: 2013 Vijay Dhameliya <vijay.atwork13@gmail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QObject>
10#include <QByteArray>
11#include <QString>
12#include <QNetworkAccessManager>
13#include <QNetworkRequest>
14#include <QNetworkReply>
15
16/**
17 * @class SkyObjDescription
18 *
19 * Fetches short description for various sky object from wikipedia.
20 *
21 * @author Vijay Dhameliya
22 */
24{
26
27 public:
28 /**
29 * @brief Constructor sends request to network for data from wikipedia API and starts
30 * downloading data from QUrl
31 * @param soName SkyObject name
32 * @param soType SkyObject type
33 */
34 explicit SkyObjDescription(const QString soName, const QString soType);
35
36 virtual ~SkyObjDescription() override = default;
37
38 /** @return returns description if it was available on wikipedia else returns empty string */
39 QString downloadedData() const { return m_description; }
40
41 /** @return returns wikipedia link for skyobject */
42 QString url() const { return m_url; }
43
44 signals:
45 void downloaded();
46
47 private slots:
48 /**
49 * @brief parse downloaded data to extract description of SkyObject when downloading is finished
50 *
51 * @param reply
52 */
53 void fileDownloaded(QNetworkReply *reply);
54
55 private:
56 QString soName, soType, m_description, m_url;
57 QNetworkAccessManager *manager { nullptr };
58 QByteArray m_DownloadedData;
59};
Fetches short description for various sky object from wikipedia.
QString downloadedData() const
QString url() const
SkyObjDescription(const QString soName, const QString soType)
Constructor sends request to network for data from wikipedia API and starts downloading data from QUr...
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Oct 11 2024 12:15:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.