270616d39c5de0a67d9e8cb28489de019d9e24e0
[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(int checkingInterval
41                READ checkingInterval WRITE setCheckingInterval
42                NOTIFY checkingIntervalChanged)
43     Q_PROPERTY(bool autoUpdate
44                READ autoUpdate WRITE setAutoUpdate
45                NOTIFY autoUpdateChanged)
46     Q_PROPERTY(bool stationViewPreferred
47                READ stationViewPreferred WRITE setStationViewPreferred
48                NOTIFY stationViewPreferredChanged)
49     Q_PROPERTY(bool showArrivalsPreferred
50                READ showArrivalsPreferred WRITE setShowArrivalsPreferred
51                NOTIFY showArrivalsPreferredChanged)
52     Q_PROPERTY(StationListProxyModel::SortingMode stationListSortingMode
53                READ stationListSortingMode WRITE setStationListSortingMode
54                NOTIFY stationListSortingModeChanged)
55     Q_PROPERTY(bool darkThemePreferred
56                READ darkThemePreferred WRITE setDarkThemePreferred
57                NOTIFY darkThemePreferredChanged)
58     Q_PROPERTY(QString versionString READ versionString CONSTANT)
59 public:
60     explicit Settings(QObject *parent = 0);
61     ~Settings();
62     Q_INVOKABLE static Settings *instance();
63
64     Q_INVOKABLE void save(void);
65
66     QString queryBaseUrl();
67     void setQueryBaseUrl(const QString &url);
68
69     QStringList recentStations();
70     void setRecentStations(const QStringList &stations);
71
72     int checkingInterval();
73     void setCheckingInterval(int);
74
75     bool autoUpdate();
76     void setAutoUpdate(bool);
77
78     bool stationViewPreferred();
79     void setStationViewPreferred(bool);
80
81     bool showArrivalsPreferred();
82     void setShowArrivalsPreferred(bool);
83
84     bool darkThemePreferred();
85     void setDarkThemePreferred(bool);
86
87     StationListProxyModel::SortingMode stationListSortingMode();
88     void setStationListSortingMode(StationListProxyModel::SortingMode mode);
89
90     QString versionString(void);
91
92 signals:
93     void queryBaseUrlChanged();
94     void recentStationsChanged();
95     void checkingIntervalChanged();
96     void autoUpdateChanged();
97     void stationViewPreferredChanged();
98     void showArrivalsPreferredChanged();
99     void darkThemePreferredChanged();
100     void stationListSortingModeChanged();
101 };
102
103 #endif // SETTINGS_H