diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-13 17:36:11 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-15 05:54:30 -0800 |
commit | ab35ee69bdaf76083e56a5cd016bf7d65b0cf858 (patch) | |
tree | 5edde81fd89346b210d4f7e485616adfecb98823 /subsurface-core/subsurface-qt | |
parent | 5c62a0aac630adaf641ef59a65a28f0d84d6445b (diff) | |
download | subsurface-ab35ee69bdaf76083e56a5cd016bf7d65b0cf858.tar.gz |
Settings QObjectification: geocoding preferences
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt')
-rw-r--r-- | subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | 89 | ||||
-rw-r--r-- | subsurface-core/subsurface-qt/SettingsObjectWrapper.h | 30 |
2 files changed, 116 insertions, 3 deletions
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index edc3230f4..f31398832 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -457,4 +457,93 @@ void FacebookSettings::setAlbumId(const QString& value) #endif prefs.facebook.album_id = copy_string(qPrintable(value)); emit albumIdChanged(value); +} + + +GeocodingPreferences::GeocodingPreferences(QObject *parent) : + group(QStringLiteral("geocoding")) +{ + +} + +bool GeocodingPreferences::enableGeocoding() const +{ + return prefs.geocoding.enable_geocoding; +} + +bool GeocodingPreferences::parseDiveWithoutGps() const +{ + return prefs.geocoding.parse_dive_without_gps; +} + +bool GeocodingPreferences::tagExistingDives() const +{ + return prefs.geocoding.tag_existing_dives; +} + +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::setEnableGeocoding(bool value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("enable_geocoding", value); + prefs.geocoding.enable_geocoding = value; + emit enableGeocodingChanged(value); +} +void GeocodingPreferences::setParseDiveWithoutGps(bool value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("parse_dives_without_gps", value); + prefs.geocoding.parse_dive_without_gps = value; + emit parseDiveWithoutGpsChanged(value); +} +void GeocodingPreferences::setTagExistingDives(bool value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("tag_existing_dives", value); + prefs.geocoding.tag_existing_dives = value; + emit tagExistingDivesChanged(value); +} + +void GeocodingPreferences::setFirstTaxonomyCategory(taxonomy_category value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("cat0", value); + prefs.show_average_depth = value; + emit firstTaxonomyCategoryChanged(value); +} + +void GeocodingPreferences::setSecondTaxonomyCategory(taxonomy_category value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("cat1", value); + prefs.show_average_depth = value; + emit secondTaxonomyCategoryChanged(value); +} + +void GeocodingPreferences::setThirdTaxonomyCategory(taxonomy_category value) +{ + QSettings s; + s.beginGroup(group); + s.setValue("cat2", value); + prefs.show_average_depth = value; + emit thirdTaxonomyCategoryChanged(value); }
\ No newline at end of file diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h index cc7e06313..71e2e490a 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.h +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.h @@ -179,11 +179,35 @@ class GeocodingPreferences : public QObject { Q_PROPERTY(bool enable_geocoding READ enableGeocoding WRITE setEnableGeocoding NOTIFY enableGeocodingChanged) Q_PROPERTY(bool parse_dive_without_gps READ parseDiveWithoutGps WRITE setParseDiveWithoutGps NOTIFY parseDiveWithoutGpsChanged) Q_PROPERTY(bool tag_existing_dives READ tagExistingDives WRITE setTagExistingDives NOTIFY tagExistingDivesChanged) - Q_PROPERTY(taxonomy_category first_taxonomy READ firstTaxonomyCategory WRITE setFirstTaxonomyCategory NOTIFY firstTaxonomyCategoryChanged) - Q_PROPERTY(taxonomy_category second_taxonomy READ secondTaxonomyCategory WRITE setSecondTaxonomyCategory NOTIFY secondTaxonomyCategoryChanged) - Q_PROPERTY(taxonomy_category third_taxonomy READ thirdTaxonomyCategory WRITE setThirdTaxonomyCategory NOTIFY thirdTaxonomyCategoryChanged) + 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); + bool enableGeocoding() const; + bool parseDiveWithoutGps() const; + bool tagExistingDives() const; + taxonomy_category firstTaxonomyCategory() const; + taxonomy_category secondTaxonomyCategory() const; + taxonomy_category thirdTaxonomyCategory() const; + +public slots: + void setEnableGeocoding(bool value); + void setParseDiveWithoutGps(bool value); + void setTagExistingDives(bool value); + void setFirstTaxonomyCategory(taxonomy_category value); + void setSecondTaxonomyCategory(taxonomy_category value); + void setThirdTaxonomyCategory(taxonomy_category value); + +signals: + void enableGeocodingChanged(bool value); + void parseDiveWithoutGpsChanged(bool value); + void tagExistingDivesChanged(bool value); + void firstTaxonomyCategoryChanged(taxonomy_category value); + void secondTaxonomyCategoryChanged(taxonomy_category value); + void thirdTaxonomyCategoryChanged(taxonomy_category value); +private: + QString group; }; class ProxySettings : public QObject { |