2017-04-27 20:24:53 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2016-01-11 19:10:00 -02:00
|
|
|
#ifndef SETTINGSOBJECTWRAPPER_H
|
|
|
|
#define SETTINGSOBJECTWRAPPER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2016-09-04 07:52:18 -07:00
|
|
|
#include <QDate>
|
2016-01-11 19:10:00 -02:00
|
|
|
|
2018-06-29 08:57:27 +02:00
|
|
|
#include "core/pref.h"
|
2018-07-04 21:45:48 +02:00
|
|
|
#include "core/settings/qPref.h"
|
2016-01-11 19:10:00 -02:00
|
|
|
|
|
|
|
/* Wrapper class for the Settings. This will allow
|
|
|
|
* seamlessy integration of the settings with the QML
|
|
|
|
* and QWidget frontends. This class will be huge, since
|
|
|
|
* I need tons of properties, one for each option. */
|
|
|
|
|
|
|
|
/* Control the state of the Partial Pressure Graphs preferences */
|
|
|
|
class PartialPressureGasSettings : public QObject {
|
|
|
|
Q_OBJECT
|
2017-11-18 16:06:41 +01:00
|
|
|
Q_PROPERTY(bool show_po2 READ showPo2 WRITE setShowPo2 NOTIFY showPo2Changed)
|
|
|
|
Q_PROPERTY(bool show_pn2 READ showPn2 WRITE setShowPn2 NOTIFY showPn2Changed)
|
|
|
|
Q_PROPERTY(bool show_phe READ showPhe WRITE setShowPhe NOTIFY showPheChanged)
|
2017-03-24 19:11:31 +01:00
|
|
|
Q_PROPERTY(double po2_threshold_min READ po2ThresholdMin WRITE setPo2ThresholdMin NOTIFY po2ThresholdMinChanged)
|
|
|
|
Q_PROPERTY(double po2_threshold_max READ po2ThresholdMax WRITE setPo2ThresholdMax NOTIFY po2ThresholdMaxChanged)
|
|
|
|
Q_PROPERTY(double pn2_threshold READ pn2Threshold WRITE setPn2Threshold NOTIFY pn2ThresholdChanged)
|
|
|
|
Q_PROPERTY(double phe_threshold READ pheThreshold WRITE setPheThreshold NOTIFY pheThresholdChanged)
|
2016-01-11 20:37:54 -02:00
|
|
|
|
|
|
|
public:
|
|
|
|
PartialPressureGasSettings(QObject *parent);
|
2017-11-18 16:06:41 +01:00
|
|
|
bool showPo2() const;
|
|
|
|
bool showPn2() const;
|
|
|
|
bool showPhe() const;
|
2017-03-24 19:11:31 +01:00
|
|
|
double po2ThresholdMin() const;
|
|
|
|
double po2ThresholdMax() const;
|
2016-01-11 20:37:54 -02:00
|
|
|
double pn2Threshold() const;
|
|
|
|
double pheThreshold() const;
|
|
|
|
|
|
|
|
public slots:
|
2017-11-18 16:06:41 +01:00
|
|
|
void setShowPo2(bool value);
|
|
|
|
void setShowPn2(bool value);
|
|
|
|
void setShowPhe(bool value);
|
2017-03-24 19:11:31 +01:00
|
|
|
void setPo2ThresholdMin(double value);
|
|
|
|
void setPo2ThresholdMax(double value);
|
2016-01-11 20:37:54 -02:00
|
|
|
void setPn2Threshold(double value);
|
|
|
|
void setPheThreshold(double value);
|
|
|
|
|
|
|
|
signals:
|
2017-11-18 16:06:41 +01:00
|
|
|
void showPo2Changed(bool value);
|
|
|
|
void showPn2Changed(bool value);
|
|
|
|
void showPheChanged(bool value);
|
2017-03-24 19:11:31 +01:00
|
|
|
void po2ThresholdMaxChanged(double value);
|
|
|
|
void po2ThresholdMinChanged(double value);
|
2016-01-11 20:37:54 -02:00
|
|
|
void pn2ThresholdChanged(double value);
|
|
|
|
void pheThresholdChanged(double value);
|
2016-09-25 11:01:03 -07:00
|
|
|
|
2016-01-22 17:46:15 -02:00
|
|
|
private:
|
2016-09-25 11:01:03 -07:00
|
|
|
const QString group = QStringLiteral("TecDetails");
|
2016-01-11 20:37:54 -02:00
|
|
|
};
|
|
|
|
|
2016-01-11 19:10:00 -02:00
|
|
|
/* Control the state of the Geocoding preferences */
|
|
|
|
class GeocodingPreferences : public QObject {
|
|
|
|
Q_OBJECT
|
2016-01-13 17:36:11 -02:00
|
|
|
Q_PROPERTY(taxonomy_category first_category READ firstTaxonomyCategory WRITE setFirstTaxonomyCategory NOTIFY firstTaxonomyCategoryChanged)
|
|
|
|
Q_PROPERTY(taxonomy_category second_category READ secondTaxonomyCategory WRITE setSecondTaxonomyCategory NOTIFY secondTaxonomyCategoryChanged)
|
|
|
|
Q_PROPERTY(taxonomy_category third_category READ thirdTaxonomyCategory WRITE setThirdTaxonomyCategory NOTIFY thirdTaxonomyCategoryChanged)
|
2016-01-11 19:10:00 -02:00
|
|
|
public:
|
|
|
|
GeocodingPreferences(QObject *parent);
|
2016-01-13 17:36:11 -02:00
|
|
|
taxonomy_category firstTaxonomyCategory() const;
|
|
|
|
taxonomy_category secondTaxonomyCategory() const;
|
|
|
|
taxonomy_category thirdTaxonomyCategory() const;
|
|
|
|
|
|
|
|
public slots:
|
2016-10-15 19:21:44 +02:00
|
|
|
void setFirstTaxonomyCategory(taxonomy_category value);
|
|
|
|
void setSecondTaxonomyCategory(taxonomy_category value);
|
|
|
|
void setThirdTaxonomyCategory(taxonomy_category value);
|
2016-01-13 17:36:11 -02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void firstTaxonomyCategoryChanged(taxonomy_category value);
|
|
|
|
void secondTaxonomyCategoryChanged(taxonomy_category value);
|
|
|
|
void thirdTaxonomyCategoryChanged(taxonomy_category value);
|
|
|
|
private:
|
2016-09-25 11:01:03 -07:00
|
|
|
const QString group = QStringLiteral("geocoding");
|
2016-01-11 19:10:00 -02:00
|
|
|
};
|
|
|
|
|
2016-01-22 15:39:40 -02:00
|
|
|
class GeneralSettingsObjectWrapper : public QObject {
|
|
|
|
Q_OBJECT
|
2018-07-10 15:04:35 +02:00
|
|
|
Q_PROPERTY(QString default_filename READ defaultFilename WRITE setDefaultFilename NOTIFY defaultFilenameChanged)
|
|
|
|
Q_PROPERTY(QString default_cylinder READ defaultCylinder WRITE setDefaultCylinder NOTIFY defaultCylinderChanged)
|
|
|
|
Q_PROPERTY(short default_file_behavior READ defaultFileBehavior WRITE setDefaultFileBehavior NOTIFY defaultFileBehaviorChanged)
|
|
|
|
Q_PROPERTY(bool use_default_file READ useDefaultFile WRITE setUseDefaultFile NOTIFY useDefaultFileChanged)
|
|
|
|
Q_PROPERTY(int defaultsetpoint READ defaultSetPoint WRITE setDefaultSetPoint NOTIFY defaultSetPointChanged)
|
|
|
|
Q_PROPERTY(int o2consumption READ o2Consumption WRITE setO2Consumption NOTIFY o2ConsumptionChanged)
|
|
|
|
Q_PROPERTY(int pscr_ratio READ pscrRatio WRITE setPscrRatio NOTIFY pscrRatioChanged)
|
|
|
|
Q_PROPERTY(bool auto_recalculate_thumbnails READ autoRecalculateThumbnails WRITE setAutoRecalculateThumbnails NOTIFY autoRecalculateThumbnailsChanged)
|
|
|
|
Q_PROPERTY(bool extract_video_thumbnails READ extractVideoThumbnails WRITE setExtractVideoThumbnails NOTIFY extractVideoThumbnailsChanged)
|
|
|
|
Q_PROPERTY(int extract_video_thumbnails_position READ extractVideoThumbnailsPosition WRITE setExtractVideoThumbnailsPosition NOTIFY extractVideoThumbnailsPositionChanged)
|
|
|
|
Q_PROPERTY(QString ffmpeg_executable READ ffmpegExecutable WRITE setFfmpegExecutable NOTIFY ffmpegExecutableChanged)
|
2016-01-22 15:39:40 -02:00
|
|
|
|
|
|
|
public:
|
|
|
|
GeneralSettingsObjectWrapper(QObject *parent);
|
|
|
|
QString defaultFilename() const;
|
|
|
|
QString defaultCylinder() const;
|
|
|
|
short defaultFileBehavior() const;
|
|
|
|
bool useDefaultFile() const;
|
|
|
|
int defaultSetPoint() const;
|
|
|
|
int o2Consumption() const;
|
|
|
|
int pscrRatio() const;
|
2018-05-27 15:42:22 +02:00
|
|
|
bool autoRecalculateThumbnails() const;
|
2018-07-10 15:04:35 +02:00
|
|
|
bool extractVideoThumbnails() const;
|
|
|
|
int extractVideoThumbnailsPosition() const;
|
|
|
|
QString ffmpegExecutable() const;
|
2016-01-22 15:39:40 -02:00
|
|
|
|
|
|
|
public slots:
|
2018-05-27 15:42:22 +02:00
|
|
|
void setDefaultFilename (const QString& value);
|
|
|
|
void setDefaultCylinder (const QString& value);
|
|
|
|
void setDefaultFileBehavior (short value);
|
|
|
|
void setUseDefaultFile (bool value);
|
|
|
|
void setDefaultSetPoint (int value);
|
|
|
|
void setO2Consumption (int value);
|
|
|
|
void setPscrRatio (int value);
|
|
|
|
void setAutoRecalculateThumbnails (bool value);
|
2018-07-10 15:04:35 +02:00
|
|
|
void setExtractVideoThumbnails (bool value);
|
|
|
|
void setExtractVideoThumbnailsPosition (int value);
|
|
|
|
void setFfmpegExecutable (const QString &value);
|
2016-01-22 15:39:40 -02:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void defaultFilenameChanged(const QString& value);
|
|
|
|
void defaultCylinderChanged(const QString& value);
|
|
|
|
void defaultFileBehaviorChanged(short value);
|
|
|
|
void useDefaultFileChanged(bool value);
|
|
|
|
void defaultSetPointChanged(int value);
|
|
|
|
void o2ConsumptionChanged(int value);
|
|
|
|
void pscrRatioChanged(int value);
|
2018-05-27 15:42:22 +02:00
|
|
|
void autoRecalculateThumbnailsChanged(int value);
|
2018-07-10 15:04:35 +02:00
|
|
|
void extractVideoThumbnailsChanged(bool value);
|
|
|
|
void extractVideoThumbnailsPositionChanged(int value);
|
|
|
|
void ffmpegExecutableChanged(const QString &value);
|
2016-01-22 15:39:40 -02:00
|
|
|
private:
|
2016-09-25 11:01:03 -07:00
|
|
|
const QString group = QStringLiteral("GeneralSettings");
|
2016-01-22 16:00:44 -02:00
|
|
|
};
|
2016-01-22 15:39:40 -02:00
|
|
|
|
2016-01-22 16:55:03 -02:00
|
|
|
class LanguageSettingsObjectWrapper : public QObject {
|
2016-01-11 19:10:00 -02:00
|
|
|
Q_OBJECT
|
2016-01-22 16:55:03 -02:00
|
|
|
Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged)
|
2016-01-11 19:10:00 -02:00
|
|
|
Q_PROPERTY(QString time_format READ timeFormat WRITE setTimeFormat NOTIFY timeFormatChanged)
|
2016-01-22 16:55:03 -02:00
|
|
|
Q_PROPERTY(QString date_format READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged)
|
2016-01-11 19:10:00 -02:00
|
|
|
Q_PROPERTY(QString date_format_short READ dateFormatShort WRITE setDateFormatShort NOTIFY dateFormatShortChanged)
|
2016-10-17 18:23:45 +02:00
|
|
|
Q_PROPERTY(QString lang_locale READ langLocale WRITE setLangLocale NOTIFY langLocaleChanged)
|
2016-01-11 19:10:00 -02:00
|
|
|
Q_PROPERTY(bool time_format_override READ timeFormatOverride WRITE setTimeFormatOverride NOTIFY timeFormatOverrideChanged)
|
|
|
|
Q_PROPERTY(bool date_format_override READ dateFormatOverride WRITE setDateFormatOverride NOTIFY dateFormatOverrideChanged)
|
2016-01-22 16:55:03 -02:00
|
|
|
Q_PROPERTY(bool use_system_language READ useSystemLanguage WRITE setUseSystemLanguage NOTIFY useSystemLanguageChanged)
|
|
|
|
|
|
|
|
public:
|
|
|
|
LanguageSettingsObjectWrapper(QObject *parent);
|
|
|
|
QString language() const;
|
2016-10-17 18:23:45 +02:00
|
|
|
QString langLocale() const;
|
2016-01-22 16:55:03 -02:00
|
|
|
QString timeFormat() const;
|
|
|
|
QString dateFormat() const;
|
|
|
|
QString dateFormatShort() const;
|
|
|
|
bool timeFormatOverride() const;
|
|
|
|
bool dateFormatOverride() const;
|
|
|
|
bool useSystemLanguage() const;
|
|
|
|
|
|
|
|
public slots:
|
2016-09-20 12:35:49 -07:00
|
|
|
void setLangLocale (const QString& value);
|
2016-01-22 16:55:03 -02:00
|
|
|
void setLanguage (const QString& value);
|
|
|
|
void setTimeFormat (const QString& value);
|
|
|
|
void setDateFormat (const QString& value);
|
|
|
|
void setDateFormatShort (const QString& value);
|
|
|
|
void setTimeFormatOverride (bool value);
|
|
|
|
void setDateFormatOverride (bool value);
|
|
|
|
void setUseSystemLanguage (bool value);
|
|
|
|
signals:
|
|
|
|
void languageChanged(const QString& value);
|
2016-10-17 18:23:45 +02:00
|
|
|
void langLocaleChanged(const QString& value);
|
2016-01-22 16:55:03 -02:00
|
|
|
void timeFormatChanged(const QString& value);
|
|
|
|
void dateFormatChanged(const QString& value);
|
|
|
|
void dateFormatShortChanged(const QString& value);
|
|
|
|
void timeFormatOverrideChanged(bool value);
|
|
|
|
void dateFormatOverrideChanged(bool value);
|
|
|
|
void useSystemLanguageChanged(bool value);
|
|
|
|
|
|
|
|
private:
|
2016-09-25 11:01:03 -07:00
|
|
|
const QString group = QStringLiteral("Language");
|
2016-01-22 16:55:03 -02:00
|
|
|
};
|
|
|
|
|
2016-01-22 17:46:15 -02:00
|
|
|
class LocationServiceSettingsObjectWrapper : public QObject {
|
|
|
|
Q_OBJECT
|
2016-01-11 19:10:00 -02:00
|
|
|
Q_PROPERTY(int time_threshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
|
|
|
|
Q_PROPERTY(int distance_threshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
|
2016-01-22 17:46:15 -02:00
|
|
|
public:
|
|
|
|
LocationServiceSettingsObjectWrapper(QObject *parent);
|
|
|
|
int timeThreshold() const;
|
|
|
|
int distanceThreshold() const;
|
|
|
|
public slots:
|
|
|
|
void setTimeThreshold(int value);
|
|
|
|
void setDistanceThreshold(int value);
|
|
|
|
signals:
|
|
|
|
void timeThresholdChanged(int value);
|
|
|
|
void distanceThresholdChanged(int value);
|
|
|
|
private:
|
2016-11-01 11:28:08 +01:00
|
|
|
const QString group = QStringLiteral("LocationService");
|
2016-01-22 17:46:15 -02:00
|
|
|
};
|
|
|
|
|
|
|
|
class SettingsObjectWrapper : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2018-08-05 10:57:24 +02:00
|
|
|
Q_PROPERTY(qPrefTechnicalDetails* techical_details MEMBER techDetails CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
Q_PROPERTY(PartialPressureGasSettings* pp_gas MEMBER pp_gas CONSTANT)
|
2018-07-23 17:49:12 +02:00
|
|
|
Q_PROPERTY(qPrefFacebook* facebook MEMBER facebook CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
Q_PROPERTY(GeocodingPreferences* geocoding MEMBER geocoding CONSTANT)
|
2018-07-27 21:55:49 +02:00
|
|
|
Q_PROPERTY(qPrefProxy* proxy MEMBER proxy CONSTANT)
|
2018-07-14 16:52:25 +02:00
|
|
|
Q_PROPERTY(qPrefCloudStorage* cloud_storage MEMBER cloud_storage CONSTANT)
|
2018-08-01 21:41:42 +02:00
|
|
|
Q_PROPERTY(qPrefDivePlanner* planner MEMBER planner_settings CONSTANT)
|
2018-07-31 18:40:59 +02:00
|
|
|
Q_PROPERTY(qPrefUnits* units MEMBER unit_settings CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
Q_PROPERTY(GeneralSettingsObjectWrapper* general MEMBER general_settings CONSTANT)
|
2018-07-04 21:45:48 +02:00
|
|
|
Q_PROPERTY(qPrefDisplay* display MEMBER display_settings CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
Q_PROPERTY(LanguageSettingsObjectWrapper* language MEMBER language_settings CONSTANT)
|
2018-07-12 10:25:28 +02:00
|
|
|
Q_PROPERTY(qPrefAnimations* animation MEMBER animation_settings CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
Q_PROPERTY(LocationServiceSettingsObjectWrapper* Location MEMBER location_settings CONSTANT)
|
2016-08-10 15:50:00 -03:00
|
|
|
|
2018-08-03 20:25:02 +02:00
|
|
|
Q_PROPERTY(qPrefUpdateManager* update MEMBER update_manager_settings CONSTANT)
|
2018-07-22 16:19:22 +02:00
|
|
|
Q_PROPERTY(qPrefDiveComputer* dive_computer MEMBER dive_computer_settings CONSTANT)
|
2016-01-22 17:46:15 -02:00
|
|
|
public:
|
2016-01-25 15:54:23 -02:00
|
|
|
static SettingsObjectWrapper *instance();
|
2016-01-11 19:10:00 -02:00
|
|
|
|
2018-08-05 10:57:24 +02:00
|
|
|
qPrefTechnicalDetails *techDetails;
|
2016-01-11 19:10:00 -02:00
|
|
|
PartialPressureGasSettings *pp_gas;
|
2018-07-23 17:49:12 +02:00
|
|
|
qPrefFacebook *facebook;
|
2016-01-11 19:10:00 -02:00
|
|
|
GeocodingPreferences *geocoding;
|
2018-07-27 21:55:49 +02:00
|
|
|
qPrefProxy *proxy;
|
2018-07-14 16:52:25 +02:00
|
|
|
qPrefCloudStorage *cloud_storage;
|
2018-08-01 21:41:42 +02:00
|
|
|
qPrefDivePlanner *planner_settings;
|
2018-07-31 18:40:59 +02:00
|
|
|
qPrefUnits *unit_settings;
|
2016-01-22 15:39:40 -02:00
|
|
|
GeneralSettingsObjectWrapper *general_settings;
|
2018-07-04 21:45:48 +02:00
|
|
|
qPrefDisplay *display_settings;
|
2016-01-22 17:46:15 -02:00
|
|
|
LanguageSettingsObjectWrapper *language_settings;
|
2018-07-12 10:25:28 +02:00
|
|
|
qPrefAnimations *animation_settings;
|
2016-01-22 17:46:15 -02:00
|
|
|
LocationServiceSettingsObjectWrapper *location_settings;
|
2018-08-03 20:25:02 +02:00
|
|
|
qPrefUpdateManager *update_manager_settings;
|
2018-07-22 16:19:22 +02:00
|
|
|
qPrefDiveComputer *dive_computer_settings;
|
2016-08-10 18:10:15 -03:00
|
|
|
|
2016-08-26 16:01:31 -03:00
|
|
|
void sync();
|
|
|
|
void load();
|
2016-01-25 15:54:23 -02:00
|
|
|
private:
|
|
|
|
SettingsObjectWrapper(QObject *parent = NULL);
|
2016-01-11 19:10:00 -02:00
|
|
|
};
|
|
|
|
|
2016-01-22 17:46:15 -02:00
|
|
|
#endif
|