Check for device state on update.
[yandex-traffic] / settingsDialog.hpp
1 #ifndef __SETTINGSDIALOG_H__
2 #define __SETTINGSDIALOG_H__
3
4 #include <QtGui>
5
6 #ifdef Q_WS_MAEMO_5
7 #include <QtMaemo5>
8 #else
9 #include "QtMaemo5Adapters.hpp"
10 #endif
11
12 #include "settings.hpp"
13
14
15 class SettingsDialog : public QDialog
16 {
17     Q_OBJECT
18
19 private:
20     QMaemo5ValueButton *_displayButton;
21     QMaemo5ValueButton *_updateButton;
22
23     Settings *_settings;
24
25     void updateDisplayButtonValue ();
26     void updateUpdateButtonValue ();
27
28 protected slots:
29     void displayClicked ();
30     void updateClicked ();
31
32 public:
33     SettingsDialog (Settings *settings);
34 };
35
36
37 class BaseSettingsDialog : public QDialog
38 {
39     Q_OBJECT
40 private:
41     Settings *_settings;
42     QVBoxLayout *_layout;
43     QPushButton *_saveButton;
44
45 protected slots:
46     void saveClicked ();
47
48 protected:
49     Settings* settings () const
50     { return _settings; };
51
52     QVBoxLayout* layout () const
53     { return _layout; };
54
55     virtual void saveSettings () = 0;
56
57 public:
58     BaseSettingsDialog (Settings *settings);
59 };
60
61
62 class DisplaySettingsDialog : public BaseSettingsDialog
63 {
64     Q_OBJECT
65
66 private:
67     QListWidget *_cities;
68     QCheckBox *_showLight, *_showRank, *_showTime, *_showHint;
69
70     void initCities (QBoxLayout *layout);
71     void initChecks (QBoxLayout *layout);
72
73 protected:
74     virtual void saveSettings ();
75
76 public:
77     DisplaySettingsDialog (Settings *settings);
78 };
79
80
81 class UpdateSettingsDialog : public BaseSettingsDialog
82 {
83     Q_OBJECT
84
85 private:
86     QMaemo5ValueButton *_intervalButton;
87     QCheckBox *_wifiUpdate, *_gsmUpdate, *_lockedUpdate;
88
89     void initUpdateInterval (QBoxLayout *layout);
90
91 protected:
92     virtual void saveSettings ();
93
94 public:
95     UpdateSettingsDialog (Settings *settings);
96 };
97
98
99 #endif // __SETTINGSDIALOG_H__