Add showArrivalsPreferred property to settings class
[quandoparte] / application / settings.h
1 #ifndef SETTINGS_H
2 #define SETTINGS_H
3
4 /*
5
6 Copyright (C) 2011 Luciano Montanaro <mikelima@cirulla.net>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; see the file COPYING.  If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA.
22
23 */
24
25 #include <QObject>
26 #include <QString>
27 #include <QStringList>
28
29 class Settings : public QObject
30 {
31     Q_OBJECT
32     Q_PROPERTY(QString queryBaseUrl
33                READ queryBaseUrl WRITE setQueryBaseUrl
34                NOTIFY queryBaseUrlChanged)
35     Q_PROPERTY(QStringList recentStations
36                READ recentStations WRITE setRecentStations
37                NOTIFY recentStationsChanged)
38     Q_PROPERTY(int checkingInterval
39                READ checkingInterval WRITE setCheckingInterval
40                NOTIFY checkingIntervalChanged)
41     Q_PROPERTY(bool stationViewPreferred
42                READ stationViewPreferred WRITE setStationViewPreferred
43                NOTIFY stationViewPreferredChanged)
44     Q_PROPERTY(bool showArrivalsPreferred
45                READ showArrivalsPreferred WRITE setShowArrivalsPreferred
46                NOTIFY showArrivalsPreferredChanged)
47
48 public:
49     explicit Settings(QObject *parent = 0);
50     ~Settings();
51     Q_INVOKABLE static Settings *instance();
52
53     Q_INVOKABLE void load(void);
54     Q_INVOKABLE void save(void);
55
56     QString queryBaseUrl();
57     void setQueryBaseUrl(const QString &url);
58
59     QStringList recentStations();
60     void setRecentStations(const QStringList &stations);
61
62     int checkingInterval();
63     void setCheckingInterval(int);
64
65     bool stationViewPreferred();
66     void setStationViewPreferred(bool);
67
68     bool showArrivalsPreferred();
69     void setShowArrivalsPreferred(bool);
70
71 signals:
72     void queryBaseUrlChanged(const QString &);
73     void recentStationsChanged(const QStringList &);
74     void checkingIntervalChanged(int);
75     void stationViewPreferredChanged(bool);
76     void showArrivalsPreferredChanged(bool);
77
78 public slots:
79
80 private:
81     QString m_queryBaseUrl;
82     QStringList m_recentStations;
83     int m_checkingInterval;
84     bool m_stationViewPreferred;
85     bool m_showArrivalsPreferred;
86 };
87
88 #endif // SETTINGS_H