Handle checkboxes in settings dialog.
[yandex-traffic] / settings.hpp
1 #ifndef __SETTINGS_H__
2 #define __SETTINGS_H__
3
4 #include <QtCore>
5
6
7 class Settings : public QObject
8 {
9     Q_OBJECT
10 public:
11     enum check_t {
12         C_Light = 0,
13         C_Rank,
14         C_Time,
15         C_Hint,
16     };
17
18 private:
19     QString _regionID;          // region ID which will be displayed
20     QMap<QString, QString> _cities;
21     QMap<check_t, bool> _checks;
22
23     void makeDefault ();
24
25 public:
26     Settings ();
27
28     bool load ();
29     bool save ();
30
31     QString regionID () const
32     { return _regionID; };
33
34     QMap<QString, QString> cities () const
35     { return _cities; };
36
37     bool check (check_t entry) const
38     { return _checks[entry]; };
39
40     void setCheck (check_t entry, bool val)
41     { _checks[entry] = val; }
42 };
43
44
45 #endif // __SETTINGS_H__