diff options
Diffstat (limited to 'core/subsurface-qt')
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 2 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 625 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 230 |
3 files changed, 1 insertions, 856 deletions
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 15291554d..a69c73ddc 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -207,7 +207,7 @@ QString DiveObjectHelper::gas() const gas = m_dive->cylinder[i].type.description; if (!gas.isEmpty()) gas += QChar(' '); - gas += gasname(&m_dive->cylinder[i].gasmix); + gas += gasname(m_dive->cylinder[i].gasmix); // if has a description and if such gas is not already present if (!gas.isEmpty() && gases.indexOf(gas) == -1) { if (!gases.isEmpty()) diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp deleted file mode 100644 index 84ffc5a26..000000000 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ /dev/null @@ -1,625 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "SettingsObjectWrapper.h" -#include <QSettings> -#include <QApplication> -#include <QFont> -#include <QDate> - -#include "core/qthelper.h" -#include "core/prefs-macros.h" - -PartialPressureGasSettings::PartialPressureGasSettings(QObject* parent): - QObject(parent) -{ - -} - -bool PartialPressureGasSettings::showPo2() const -{ - return prefs.pp_graphs.po2; -} - -bool PartialPressureGasSettings::showPn2() const -{ - return prefs.pp_graphs.pn2; -} - -bool PartialPressureGasSettings::showPhe() const -{ - return prefs.pp_graphs.phe; -} - -double PartialPressureGasSettings::po2ThresholdMin() const -{ - return prefs.pp_graphs.po2_threshold_min; -} - -double PartialPressureGasSettings::po2ThresholdMax() const -{ - return prefs.pp_graphs.po2_threshold_max; -} - - -double PartialPressureGasSettings::pn2Threshold() const -{ - return prefs.pp_graphs.pn2_threshold; -} - -double PartialPressureGasSettings::pheThreshold() const -{ - return prefs.pp_graphs.phe_threshold; -} - -void PartialPressureGasSettings::setShowPo2(bool value) -{ - if (value == prefs.pp_graphs.po2) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("po2graph", value); - prefs.pp_graphs.po2 = value; - emit showPo2Changed(value); -} - -void PartialPressureGasSettings::setShowPn2(bool value) -{ - if (value == prefs.pp_graphs.pn2) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("pn2graph", value); - prefs.pp_graphs.pn2 = value; - emit showPn2Changed(value); -} - -void PartialPressureGasSettings::setShowPhe(bool value) -{ - if (value == prefs.pp_graphs.phe) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("phegraph", value); - prefs.pp_graphs.phe = value; - emit showPheChanged(value); -} - -void PartialPressureGasSettings::setPo2ThresholdMin(double value) -{ - if (value == prefs.pp_graphs.po2_threshold_min) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("po2thresholdmin", value); - prefs.pp_graphs.po2_threshold_min = value; - emit po2ThresholdMinChanged(value); -} - -void PartialPressureGasSettings::setPo2ThresholdMax(double value) -{ - if (value == prefs.pp_graphs.po2_threshold_max) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("po2thresholdmax", value); - prefs.pp_graphs.po2_threshold_max = value; - emit po2ThresholdMaxChanged(value); -} - -void PartialPressureGasSettings::setPn2Threshold(double value) -{ - if (value == prefs.pp_graphs.pn2_threshold) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("pn2threshold", value); - prefs.pp_graphs.pn2_threshold = value; - emit pn2ThresholdChanged(value); -} - -void PartialPressureGasSettings::setPheThreshold(double value) -{ - if (value == prefs.pp_graphs.phe_threshold) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("phethreshold", value); - prefs.pp_graphs.phe_threshold = value; - emit pheThresholdChanged(value); -} - -GeocodingPreferences::GeocodingPreferences(QObject *parent) : - QObject(parent) -{ - -} - -taxonomy_category GeocodingPreferences::firstTaxonomyCategory() const -{ - return prefs.geocoding.category[0]; -} - -taxonomy_category GeocodingPreferences::secondTaxonomyCategory() const -{ - return prefs.geocoding.category[1]; -} - -taxonomy_category GeocodingPreferences::thirdTaxonomyCategory() const -{ - return prefs.geocoding.category[2]; -} - -void GeocodingPreferences::setFirstTaxonomyCategory(taxonomy_category value) -{ - if (value == prefs.geocoding.category[0]) - return; - QSettings s; - s.beginGroup(group); - s.setValue("cat0", value); - prefs.geocoding.category[0] = value; - emit firstTaxonomyCategoryChanged(value); -} - -void GeocodingPreferences::setSecondTaxonomyCategory(taxonomy_category value) -{ - if (value == prefs.geocoding.category[1]) - return; - QSettings s; - s.beginGroup(group); - s.setValue("cat1", value); - prefs.geocoding.category[1]= value; - emit secondTaxonomyCategoryChanged(value); -} - -void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value) -{ - if (value == prefs.geocoding.category[2]) - return; - QSettings s; - s.beginGroup(group); - s.setValue("cat2", value); - prefs.geocoding.category[2] = value; - emit thirdTaxonomyCategoryChanged(value); -} - -GeneralSettingsObjectWrapper::GeneralSettingsObjectWrapper(QObject *parent) : - QObject(parent) -{ -} - -QString GeneralSettingsObjectWrapper::defaultFilename() const -{ - return prefs.default_filename; -} - -QString GeneralSettingsObjectWrapper::defaultCylinder() const -{ - return prefs.default_cylinder; -} - -short GeneralSettingsObjectWrapper::defaultFileBehavior() const -{ - return prefs.default_file_behavior; -} - -bool GeneralSettingsObjectWrapper::useDefaultFile() const -{ - return prefs.use_default_file; -} - -int GeneralSettingsObjectWrapper::defaultSetPoint() const -{ - return prefs.defaultsetpoint; -} - -int GeneralSettingsObjectWrapper::o2Consumption() const -{ - return prefs.o2consumption; -} - -int GeneralSettingsObjectWrapper::pscrRatio() const -{ - return prefs.pscr_ratio; -} - -bool GeneralSettingsObjectWrapper::autoRecalculateThumbnails() const -{ - return prefs.auto_recalculate_thumbnails; -} - -bool GeneralSettingsObjectWrapper::extractVideoThumbnails() const -{ - return prefs.extract_video_thumbnails; -} - -int GeneralSettingsObjectWrapper::extractVideoThumbnailsPosition() const -{ - return prefs.extract_video_thumbnails_position; -} - -QString GeneralSettingsObjectWrapper::ffmpegExecutable() const -{ - return prefs.ffmpeg_executable; -} - -void GeneralSettingsObjectWrapper::setDefaultFilename(const QString& value) -{ - if (value == prefs.default_filename) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_filename", value); - free((void *)prefs.default_filename); - prefs.default_filename = copy_qstring(value); - emit defaultFilenameChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultCylinder(const QString& value) -{ - if (value == prefs.default_cylinder) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_cylinder", value); - free((void *)prefs.default_cylinder); - prefs.default_cylinder = copy_qstring(value); - emit defaultCylinderChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultFileBehavior(short value) -{ - if (value == prefs.default_file_behavior && prefs.default_file_behavior != UNDEFINED_DEFAULT_FILE) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("default_file_behavior", value); - - prefs.default_file_behavior = value; - if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) { - // undefined, so check if there's a filename set and - // use that, otherwise go with no default file - if (QString(prefs.default_filename).isEmpty()) - prefs.default_file_behavior = NO_DEFAULT_FILE; - else - prefs.default_file_behavior = LOCAL_DEFAULT_FILE; - } - emit defaultFileBehaviorChanged(value); -} - -void GeneralSettingsObjectWrapper::setUseDefaultFile(bool value) -{ - if (value == prefs.use_default_file) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("use_default_file", value); - prefs.use_default_file = value; - emit useDefaultFileChanged(value); -} - -void GeneralSettingsObjectWrapper::setDefaultSetPoint(int value) -{ - if (value == prefs.defaultsetpoint) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("defaultsetpoint", value); - prefs.defaultsetpoint = value; - emit defaultSetPointChanged(value); -} - -void GeneralSettingsObjectWrapper::setO2Consumption(int value) -{ - if (value == prefs.o2consumption) - return; - QSettings s; - s.beginGroup(group); - s.setValue("o2consumption", value); - prefs.o2consumption = value; - emit o2ConsumptionChanged(value); -} - -void GeneralSettingsObjectWrapper::setPscrRatio(int value) -{ - if (value == prefs.pscr_ratio) - return; - QSettings s; - s.beginGroup(group); - s.setValue("pscr_ratio", value); - prefs.pscr_ratio = value; - emit pscrRatioChanged(value); -} - -void GeneralSettingsObjectWrapper::setAutoRecalculateThumbnails(bool value) -{ - if (value == prefs.auto_recalculate_thumbnails) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("auto_recalculate_thumbnails", value); - prefs.auto_recalculate_thumbnails = value; - emit autoRecalculateThumbnailsChanged(value); -} - -void GeneralSettingsObjectWrapper::setExtractVideoThumbnails(bool value) -{ - if (value == prefs.extract_video_thumbnails) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("extract_video_thumbnails", value); - prefs.extract_video_thumbnails = value; - emit extractVideoThumbnailsChanged(value); -} - -void GeneralSettingsObjectWrapper::setExtractVideoThumbnailsPosition(int value) -{ - if (value == prefs.extract_video_thumbnails_position) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("extract_video_thumbnails_position", value); - prefs.extract_video_thumbnails_position = value; - emit extractVideoThumbnailsPositionChanged(value); -} - -void GeneralSettingsObjectWrapper::setFfmpegExecutable(const QString &value) -{ - if (value == prefs.ffmpeg_executable) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("ffmpeg_executable", value); - free((void *)prefs.ffmpeg_executable); - prefs.ffmpeg_executable = copy_qstring(value); - emit ffmpegExecutableChanged(value); -} - -LanguageSettingsObjectWrapper::LanguageSettingsObjectWrapper(QObject *parent) : - QObject(parent) -{ -} - -QString LanguageSettingsObjectWrapper::language() const -{ - return prefs.locale.language; -} - -QString LanguageSettingsObjectWrapper::timeFormat() const -{ - return prefs.time_format; -} - -QString LanguageSettingsObjectWrapper::dateFormat() const -{ - return prefs.date_format; -} - -QString LanguageSettingsObjectWrapper::dateFormatShort() const -{ - return prefs.date_format_short; -} - -bool LanguageSettingsObjectWrapper::timeFormatOverride() const -{ - return prefs.time_format_override; -} - -bool LanguageSettingsObjectWrapper::dateFormatOverride() const -{ - return prefs.date_format_override; -} - -bool LanguageSettingsObjectWrapper::useSystemLanguage() const -{ - return prefs.locale.use_system_language; -} - -QString LanguageSettingsObjectWrapper::langLocale() const -{ - return prefs.locale.lang_locale; -} - -void LanguageSettingsObjectWrapper::setUseSystemLanguage(bool value) -{ - if (value == prefs.locale.use_system_language) - return; - QSettings s; - s.beginGroup(group); - s.setValue("UseSystemLanguage", value); - prefs.locale.use_system_language = value; - emit useSystemLanguageChanged(value); -} - -void LanguageSettingsObjectWrapper::setLangLocale(const QString &value) -{ - if (value == prefs.locale.lang_locale) - return; - QSettings s; - s.beginGroup(group); - s.setValue("UiLangLocale", value); - free((void *)prefs.locale.lang_locale); - prefs.locale.lang_locale = copy_qstring(value); - emit langLocaleChanged(value); -} - -void LanguageSettingsObjectWrapper::setLanguage(const QString& value) -{ - if (value == prefs.locale.language) - return; - QSettings s; - s.beginGroup(group); - s.setValue("UiLanguage", value); - free((void *)prefs.locale.language); - prefs.locale.language = copy_qstring(value); - emit languageChanged(value); -} - -void LanguageSettingsObjectWrapper::setTimeFormat(const QString& value) -{ - if (value == prefs.time_format) - return; - QSettings s; - s.beginGroup(group); - s.setValue("time_format", value); - free((void *)prefs.time_format); - prefs.time_format = copy_qstring(value); - emit timeFormatChanged(value); -} - -void LanguageSettingsObjectWrapper::setDateFormat(const QString& value) -{ - if (value == prefs.date_format) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("date_format", value); - free((void *)prefs.date_format); - prefs.date_format = copy_qstring(value); - emit dateFormatChanged(value); -} - -void LanguageSettingsObjectWrapper::setDateFormatShort(const QString& value) -{ - if (value == prefs.date_format_short) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("date_format_short", value); - free((void *)prefs.date_format_short); - prefs.date_format_short = copy_qstring(value); - emit dateFormatShortChanged(value); -} - -void LanguageSettingsObjectWrapper::setTimeFormatOverride(bool value) -{ - if (value == prefs.time_format_override) - return; - QSettings s; - s.beginGroup(group); - s.setValue("time_format_override", value); - prefs.time_format_override = value; - emit timeFormatOverrideChanged(value); -} - -void LanguageSettingsObjectWrapper::setDateFormatOverride(bool value) -{ - if (value == prefs.date_format_override) - return; - - QSettings s; - s.beginGroup(group); - s.setValue("date_format_override", value); - prefs.date_format_override = value; - emit dateFormatOverrideChanged(value); -} - - -SettingsObjectWrapper::SettingsObjectWrapper(QObject* parent): -QObject(parent), - techDetails(new qPrefTechnicalDetails(this)), - pp_gas(new PartialPressureGasSettings(this)), - facebook(new qPrefFacebook(this)), - geocoding(new GeocodingPreferences(this)), - proxy(new qPrefProxy(this)), - cloud_storage(new qPrefCloudStorage(this)), - planner_settings(new qPrefDivePlanner(this)), - unit_settings(new qPrefUnits(this)), - general_settings(new GeneralSettingsObjectWrapper(this)), - display_settings(new qPrefDisplay(this)), - language_settings(new LanguageSettingsObjectWrapper(this)), - animation_settings(new qPrefAnimations(this)), - location_settings(new qPrefLocationService(this)), - update_manager_settings(new qPrefUpdateManager(this)), - dive_computer_settings(new qPrefDiveComputer(this)) -{ -} - -void SettingsObjectWrapper::load() -{ - QSettings s; - QVariant v; - - uiLanguage(NULL); - - qPrefUnits::instance()->load(); - qPrefTechnicalDetails::instance()->load(); - - s.beginGroup("GeneralSettings"); - GET_TXT("default_filename", default_filename); - GET_INT("default_file_behavior", default_file_behavior); - if (prefs.default_file_behavior == UNDEFINED_DEFAULT_FILE) { - // undefined, so check if there's a filename set and - // use that, otherwise go with no default file - if (QString(prefs.default_filename).isEmpty()) - prefs.default_file_behavior = NO_DEFAULT_FILE; - else - prefs.default_file_behavior = LOCAL_DEFAULT_FILE; - } - GET_TXT("default_cylinder", default_cylinder); - GET_BOOL("use_default_file", use_default_file); - GET_INT("defaultsetpoint", defaultsetpoint); - GET_INT("o2consumption", o2consumption); - GET_INT("pscr_ratio", pscr_ratio); - GET_BOOL("auto_recalculate_thumbnails", auto_recalculate_thumbnails); - s.endGroup(); - - qPrefAnimations::instance()->load(); - qPrefCloudStorage::instance()->load(); - qPrefDisplay::instance()->load(); - qPrefProxy::instance()->load(); - - // GeoManagement - s.beginGroup("geocoding"); - - GET_ENUM("cat0", taxonomy_category, geocoding.category[0]); - GET_ENUM("cat1", taxonomy_category, geocoding.category[1]); - GET_ENUM("cat2", taxonomy_category, geocoding.category[2]); - s.endGroup(); - - // GPS service time and distance thresholds - qPrefLocationService::instance()->load(); - - qPrefDivePlanner::instance()->load(); - qPrefDiveComputer::instance()->load(); - qPrefUpdateManager::instance()->load(); - - s.beginGroup("Language"); - GET_BOOL("UseSystemLanguage", locale.use_system_language); - GET_TXT("UiLanguage", locale.language); - GET_TXT("UiLangLocale", locale.lang_locale); - GET_TXT("time_format", time_format); - GET_TXT("date_format", date_format); - GET_TXT("date_format_short", date_format_short); - GET_BOOL("time_format_override", time_format_override); - GET_BOOL("date_format_override", date_format_override); - s.endGroup(); -} - -void SettingsObjectWrapper::sync() -{ - qPrefDisplay::instance()->sync(); -} - -SettingsObjectWrapper* SettingsObjectWrapper::instance() -{ - static SettingsObjectWrapper settings; - return &settings; -} diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h deleted file mode 100644 index 3af79404e..000000000 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ /dev/null @@ -1,230 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#ifndef SETTINGSOBJECTWRAPPER_H -#define SETTINGSOBJECTWRAPPER_H - -#include <QObject> -#include <QDate> - -#include "core/pref.h" -#include "core/settings/qPref.h" - -/* 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 - 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) - 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) - -public: - PartialPressureGasSettings(QObject *parent); - bool showPo2() const; - bool showPn2() const; - bool showPhe() const; - double po2ThresholdMin() const; - double po2ThresholdMax() const; - double pn2Threshold() const; - double pheThreshold() const; - -public slots: - void setShowPo2(bool value); - void setShowPn2(bool value); - void setShowPhe(bool value); - void setPo2ThresholdMin(double value); - void setPo2ThresholdMax(double value); - void setPn2Threshold(double value); - void setPheThreshold(double value); - -signals: - void showPo2Changed(bool value); - void showPn2Changed(bool value); - void showPheChanged(bool value); - void po2ThresholdMaxChanged(double value); - void po2ThresholdMinChanged(double value); - void pn2ThresholdChanged(double value); - void pheThresholdChanged(double value); - -private: - const QString group = QStringLiteral("TecDetails"); -}; - -/* Control the state of the Geocoding preferences */ -class GeocodingPreferences : public QObject { - Q_OBJECT - 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) -public: - GeocodingPreferences(QObject *parent); - taxonomy_category firstTaxonomyCategory() const; - taxonomy_category secondTaxonomyCategory() const; - taxonomy_category thirdTaxonomyCategory() const; - -public slots: - void setFirstTaxonomyCategory(taxonomy_category value); - void setSecondTaxonomyCategory(taxonomy_category value); - void setThirdTaxonomyCategory(taxonomy_category value); - -signals: - void firstTaxonomyCategoryChanged(taxonomy_category value); - void secondTaxonomyCategoryChanged(taxonomy_category value); - void thirdTaxonomyCategoryChanged(taxonomy_category value); -private: - const QString group = QStringLiteral("geocoding"); -}; - -class GeneralSettingsObjectWrapper : public QObject { - Q_OBJECT - 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) - -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; - bool autoRecalculateThumbnails() const; - bool extractVideoThumbnails() const; - int extractVideoThumbnailsPosition() const; - QString ffmpegExecutable() const; - -public slots: - 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); - void setExtractVideoThumbnails (bool value); - void setExtractVideoThumbnailsPosition (int value); - void setFfmpegExecutable (const QString &value); - -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); - void autoRecalculateThumbnailsChanged(int value); - void extractVideoThumbnailsChanged(bool value); - void extractVideoThumbnailsPositionChanged(int value); - void ffmpegExecutableChanged(const QString &value); -private: - const QString group = QStringLiteral("GeneralSettings"); -}; - -class LanguageSettingsObjectWrapper : public QObject { - Q_OBJECT - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) - Q_PROPERTY(QString time_format READ timeFormat WRITE setTimeFormat NOTIFY timeFormatChanged) - Q_PROPERTY(QString date_format READ dateFormat WRITE setDateFormat NOTIFY dateFormatChanged) - Q_PROPERTY(QString date_format_short READ dateFormatShort WRITE setDateFormatShort NOTIFY dateFormatShortChanged) - Q_PROPERTY(QString lang_locale READ langLocale WRITE setLangLocale NOTIFY langLocaleChanged) - Q_PROPERTY(bool time_format_override READ timeFormatOverride WRITE setTimeFormatOverride NOTIFY timeFormatOverrideChanged) - Q_PROPERTY(bool date_format_override READ dateFormatOverride WRITE setDateFormatOverride NOTIFY dateFormatOverrideChanged) - Q_PROPERTY(bool use_system_language READ useSystemLanguage WRITE setUseSystemLanguage NOTIFY useSystemLanguageChanged) - -public: - LanguageSettingsObjectWrapper(QObject *parent); - QString language() const; - QString langLocale() const; - QString timeFormat() const; - QString dateFormat() const; - QString dateFormatShort() const; - bool timeFormatOverride() const; - bool dateFormatOverride() const; - bool useSystemLanguage() const; - -public slots: - void setLangLocale (const QString& value); - 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); - void langLocaleChanged(const QString& value); - 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: - const QString group = QStringLiteral("Language"); -}; - -class SettingsObjectWrapper : public QObject { - Q_OBJECT - - Q_PROPERTY(qPrefTechnicalDetails* techical_details MEMBER techDetails CONSTANT) - Q_PROPERTY(PartialPressureGasSettings* pp_gas MEMBER pp_gas CONSTANT) - Q_PROPERTY(qPrefFacebook* facebook MEMBER facebook CONSTANT) - Q_PROPERTY(GeocodingPreferences* geocoding MEMBER geocoding CONSTANT) - Q_PROPERTY(qPrefProxy* proxy MEMBER proxy CONSTANT) - Q_PROPERTY(qPrefCloudStorage* cloud_storage MEMBER cloud_storage CONSTANT) - Q_PROPERTY(qPrefDivePlanner* planner MEMBER planner_settings CONSTANT) - Q_PROPERTY(qPrefUnits* units MEMBER unit_settings CONSTANT) - Q_PROPERTY(GeneralSettingsObjectWrapper* general MEMBER general_settings CONSTANT) - Q_PROPERTY(qPrefDisplay* display MEMBER display_settings CONSTANT) - Q_PROPERTY(LanguageSettingsObjectWrapper* language MEMBER language_settings CONSTANT) - Q_PROPERTY(qPrefAnimations* animation MEMBER animation_settings CONSTANT) - Q_PROPERTY(qPrefLocationService* Location MEMBER location_settings CONSTANT) - - Q_PROPERTY(qPrefUpdateManager* update MEMBER update_manager_settings CONSTANT) - Q_PROPERTY(qPrefDiveComputer* dive_computer MEMBER dive_computer_settings CONSTANT) -public: - static SettingsObjectWrapper *instance(); - - qPrefTechnicalDetails *techDetails; - PartialPressureGasSettings *pp_gas; - qPrefFacebook *facebook; - GeocodingPreferences *geocoding; - qPrefProxy *proxy; - qPrefCloudStorage *cloud_storage; - qPrefDivePlanner *planner_settings; - qPrefUnits *unit_settings; - GeneralSettingsObjectWrapper *general_settings; - qPrefDisplay *display_settings; - LanguageSettingsObjectWrapper *language_settings; - qPrefAnimations *animation_settings; - qPrefLocationService *location_settings; - qPrefUpdateManager *update_manager_settings; - qPrefDiveComputer *dive_computer_settings; - - void sync(); - void load(); -private: - SettingsObjectWrapper(QObject *parent = NULL); -}; - -#endif |