Fix compiler warning.
[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_ShowLight = 0,
13         C_ShowRank,
14         C_ShowTime,
15         C_ShowHint,
16         C_UpdateOnWiFi,
17         C_UpdateOnGSM,
18     };
19
20 private:
21     QString _regionID;          // region ID which will be displayed
22     QMap<QString, QString> _cities;
23     QMap<check_t, bool> _checks;
24     int _updateIntervalIndex;
25
26     void makeDefault ();
27
28     void loadCities (QSettings *settings);
29     void saveCities (QSettings *settings);
30
31     int intervalIndex2Minutes (int index) const;
32     int minutes2IntervalIndex (int minutes) const;
33
34 public:
35     Settings ();
36
37     void load ();
38     void save ();
39
40     QString regionID () const
41     { return _regionID; };
42
43     void setRegionID (const QString &id)
44     { _regionID = id; };
45
46     QMap<QString, QString> cities () const
47     { return _cities; };
48
49     bool check (check_t entry) const
50     { return _checks[entry]; };
51
52     void setCheck (check_t entry, bool val)
53     { _checks[entry] = val; };
54
55     QStringList updateIntervals () const;
56
57     int getUpdateIntervalIndex () const
58     { return _updateIntervalIndex; };
59
60     void setUpdateIntervalIndex (int index)
61     { _updateIntervalIndex = index; };
62 };
63
64
65 #endif // __SETTINGS_H__