QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qvweather.h
1 /* QVisu (c) 2015 Maximilian Gauger mgauger@kalassi.de
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12 
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef QVWEATHER_H
18 #define QVWEATHER_H
19 
20 #include <QDateTime>
21 #include <QtXml>
22 #include <QLabel>
23 #include <QNetworkAccessManager>
24 #include <QUrl>
25 #include <QTimer>
26 #include "../qvelement.h"
27 #include "../qvsvgwidget.h"
28 
30 public:
31  weather_value() {
32  valid = false;
33  }
34 
35  bool valid;
36  double value;
37  QString unit;
38  int timespan;
39 
40 };
41 
43 public:
45  temperature,
46  windDirection,
47  windSpeed,
48  humidity,
49  pressure,
50  cloudiness,
51  fog,
52  precipitation;
53 };
54 
55 class QVWeather : public QVElement
56 {
57  Q_OBJECT
58 public:
59  explicit QVWeather(QDomElement xml_desc, QString container, QWidget *parent = 0);
60  void resizeEvent(QResizeEvent*);
61 
62 signals:
63 
64 public slots:
65  void onXMLReceived(QDomElement);
66  void displayWeather();
67 
68 protected slots:
69  void dataReceived(QNetworkReply*);
70  void fetchAgain();
71 
72 private:
73  QMap<qint64,weather_entry*> weather_entries;
74 
75  QLabel *w_title;
76  QList<QVSvgWidget*> w_clouds, w_winddir;
77  QList<QLabel*> w_times, w_temp, w_separator;
78  QString s_svg_wind;
79  QString s_svg_weather;
80 
81  int n_days;
82 
83  QNetworkAccessManager *network_manager;
84  QTimer *fetch_timer;
85  int fetch_counter;
86  double latitude, longitude;
87 
88  const static int padding = 5;
89 };
90 
91 #endif // QVWEATHER_H
Definition: qvweather.h:55
Definition: qvweather.h:42
Definition: qvweather.h:29
Definition: qvelement.h:34
void onXMLReceived(QDomElement)
Definition: qvweather.cpp:214
void resizeEvent(QResizeEvent *)
Definition: qvweather.cpp:199
QString container
Definition: qvelement.h:73