Fixed toolbar and menu items.
[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 #if Q_WS_MAEMO_6
70     void forecastDomainChanged(int index);
71     void forecastTypeChanged(int index);
72 #else
73     void forecastDomainChanged(QAction *action);
74 #endif
75
76     void downloadedFinished(const QString &filename, const QDateTime &date);
77     void downloadFailed();
78
79 private:
80     void setupUi();
81     void setupMenu();
82     void loadSettings();
83
84     void showNavigationButtons();
85     void hideNavigationButtons(bool showRetryButton);
86     void updateNavigationButtons();
87
88     void setForecastType(const QString label, MedardDownloader::ForecastType type);
89     void setForecastDateOffset(int offset);
90
91 private:
92     MedardDownloader *m_downloader;
93
94     ForecastWidget *m_forecast;
95 #if Q_WS_MAEMO_6
96     MLabel *m_forecastTypeLabel;
97     MLabel *m_forecastInitialDateLabel;
98     MLabel *m_forecastDateLabel;
99
100     MButton *m_downloadRetryButton;
101
102     MButton *m_minusDayButton;
103     MButton *m_plusDayButton;
104     MButton *m_minusHourButton;
105     MButton *m_plusHourButton;
106
107     MComboBox *m_forecastDomainComboBox;
108     MComboBox *m_forecastTypeComboBox;
109 #else
110     QLabel *m_forecastTypeLabel;
111     QLabel *m_forecastInitialDateLabel;
112     QLabel *m_forecastDateLabel;
113
114     QPushButton *m_downloadRetryButton;
115
116     QPushButton *m_minusDayButton;
117     QPushButton *m_plusDayButton;
118     QPushButton *m_minusHourButton;
119     QPushButton *m_plusHourButton;
120
121     QActionGroup *m_domainActionGroup;
122 #endif
123
124 };
125
126 #endif // MAINWINDOW_H