1 #ifndef WEATHERWIDGET_H\r
2 #define WEATHERWIDGET_H\r
3 \r
4 #include <qglobal.h>\r
5 #include <QtGui>\r
6 #include <QtSvg/QSvgWidget>\r
7 \r
8 #if QT_VERSION >= 0x050000\r
9 \r
10 #include <QStackedWidget>\r
11 #include <QLabel>\r
12 #include <QHBoxLayout>\r
13 #include <QVBoxLayout>\r
14 \r
15 #endif\r
16 \r
17 class QLabel;\r
18 class WeatherData;\r
19 class WeatherDataWidget;\r
20 class ForecastDataWidget;\r
21 class GlobalSettings;\r
22 \r
23 class WeatherWidget : public QWidget\r
24 {\r
25 Q_OBJECT\r
26 public:\r
27 explicit WeatherWidget(QWidget *parent = 0);\r
28 void setCity(QString);\r
29 void setClock(QTime);\r
30 \r
31 void setWeatherData(WeatherData* weatherData);\r
32 WeatherData* weatherData();\r
33 \r
34 enum CurrentStatus { Updating, UpdateSuccess, UpdateFailed };\r
35 \r
36 QVariantHash getCurrentData();\r
37 \r
38 signals:\r
39 void valueChanged();\r
40 void webReloadRequested();\r
41 \r
42 public slots:\r
43 void setStatusUpdated();\r
44 void setStatusUpdating();\r
45 void setStatusFailed();\r
46 \r
47 void updateData();\r
48 \r
49 void mousePressEvent(QMouseEvent *);\r
50 \r
51 void advanceStatusWidget();\r
52 \r
53 \r
54 \r
55 \r
56 protected:\r
57 \r
58 private:\r
59 QString weatherStyleSheet;\r
60 QTime *clock;\r
61 QLabel *statusLabel;\r
62 QLabel *statusLabel2;\r
63 QLabel *statusMovieLabel;\r
64 QMovie *statusMovie;\r
65 QStackedWidget *statusStackedWidget;\r
66 WeatherDataWidget* weatherDataWidget;\r
67 ForecastDataWidget* forecastDataWidget;\r
68 WeatherData* m_weatherData;\r
69 \r
70 GlobalSettings *m_globalSettings;\r
71 \r
72 CurrentStatus m_currentStatus;\r
73 QTimer statusMessageTimer;\r
74 \r
75 //layout related functions\r
76 void buildStatusWidget();\r
77 };\r
78 \r
79 #endif // WEATHERWIDGET_H\r