a281e5b78568da5cea5fd77ba59dad22b82e386b
[medard] / src / mainwindow.h
1 /*
2  *  Medard for Maemo.
3  *  Copyright (C) 2011 Roman Moravcik
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #ifndef MAINWINDOW_H
21 #define MAINWINDOW_H
22
23 #include <QMainWindow>
24 #include <QActionGroup>
25 #include <QLabel>
26 #include <QPushButton>
27
28 #include "forecastwidget.h"
29 #include "medarddownloader.h"
30
31 class MainWindow : public QMainWindow
32 {
33     Q_OBJECT
34
35 public:
36     MainWindow(QWidget *parent = 0);
37     virtual ~MainWindow();
38
39 private slots:
40     void seaLevelPreasureMenuClicked();
41     void precipitationMenuClicked();
42     void windVelocityMenuClicked();
43     void cloudinessMenuClicked();
44     void temperatureMenuClicked();
45
46     void downloadAgainClicked();
47
48     void plusDayClicked();
49     void minusDayClicked();
50     void plusHourClicked();
51     void minusHourClicked();
52
53     void forecastTypeChanged(const QString label, MedardDownloader::ForecastType type);
54     void forecastDateOffsetChanged(int offset);
55     void forecastDomainChanged(QAction *action);
56
57     void downloadedFinished(const QString &filename, const QDateTime &date);
58     void downloadFailed();
59
60 private:
61     void setupUi();
62     void setupMenu();
63     void loadSettings();
64
65     void showNavigationButtons();
66     void hideNavigationButtons(bool showRetryButton);
67     void updateNavigationButtons();
68
69 private:
70     MedardDownloader *m_downloader;
71
72     ForecastWidget *m_forecast;
73     QLabel *m_forecastTypeLabel;
74     QLabel *m_forecastInitialDateLabel;
75     QLabel *m_forecastDateLabel;
76
77     QPushButton *m_downloadRetryButton;
78
79     QPushButton *m_minusDayButton;
80     QPushButton *m_plusDayButton;
81     QPushButton *m_minusHourButton;
82     QPushButton *m_plusHourButton;
83
84     QActionGroup *m_domainActionGroup;
85 };
86
87 #endif // MAINWINDOW_H