499c69a7af67a5be7d705e78dab06998d2e0a185
[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 #ifdef Q_WS_MAEMO_6
24 #include <MApplicationPage>
25 #include <MLabel>
26 #include <MButton>
27 #include <MComboBox>
28 #else
29 #include <QMainWindow>
30 #include <QActionGroup>
31 #include <QLabel>
32 #include <QPushButton>
33 #endif
34
35 #include "forecastwidget.h"
36 #include "medarddownloader.h"
37
38 #ifdef Q_WS_MAEMO_6
39 class MainWindow : public MApplicationPage
40 #else
41 class MainWindow : public QMainWindow
42 #endif
43 {
44     Q_OBJECT
45
46 public:
47 #ifdef Q_WS_MAEMO_6
48     MainWindow(QGraphicsItem *parent = 0);
49 #else
50     MainWindow(QWidget *parent = 0);
51 #endif
52     virtual ~MainWindow();
53
54 private slots:
55     void seaLevelPreasureMenuClicked();
56     void precipitationMenuClicked();
57     void windVelocityMenuClicked();
58     void cloudinessMenuClicked();
59     void temperatureMenuClicked();
60     void aboutMenuClicked();
61
62     void downloadAgainClicked();
63
64     void plusDayClicked();
65     void minusDayClicked();
66     void plusHourClicked();
67     void minusHourClicked();
68
69     void forecastTypeChanged(const QString label, MedardDownloader::ForecastType type);
70     void forecastDateOffsetChanged(int offset);
71 #if Q_WS_MAEMO_6
72     void forecastDomainChanged(int index);
73 #else
74     void forecastDomainChanged(QAction *action);
75 #endif
76
77     void downloadedFinished(const QString &filename, const QDateTime &date);
78     void downloadFailed();
79
80 private:
81     void setupUi();
82     void setupMenu();
83     void loadSettings();
84
85     void showNavigationButtons();
86     void hideNavigationButtons(bool showRetryButton);
87     void updateNavigationButtons();
88
89 private:
90     MedardDownloader *m_downloader;
91
92     ForecastWidget *m_forecast;
93 #if Q_WS_MAEMO_6
94     MLabel *m_forecastTypeLabel;
95     MLabel *m_forecastInitialDateLabel;
96     MLabel *m_forecastDateLabel;
97
98     MButton *m_downloadRetryButton;
99
100     MButton *m_minusDayButton;
101     MButton *m_plusDayButton;
102     MButton *m_minusHourButton;
103     MButton *m_plusHourButton;
104
105     MComboBox *m_domainComboBox;
106 #else
107     QLabel *m_forecastTypeLabel;
108     QLabel *m_forecastInitialDateLabel;
109     QLabel *m_forecastDateLabel;
110
111     QPushButton *m_downloadRetryButton;
112
113     QPushButton *m_minusDayButton;
114     QPushButton *m_plusDayButton;
115     QPushButton *m_minusHourButton;
116     QPushButton *m_plusHourButton;
117
118     QActionGroup *m_domainActionGroup;
119 #endif
120
121 };
122
123 #endif // MAINWINDOW_H