KWeatherCore

sunrisesource.h
1 /*
2  * SPDX-FileCopyrightText: 2020-2021 Han Young <[email protected]>
3  * SPDX-FileCopyrightText: 2020 Devin Lin <[email protected]>
4  *
5  * SPDX-License-Identifier: LGPL-2.0-or-later
6  */
7 #pragma once
8 #include "sunrise.h"
9 #include <QDateTime>
10 #include <QObject>
11 #include <kweathercore/kweathercore_export.h>
13 class QNetworkReply;
14 namespace KWeatherCore
15 {
16 /**
17  * @short The SunriseSource class can obtain the sunrise data of one location
18  * for several days
19  *
20  * @see Sunrise
21  *
22  * @author Han Young <[email protected]>
23  */
24 class KWEATHERCORE_EXPORT SunriseSource : public QObject
25 {
26  Q_OBJECT
27 public:
28  /**
29  * SunriseSource
30  * @param timezone timezone ID
31  * @param sunrise for caching purpose
32  */
33  SunriseSource(double latitude,
34  double longitude,
35  const QString &timezone = QString(),
36  const std::vector<Sunrise> &sunrise = std::vector<Sunrise>(),
37  QObject *parent = nullptr);
38  /**
39  * start downloading data
40  */
41  void requestData();
42  /**
43  * change the timezone
44  */
45  void setTimezone(const QString &timezone);
46  /**
47  * get the value
48  * @return
49  */
50  const std::vector<Sunrise> &value() const;
51 Q_SIGNALS:
52  /**
53  * network error
54  */
55  void networkError();
56  /**
57  * query finished
58  */
59  void finished();
60 private Q_SLOTS:
61  void parseResults(QNetworkReply *reply);
62 
63 private:
64  double m_latitude, m_longitude;
65  QString m_timezone;
66  std::vector<Sunrise> m_sunriseVec;
67  QNetworkAccessManager *m_manager = nullptr;
68 
69  void popDay();
70 };
71 }
The SunriseSource class can obtain the sunrise data of one location for several days.
Definition: sunrisesource.h:24
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 22 2021 23:03:35 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.