Updated qmake file, bumped version
[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 "stationlistproxymodel.h"
26 #include <QObject>
27 #include <QSettings>
28 #include <QString>
29 #include <QStringList>
30
31 class Settings : public QObject
32 {
33     Q_OBJECT
34     Q_PROPERTY(QString queryBaseUrl
35                READ queryBaseUrl WRITE setQueryBaseUrl
36                NOTIFY queryBaseUrlChanged)
37     Q_PROPERTY(QStringList recentStations
38                READ recentStations WRITE setRecentStations
39                NOTIFY recentStationsChanged)
40     Q_PROPERTY(QStringList favoriteStations
41                READ favoriteStations WRITE setFavoriteStations
42                NOTIFY favoriteStationsChanged)
43     Q_PROPERTY(int checkingInterval
44                READ checkingInterval WRITE setCheckingInterval
45                NOTIFY checkingIntervalChanged)
46     Q_PROPERTY(bool autoUpdate
47                READ autoUpdate WRITE setAutoUpdate
48                NOTIFY autoUpdateChanged)
49     Q_PROPERTY(bool stationViewPreferred
50                READ stationViewPreferred WRITE setStationViewPreferred
51                NOTIFY stationViewPreferredChanged)
52     Q_PROPERTY(bool showArrivalsPreferred
53                READ showArrivalsPreferred WRITE setShowArrivalsPreferred
54                NOTIFY showArrivalsPreferredChanged)
55     Q_PROPERTY(StationListProxyModel::SortingMode stationListSortingMode
56                READ stationListSortingMode WRITE setStationListSortingMode
57                NOTIFY stationListSortingModeChanged)
58     Q_PROPERTY(bool darkThemePreferred
59                READ darkThemePreferred WRITE setDarkThemePreferred
60                NOTIFY darkThemePreferredChanged)
61     Q_PROPERTY(QString versionString READ versionString CONSTANT)
62 public:
63     explicit Settings(QObject *parent = 0);
64     ~Settings();
65     Q_INVOKABLE static Settings *instance();
66
67     Q_INVOKABLE void save(void);
68
69     QString queryBaseUrl();
70     void setQueryBaseUrl(const QString &url);
71
72     QStringList recentStations();
73     void setRecentStations(const QStringList &stations);
74
75     QStringList favoriteStations();
76     void setFavoriteStations(const QStringList &stations);
77
78     int checkingInterval();
79     void setCheckingInterval(int);
80
81     bool autoUpdate();
82     void setAutoUpdate(bool);
83
84     bool stationViewPreferred();
85     void setStationViewPreferred(bool);
86
87     bool showArrivalsPreferred();
88     void setShowArrivalsPreferred(bool);
89
90     bool darkThemePreferred();
91     void setDarkThemePreferred(bool);
92
93     StationListProxyModel::SortingMode stationListSortingMode();
94     void setStationListSortingMode(StationListProxyModel::SortingMode mode);
95
96     QString versionString(void);
97
98 signals:
99     void queryBaseUrlChanged();
100     void recentStationsChanged();
101     void favoriteStationsChanged();
102     void checkingIntervalChanged();
103     void autoUpdateChanged();
104     void stationViewPreferredChanged();
105     void showArrivalsPreferredChanged();
106     void darkThemePreferredChanged();
107     void stationListSortingModeChanged();
108 };
109
110 #endif // SETTINGS_H