File indexing completed on 2025-02-02 05:02:34
0001 /* 0002 SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef SETTINGS_H 0008 #define SETTINGS_H 0009 0010 #include <QObject> 0011 0012 /** Application settings accessible by QML. */ 0013 class Settings : public QObject 0014 { 0015 Q_OBJECT 0016 Q_PROPERTY(bool weatherForecastEnabled READ weatherForecastEnabled WRITE setWeatherForecastEnabled NOTIFY weatherForecastEnabledChanged) 0017 Q_PROPERTY(QString homeCountryIsoCode READ homeCountryIsoCode WRITE setHomeCountryIsoCode NOTIFY homeCountryIsoCodeChanged) 0018 Q_PROPERTY(bool queryLiveData READ queryLiveData WRITE setQueryLiveData NOTIFY queryLiveDataChanged) 0019 Q_PROPERTY(bool preloadMapData READ preloadMapData WRITE setPreloadMapData NOTIFY preloadMapDataChanged) 0020 0021 Q_PROPERTY(bool performCurrencyConversion READ performCurrencyConversion WRITE setPerformCurrencyConversion NOTIFY performCurrencyConversionChanged) 0022 0023 Q_PROPERTY(bool autoAddTransfers READ autoAddTransfers WRITE setAutoAddTransfers NOTIFY autoAddTransfersChanged) 0024 Q_PROPERTY(bool autoFillTransfers READ autoFillTransfers WRITE setAutoFillTransfers NOTIFY autoFillTransfersChanged) 0025 0026 Q_PROPERTY(bool showNotificationOnLockScreen READ showNotificationOnLockScreen WRITE setShowNotificationOnLockScreen NOTIFY showNotificationOnLockScreenChanged) 0027 0028 Q_PROPERTY(bool osmContributorMode MEMBER m_osmContributorMode WRITE setOsmContributorMode NOTIFY osmContributorModeChanged) 0029 Q_PROPERTY(bool developmentMode READ developmentMode WRITE setDevelopmentMode NOTIFY developmentModeChanged) 0030 0031 public: 0032 explicit Settings(QObject *parent = nullptr); 0033 ~Settings() override; 0034 0035 Q_INVOKABLE QVariant read(const QString &key, const QVariant &defaultValue) const; 0036 Q_INVOKABLE void write(const QString &key, const QVariant &value); 0037 0038 bool weatherForecastEnabled() const; 0039 void setWeatherForecastEnabled(bool enabled); 0040 0041 QString homeCountryIsoCode() const; 0042 void setHomeCountryIsoCode(const QString &isoCode); 0043 0044 bool queryLiveData() const; 0045 void setQueryLiveData(bool queryLiveData); 0046 0047 bool preloadMapData() const; 0048 void setPreloadMapData(bool preload); 0049 0050 bool performCurrencyConversion() const; 0051 void setPerformCurrencyConversion(bool enable); 0052 0053 bool autoAddTransfers() const; 0054 void setAutoAddTransfers(bool autoAdd); 0055 bool autoFillTransfers() const; 0056 void setAutoFillTransfers(bool autoFill); 0057 0058 bool showNotificationOnLockScreen() const; 0059 void setShowNotificationOnLockScreen(bool enabled); 0060 0061 void setOsmContributorMode(bool enabled); 0062 0063 bool developmentMode() const; 0064 void setDevelopmentMode(bool enabled); 0065 0066 Q_SIGNALS: 0067 void weatherForecastEnabledChanged(bool enabled); 0068 void homeCountryIsoCodeChanged(const QString &isoCode); 0069 void queryLiveDataChanged(bool enabled); 0070 void preloadMapDataChanged(bool preload); 0071 void performCurrencyConversionChanged(bool enabled); 0072 void autoAddTransfersChanged(bool autoAdd); 0073 void autoFillTransfersChanged(bool autoFill); 0074 void showNotificationOnLockScreenChanged(bool enabled); 0075 void developmentModeChanged(bool enabled); 0076 void osmContributorModeChanged(bool enabled); 0077 0078 private: 0079 QString m_homeCountry; 0080 bool m_weatherEnabled = false; 0081 bool m_queryLiveData = false; 0082 bool m_preloadMapData = false; 0083 bool m_currencyConversion = false; 0084 bool m_autoAddTransfers = true; 0085 bool m_autoFillTransfers = false; 0086 bool m_showNotificationOnLockScreen = false; 0087 bool m_osmContributorMode = false; 0088 bool m_developmentMode = false; 0089 }; 0090 0091 #endif // SETTINGS_H