3 * Copyright (C) 2011 Roman Moravcik
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #ifndef MEDARDDOWNLOADER_H
21 #define MEDARDDOWNLOADER_H
28 #include <QtNetwork/QNetworkAccessManager>
29 #include <QtNetwork/QNetworkReply>
31 class MedardDownloader : public QObject
52 void setForecastType(ForecastType type);
54 void setForecastDomain(ForecastDomain domain);
56 void setForecastInitialDate(QDateTime date);
57 QDateTime forecastInitialDate();
58 QDateTime forecastDate();
60 void setForecastDateOffset(int offset);
61 int forecastDateOffset();
62 int minForecastDateOffset();
63 int maxForecastDateOffset();
70 void downloadFinished(const QString &filename, const QDateTime &date);
71 void downloadFailed();
74 void retryTimerEvent();
75 void clearDownloadRequest();
77 void downloadImageFinished();
78 void downloadImageError(QNetworkReply::NetworkError code);
80 void retrieveForecastInitialDateFinished();
81 void retrieveForecastInitialDateError(QNetworkReply::NetworkError code);
84 void tryDownloadImageAgain();
85 bool isDownloaded(const QString filename);
87 void retrieveForecastInitialDate();
89 void createCacheDirectory();
90 void cleanCacheDirectory();
93 QDateTime m_forecastInitialDate;
94 QString m_forecastInitialDateCode;
95 int m_forecastDateOffset;
96 QString m_forecastType;
97 QString m_forecastDomain;
99 QNetworkAccessManager *m_network;
100 QNetworkReply *m_reply;
103 QTimer *m_retryTimer;
108 #endif // MEDARDDOWNLOADER_H