-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweatherprovider.h
More file actions
59 lines (42 loc) · 1.07 KB
/
Copy pathweatherprovider.h
File metadata and controls
59 lines (42 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (C) 2023 Jeremy Nieth
#ifndef WEATHERPROVIDER_H
#define WEATHERPROVIDER_H
#include <QObject>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QUrl>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonValue>
#include <QJsonObject>
#include <QPixmap>
#include <QTimer>
class WeatherProvider : public QObject
{
Q_OBJECT
typedef struct {
QString curTemp;
QString curWeather;
QString curHigh;
QString curLow;
QPixmap curIcon;
} _weatherShort;
typedef struct {
} _weatherDetailed;
public:
explicit WeatherProvider(QObject *parent = nullptr);
_weatherShort getWeatherCurrent() const;
_weatherDetailed getWeather5Days() const;
private:
QNetworkAccessManager *net;
QTimer *requestTimer;
_weatherShort weatherCurrent;
_weatherDetailed weather5Days;
signals:
void weatherReady();
private slots:
void updateWeather();
void requestFinished(QNetworkReply* apiReply);
};
#endif // WEATHERPROVIDER_H